Demo

Diferențele dintre encodare, criptare si hashing

Encodare

Folosind comanda base64 fără niciun parametru putem să encodăm un text.

student@uso:~$ echo -n "Base64 is not encryption!" | base64
QmFzZTY0IGlzIG5vdCBlbmNyeXB0aW9uIQ==

Utilizând parametrul -d putem decoda un text encodat.

student@uso:~$ echo -n "QmFzZTY0IGlzIG5vdCBlbmNyeXB0aW9uIQ==" | base64 -d
Base64 is not encryption!

Criptare

Folosind utilitarul openssl putem să criptăm conținutul unui fișier.

student@uso:~$ echo -n "plaintext content" > plaintext_file.txt
student@uso:~$ openssl aes-256-cbc -in plaintext_file.txt -out encrypted_file.enc -pass pass:"uso rules"
student@uso:~$ ls
encrypted_file.enc  plaintext_file.txt

Utilizând parametrul -d putem decripta fișierul encrypted_file.enc.

student@uso:~$ openssl aes-256-cbc -d -in encrypted_file.enc -out decrypted_file.txt -pass pass:"uso rules"
student@uso:~$ cat decrypted_file.txt 
plaintext content

Hashing

Folosind comanda md5sum fără niciun parametru putem să generăm hash-ul unui text.

student@uso:~$ echo -n "plaintext content" | md5sum
f88d6c9eab9c6a2ef3cfd3c59832b4d6  -

Liste de cuvinte

John the Ripper este un utilitar de spargere al parolelor. În cadrul acestui demo dorim sa aflăm parolele utilizatorilor din sistem. Pentru a reduce timpul de brute-force al utilitarului John vom crea o listă de cuvinte.

Instalare John The Ripper

student@uso:~$ sudo apt-get update
student@uso:~$ sudo apt-get install john

Copiem hash-urile parolelor în fișierul mypasswd.txt.

student@uso:~$ sudo unshadow /etc/passwd /etc/shadow > mypasswd.txt

Creăm o listă de cuvinte care ne-ar putea ajuta sa ghicim parola unui calculator dintr-o universitate.

student@uso:~$ echo -ne "school\nuniversity\nstudent" > wordlist.txt

Rulăm utilitarul John the Ripper.

student@uso:~$ john --wordlist=wordlist.txt mypasswd.txt 
Loaded 3 password hashes with 3 different salts (crypt, generic crypt(3) [?/64])
Remaining 2 password hashes with 2 different salts
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:00 100% 0g/s 50.00p/s 100.0c/s 100.0C/s school..student
Session completed

Pentru a vizualiza rezultatele rulăm următoarea comandă

student@uso:~$ john --show mypasswd.txt 
student:student:1000:1000:Student User,,,:/home/student:/bin/bash
 
1 password hash cracked, 1 left

Utilitarul ne indică faptul că parola student este parola utilizatorului student.

uso/laboratoare/new/10-sec/demo.txt · Last modified: 2019/12/04 09:44 by giorgiana.vlasceanu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0