dimanche 22 mars 2015

Using bash's `/dev/udp`, how would I know if the port was open?


I do not have access to netcat or nmap so I'm trying to use bash and the /dev/udp/ special files to test ports.


I could do something like:



echo "" > /dev/udp/example.com/8000


But $? is always 0 when using UDP. I'm assuming that's because that is the return value of the echo "" command correct?


I am basically trying to replicate with what I am able to do with nmap and netcat:



nmap -sU -p 8000 example.com | grep open >/dev/null && echo 'open'
nc -z -u example.com 8000 && echo 'open'


How would I do this with /dev/udp?



Aucun commentaire:

Enregistrer un commentaire