Custom bash scripts used to automate various penetration testing tasks including recon, scanning, enumeration, and malicious payload creation using Metasploit. For use with Kali Linux.
I have to kill the fold process to get the rest of discover to complete. Since the cookie doesn't matter, I suggest the following method that does complete (2):
It would work on all installations. I believe the problem, which I can only reproduce on my Kali VM, is that cat /dev/urandom never ends. Within the terminal, I can run command 1 with no issues. But within any bash script, it never ends. The command I propose, (2) does end since the date command is finite. granted, it's predictable (if that is a concern). If so, perhaps pad with $RANDOM like:
rando=$((echo -n $RANDOM; date +"%T. %N") | sha256sum | base64 | head -c 32 ; echo)
For some reason, the following line in passive.sh won't ever end on my install of Kali (1):
rando=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
I have to kill the
fold
process to get the rest of discover to complete. Since the cookie doesn't matter, I suggest the following method that does complete (2):rando=$(date +"%T. %N" | sha256sum | base64 | head -c 32 ; echo)
It would work on all installations. I believe the problem, which I can only reproduce on my Kali VM, is that
cat /dev/urandom
never ends. Within the terminal, I can run command 1 with no issues. But within any bash script, it never ends. The command I propose, (2) does end since thedate
command is finite. granted, it's predictable (if that is a concern). If so, perhaps pad with$RANDOM
like:rando=$((echo -n $RANDOM; date +"%T. %N") | sha256sum | base64 | head -c 32 ; echo)