Sample Header Ad - 728x90

Brute-force 4 digit pin with pass using shell script

-1 votes
7 answers
43803 views
I am doing some challenges. This is one them. I am trying to brute-force 4 digit pin with the password to get my desired answer. After connecting to the port It prompts me to enter the password then space then 4 digit pin. I tried to brute-force the pin using the script: #!/bin/bash nc localhost 30002 sleep 2 for i in {0000..9999}; if [[ $(echo 'UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ $i' if [[ $(echo 'UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ $i') = ^Wrong* ]]; What am I doing wrong here? UPDATE: ---------------------------------------------------- Okay, so after researching around. I wrote this: for i in {0000..9999} do if [ (echo "UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ $i" | nc localhost 30002 | grep -o Wrong) == "Wrong" ] then sleep 0.1 continue fi echo "- - - - - - - - - - - - - - - - - - - - - - - - [$i]" done This might even work but as you can see it opens new connections in the loop which makes it really slow and exhaust the system.
Asked by Srijan Singh (29 rep)
Mar 22, 2018, 07:13 PM
Last activity: Apr 25, 2024, 01:52 PM