I have a binary named ./testpassword with syntax as below
./testpassword pass PASSWORD_GOES_HERE
if password is correct output will be
pass=correct
if incorrect output will be as below
pass=incorrect
I am brand new to linux and scripting, but with the help of a member on here, made a sample shell script as below
cat passwords.txt | while read x ; do echo -n "$x: " && ./testpassword pass $x ;
done
where passwords is a wordlist in txt format.
This works nicely,and If i keep an eye on terminal I can see output as below (continuing for every line in the word list)
jordyt: pass=incorrect
dawder: pass=incorrect
LOL12345: pass=incorrect
warcraft: pass=incorrect
solidussnake: pass=incorrect
0005: pass=correct
So in this case, I know 0005 is my password, my question is, Is it possible to stop the program when password is found, or to automatically show the password somewhere?. If I am to walk away from the screen I lose track of what the password was as the screen will continue attempting passwords and scrolling down
the previous way I was doing was like this Shell script password bruteforcing . It worked as I could walk away and come back later and see that the password had been cracked and then ctrl+c the program, except it was a bit of a long winded way of doing things. after I had to manually search for the line number in the wordlist corresponding to the cracked password
You can save the execution of
./testpassword pass $xin a variable doing:Then, you can compare $result to the string “pass=correct” and break the loop if it finds the string this way:
Put all together: