Last active
April 28, 2021 23:04
-
-
Save cxzero/e98a7f4951f57b2907ad90722fbb97ae to your computer and use it in GitHub Desktop.
Simple script to help in running masscan againsts all TCP and UDP ports of a given IP, grep results and display them in a format which can then be used by other tools, example nmap. tun0 interface is used, adjust as necessary
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 | |
# Simple script to help in running masscan againsts all TCP and UDP ports, | |
# grep results and display them in a format which can then be used by other tools, example nmap | |
# massports.sh by cxzero | |
if [ $# -eq 0 ]; then | |
echo "usage: massports.sh <IP>" | |
exit 1 | |
fi | |
echo "[+] Target: {$1}" | |
echo "[+] Executing masscan on {$1}, all ports TCP:1-65535, UDP:1-65535, tun0" | |
sudo masscan -p1-65535,U:1-65535 --rate=1000 -e tun0 "$1" -oG masscan.txt | |
echo "[+] Parsing ports from output masscan.txt file" | |
cat masscan.txt | awk -F" " '{ print $7 }' | grep -E [0-9]+/ | cut -d/ -f1 | sort -u > ports.txt | |
echo "[+] Ports ready for nmap" | |
cat ports.txt | xargs | sed 's/ /,/g' | |
echo "[+] Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment