Last active
June 13, 2022 16:00
-
-
Save cxzero/492ff5afd9da485a77a45e7bd1c7b8ce to your computer and use it in GitHub Desktop.
Utility to extract ports from nmap grepable output
This file contains 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
#!/bin/bash | |
# To be used with nmap grepable output (-oG option) | |
if [ -z $1 ]; then | |
echo "Usage: $(basename $0) <grepable-nmap-input-file>" | |
exit -1 | |
fi | |
ports="`cat $1 | grep -oP '\s\K[0-9]+(?=/)'`" | |
echo $ports | xargs | sed 's/ /,/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment