Created
August 12, 2015 08:40
-
-
Save gedsic/5e92702ace5fd26f9d88 to your computer and use it in GitHub Desktop.
Get top 1000 UDP ports from nmap records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cat /usr/share/nmap/nmap-services | grep "/udp" | sort -k3 -n -r | head -n 1000 | grep -o "[0-9]*/udp" | sed 's/\/udp//g' |
Author
Author
Originally, I wanted to import this list of UDP ports into OpenVAS. That, however, is no fun with the GSA gui. So I did it with omp:
$ UDPPORTS=$(cat /usr/share/nmap/nmap-services | grep "/udp" | sort -k3 -n -r | head -n 1000 | grep -o "[0-9]*/udp" | sed 's/\/udp//g' | paste -d, -s)
$ omp -u username -w password --xml="<create_port_list><name>All TCP and Nmap 6.47 top 1000 UDP</name><comment></comment><port_range>T:1-65535,U:${UDPPORTS}</port_range></create_port_list>"
If you get status_text="OK, resource created" status="201" in the result, it worked!
YOU ARE A HERO!!!
Author
YOU ARE A HERO!!!
Thanks, I'm glad this helped :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To have that as a comma-separated list, just add another paste pipe:
| paste -d, -sSo we have
cat /usr/share/nmap/nmap-services | grep "/udp" | sort -k3 -n -r | head -n 1000 | grep -o "[0-9]*/udp" | sed 's/\/udp//g' | paste -d, -sExample output:
631,161,137,123,138,1434,445,135,67,53,139,500[...]