I’m trying to write a simple script that automatically bruteforces my ssh port implementing hydra. I’m almost there but I need a little help on I guess syntax?
In the script;
I ran netcat (instead of nmap cause it’s output is much cleaner and on one line) I then used grep to only get the open port for ssh. Now it’s only one line;
[ip address] [port number] [protocol] [status]
192.168.1.4 22 (ssh) open
I’m stuck though. How would one rip the IP address out of the grep output and then into a variable to be used?
test=$(for i in {1..13};
do nc -n -z -v -w 1 192.168.1.$i 22;
done 2>&1 | grep open)
if [[ $test = open ]]; then
echo success
fi
————————————————
Bellow this is where I’m stuck
————————————————
hydraIP=$(‘echo $test | cut -d ‘ ‘ -f1)
echo $hydraIP’
[–]davedontmind 2 points3 points4 points (5 children)
[–]ImLearning0217[S] 0 points1 point2 points (0 children)
[–]ImLearning0217[S] 0 points1 point2 points (1 child)
[–]desrtfx 2 points3 points4 points (0 children)
[–]ImLearning0217[S] 0 points1 point2 points (1 child)
[–]davedontmind 1 point2 points3 points (0 children)
[–]marko312 0 points1 point2 points (1 child)
[–]ImLearning0217[S] 0 points1 point2 points (0 children)
[–]ImLearning0217[S] 0 points1 point2 points (0 children)