Last active
April 1, 2025 22:01
-
-
Save Aptimex/499d1fd76c78e26eb49bc43a78fddd37 to your computer and use it in GitHub Desktop.
Masscan ports to NMAP
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
| # This goes in ~/.bashrc or similar | |
| function ms2nmap() { | |
| cat $1 | grep open | cut -d " " -f 4 | cut -d "/" -f 1 | tr "\n" "," | head -c -1 | |
| } | |
| # Redirect or tee masscan output to a file. Then use 'ms2nmap ./filename' to convert it into a port list that nmap will take with -p | |
| # You can directly pass it to nmap like this: nmap 1.2.3.4 -p$(ms2nmap file.txt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment