Created
May 16, 2022 20:01
-
-
Save marcinantkiewicz/434f3f3518b4090c1ef5c7fc9f87927d to your computer and use it in GitHub Desktop.
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
# scan network for open ports, list IPs that have something listening on those ports | |
# You can list multiple ports, separate them by commas (22,80,443). | |
function check_port() { NETWORK="$1"; shift; PORTS="$1"; shift; [ -z "$PORTS" ] && echo "Use: check_port CIDR PORTS - scans CIDR, prints ip if it listens on comma separated PORTS." && return 1; nmap --open -p "${PORTS}" "${NETWORK}" -oG - | awk '/\/open/ {print $2 }'; } | |
function check_port() { | |
NETWORK="$1"; shift; | |
PORTS="$1"; shift; | |
[ -z "$PORTS" ] && \ | |
echo "Use: check_port CIDR PORTS - scans CIDR, prints ip if it listens on comma separated PORTS." && \ | |
return 1; | |
nmap --open -p "${PORTS}" "${NETWORK}" -oG - | awk '/\/open/ {print $2 }'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment