Want to take a list of open ports from a prior nmap scan, for use in future ones?
egrep -o '[0-9]*/open/tcp/' your-prior-gnmap-output.gnmap | cut -d/ -f1 | sort -un | tr '\n' ','
Output will look something like this:
22,80,631,902,2200,2222,3389,5432,60443,
[1/2]
2
24
1
89
Add ... | sed ‘s/,$//‘ to your pipeline to remove the final comma, then you can use $(...) to substitute directly into your second command line. Also consider awk to replace egrep ... | cut
Feb 12, 2019 · 5:35 PM UTC
1
3

