# Encrypt $ openssl enc -aes-256-cbc –k PASS -in plain.txt -out encrypted.enc # Decrypt $ openssl enc -d -aes-256-cbc –k PASS -in encrypted.enc -out plain.txt |
# Encrypt $ gpg --symmetric --passphrase PASS --cipher-algo AES256 --output encrypted.enc plain.txt # Decrypt $ gpg --decrypt --passphrase PASS --output plain.txt encrypted.enc |
# $ openssl list-cipher-commands # $ gpg --version |
Rank |
Password |
1 |
123456 |
2 |
password |
3 |
12345 |
4 |
12345678 |
5 |
qwerty |
6 |
123456789 |
7 |
1234 |
8 |
baseball |
9 |
dragon |
10 |
football |
11 |
1234567 |
12 |
monkey |
13 |
letmein |
14 |
abc123 |
15 |
111111 |
16 |
mustang |
17 |
access |
18 |
shadow |
19 |
master |
20 |
michael |
21 |
superman |
22 |
696969 |
23 |
123123 |
24 |
batman |
25 |
trustno1 |
for char1 in "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~@#%^&*()-_!" for char2 in "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~@#%^&*()-_!" ... for charN in "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~@#%^&*()-_!" print (passwords_file, char1, char2, ..., charN) endfor ... endfor endfor |
found=0 for method_details in “methods_file” method = method_details[1]; ciphers_list = method_details[2]; decipher_command = method_details[3]; for cipher in ciphers_list for pass in “passwords_file” result = decipher_command (cipher, pass, result_file, encrypted_file) if result = 0 then found=1 if method = "openssl" then print method, cipher, pass else print cipher, pass endif print result_file exit endif endfor endfor endfor if found = 0 then print “The file was not decrypted. Try again.” endif |
TMP=/tmp/exec.now TMP2=/tmp/exec2.now ### provide the path and the name for the encrypted file #encfile="/home/ftp/incoming/enc_file.enc" encfile=encrypted_file.enc ### if the file is accessed from a remotely machine, a sudoer user's credentials are required, plus the IP of the remote machine #remote_user="" #remote_user_pass="" #remote_IP="" ### provide the path and the name for the decrypted file resultfile=decrypted_file.txt ### provide the name of the file containing samples of passwords pass_file=pass.txt passwords=`cat $pass_file` ### provide the name of the file containing information on the encrypting methods that are checked methods_file=enc_methods_info.txt ### temporarily modify the delimiter used by "cut" method old_IFS=$IFS IFS=$'\n' found="0" for method_details in `cat $methods_file` do method=$(echo $method_details | cut -f 1 -d "@") ciphers_command=$(echo $method_details | cut -f 2 -d "@") decipher_command=$(echo $method_details | cut -f 3 -d "@") rm $TMP echo "$ciphers_command" > $TMP chmod 755 $TMP ciphers=`$TMP` for cipher in $ciphers do if [ $cipher != 'base64' ]; then for pass in $passwords do rm $resultfile > /dev/null 2>&1 rm $TMP2 > /dev/null 2>&1 #echo " --> trying: Method = $method; Cipher = $cipher; Password = $pass" #To decrypt a file accessed remotely # echo "cipher='$cipher'; pass='$pass'; resultfile=$resultfile; encfile=$encfile; sshpass -p $remote_user_pass ssh $remote_user@$remote_IP echo $remote_user_pass | $decipher_command " > $TMP2 #To decrypt a file accessed on the local machine if [[ $method = "openssl" ]]; then echo "cipher='$cipher'; pass='$pass'; resultfile=$resultfile; encfile=$encfile; $decipher_command " > $TMP2 else echo "pass='$pass'; resultfile=$resultfile; encfile=$encfile; $decipher_command " > $TMP2 fi chmod 755 $TMP2 `$TMP2` result=$? #echo "result=$result" if [[ $result -eq 0 ]]; then found="1" if [[ $method = "openssl" ]]; then echo "FOUND: Method = $method; Cipher = $cipher; Password = $pass" else echo "FOUND: Method = $method; Password = $pass" fi echo "File Content:" echo "=============" cat $resultfile echo "" exit fi done fi if [[ $found -eq "1" ]]; then exit fi done if [[ $found -eq "1" ]]; then exit fi done echo "SORRY! No good password was found." IFS=old_IFS |
openssl@openssl list-cipher-commands@sudo openssl enc -d -$cipher -k
$pass -out $resultfile -in $encfile > /dev/null 2>&1 gpg@gpg --version | grep "Cipher" -A 1 | cut -f 2 -d ":" | sed s/","/"\n"/g | sed s/" "/""/g | grep -E "[A-Z]"@sudo gpg --decrypt --passphrase $pass --output $resultfile $encfile > /dev/null 2>&1 |
length=$1 echo "" > temp_command_file echo "pass_file='pass_file.txt';" >> temp_command_file echo "echo \"\" > $""pass_file" >> temp_command_file for ((i=1;i<=length;i++)) do echo "grep -o . <<< \"qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~@#%^&*()-_\!\" | while read v$i" >> temp_command_file echo "do " >> temp_command_file if [ $i = $length ]; then my_command="echo " for ((j=1;j<=length;j++)) do my_command=$my_command"$""v$j" done echo " $my_command >> $""pass_file " >> temp_command_file fi done for ((i=1;i<=length;i++)) do echo "done " >> temp_command_file done echo "exit" >> temp_command_file chmod 755 temp_command_file ./temp_command_file cat $pass_file |