localmente ad una macchina linux dopo installazione standard fatta da debian con apt-get:
john /etc/shadow
va ad effettuare la ricerca all'interno del file /etc/shadow di linux.
Quindi sa già in che modo dovrà cercare perchè il file shadow ha una sua struttura. Cercherà considerando la posizione in ogni riga dei caratteri da cercare.
ma la cosa migliore è installare la versione jumbo dai sorgenti. quindi dopo aver scaricato il file john-1.8.0-jumbo-1.tar.gz dal mio mirror.:
tar -xzvf john-1.8.0-jumbo-1.tar.gz cd john-1.8.0-jumbo-1 cd src ./configure --enable-mpi make -s clean make -sj4 cd .. cd run ./john --test
aspettare che finisca e se tutto è andato bene ora è pronto per esere eseguito da questa directory.
per installarlo penso si debba aggiungere ai comandi tipici dell'installazione un
make install
ma non sono sicuro così come non so a che cosa serva il make -s clean e il make -sj4
ho messo il ./ prima di john perchè altrimenti non lo esegue.
altro sistema:
./john --format=raw-md5 percorso-file-lista-password percorso-file-con-hash-da-scoprire
altrimenti se abbiamo già un file di testo contenente l'hash MD5 (attenzione le lettere devono essere minuscole altrimenti john non lo riconosce)
./john percorso-file-con-hash-da-scoprire/file-di-testo
se non si specifica il tipo di hash o la tipologia di crittazione john la cerca automaticamente e lo si capisce dal seguente output che appare subito dopo l'esecuzione del comando
Warning: detected hash type "LM", but the string is also recognized as "HAVAL-128-4" Use the "--format=HAVAL-128-4" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "lotus5" Use the "--format=lotus5" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "MD2" Use the "--format=MD2" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "mdc2" Use the "--format=mdc2" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "mscash" Use the "--format=mscash" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "mscash2" Use the "--format=mscash2" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "NT" Use the "--format=NT" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "nt2" Use the "--format=nt2" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "Raw-MD4" Use the "--format=Raw-MD4" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "Raw-MD5" Use the "--format=Raw-MD5" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "Raw-MD5u" Use the "--format=Raw-MD5u" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "ripemd-128" Use the "--format=ripemd-128" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "Snefru-128" Use the "--format=Snefru-128" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "lotus5-opencl" Use the "--format=lotus5-opencl" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "mscash2-opencl" Use the "--format=mscash2-opencl" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "nt-opencl" Use the "--format=nt-opencl" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "Raw-MD4-opencl" Use the "--format=Raw-MD4-opencl" option to force loading these as that type instead Warning: detected hash type "LM", but the string is also recognized as "Raw-MD5-opencl" Use the "--format=Raw-MD5-opencl" option to force loading these as that type instead
Allora, dalle ultime prove sembra che il comando seguente funzioni:
./john --format=raw-md5 --wordlist=/home/stefano/Scrivania/dizionario.txt --rules /home/stefano/Scrivania/passw.lst
obiettivo: scoprire l'hash di una stringa MD5
come deve essere il file contenente la stringa md5 da scoprire??
Non capivo se andava inserito solo l'hash o anche altri caratteri prima o dopo.
In teoria john dovrebbe riconoscere il contenuto e agire di conseguenza. In realtà ho scoperto che è meglio specificare quello che vogliamo cercare.
Infatti nel precedente output abbiamo visto che ha riconosciuto un tipo di hash “LM” ma avvertiva che potrebbe anche essere riconosciuto con altri tipi.
Quindi specificare subito dopo il comando ./john il formato –format=raw-md5
Non ho ancora sperimentato ma dovrebbe essere la stessa cosa anche con gli altri formati.
Pertanto alla fine ho costruito un file contenente la password (password.txt) in due modi:
utente:9f1cb52df1029b12a08ed61d988b8fb1
e solo con la stringa md5
9f1cb52df1029b12a08ed61d988b8fb1
Ho visto che funziona in entrambi i modi specificando –format=raw-md5
Poi ho specificato il file contenente un elenco di parole da testare per vedere se corrispondono alla password –wordlist=/percorso-file/nomefile.txt
Tale file deve essere in chiaro e non deve avere formattazioni particolari, solo un semplice elenco di parole come di seguito:
parola1 parola2 parola3 passwordprova1 passwordprova2 password admin ecc...
il –single come opzione non l'ho capita
ho provato anche senza questa opzione e ho visto che ha funzionato
Invece l'ultima parte relativa il file contenente l'hash da scoprire è il semplice percorso del file /percorso-file/nomefile.txt
Ho capito un'altra cosa interessante.
Se nell'elenco di parole ho ad esempio un nome proprio come: “Sassari”
ma la password è “irassaS”
Essa può essere scoperta con l'opzione –rules che praticamente va a combinare con non so quale criterio le lettere della parola in elenco “Sassari”
Se invece eseguo il comando senza l'opzione –rules questa cosa non viene fatta.
Quindi:
./john --format=raw-md5 --wordlist=/percorso-file/elenco-parole.txt --rules /percorso-file/password-da-cercare.lst
Al prossimo giro bisogna trovare il modo di far provare in automatico le sostituzioni di caratteri speciali come “s” con “$” oppure “1” con “i” oppure “a” con “@” ecc..
Ok figata. ci siamo
Quindi con l'opzione –rules vengono applicate le regole indicate nel file john.conf nella sezione che si sceglie come modo
come modo in questo caso era stato scelto il –wordlist
Quindi nel file john.conf ci sarà una sezione “”[List.Rules:Wordlist]“”
e all'interno di questa andremo ad aggiungere in fondo le seguenti regole:
si1 sa@
oppure la combinazione di queste per effettuare la regola contemporaneamente sulla parola:
si1 sa@
o ancora
si1 sa@ so0 si1 so0 sa@ so0 ss$
ecc..
In questo modo verranno provate le sostituzioni.