leebaird / discover

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.
MIT License
3.39k stars 820 forks source link

Random cookie generator never ends #161

Closed absane closed 4 years ago

absane commented 4 years ago

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 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)

L1ghtn1ng commented 4 years ago

Can you please try current git master as that should of fixed this issue?

absane commented 4 years ago

It does! Thank you very much.