Skip to content

Instantly share code, notes, and snippets.

@abenson
Created March 15, 2019 01:13
Show Gist options
  • Save abenson/7c33d211752cc9e241b00c9d38bd3a42 to your computer and use it in GitHub Desktop.
Save abenson/7c33d211752cc9e241b00c9d38bd3a42 to your computer and use it in GitHub Desktop.
"expand_net" wrapper for nmap
#!/bin/sh
SORT="cat"
if [ "$1" = "-r" ]; then
shift
SORT="sort -R"
fi
if [ -z "$1" ] || [ "$1" = "-h" ]; then
echo "usage: $0 <CIDR> [...]"
exit
fi
nmap -sL -oG - -n "$*" | grep Host: | cut -d\ -f2 | $SORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment