Added help message
This commit is contained in:
parent
33d1493661
commit
ad73161463
@ -1,13 +1,39 @@
|
|||||||
# $1 - input filename
|
Help()
|
||||||
# $2 - output filename
|
{
|
||||||
# $3 - Randomize output number
|
echo ""
|
||||||
|
echo "No arguments supplied - take this:"
|
||||||
# Help
|
echo ""
|
||||||
|
echo "expandcidr - A file with a scope list in CIDR notation is expanded "
|
||||||
|
echo " to all possible IPs. It can also output instead a"
|
||||||
if [ -z "$3"]
|
echo "▅▅▅▅▅▅▅▅▅ a specified number of unique random IPs from the output"
|
||||||
then
|
echo "▅▅▅▅▅▅▅▅▅ file (useful for sample testing, for ex.)."
|
||||||
nmap -sL -n -iL $1 | grep 'Nmap scan report for' | cut -f 5 -d ' ' > $2
|
echo "▅▅▅▅▅▅▅▅▅ Script leverages on nmap - same scope list format"
|
||||||
else
|
echo "▅▅▅▅ ▅▅▅▅ "
|
||||||
nmap -sL -n -iL $1 | grep 'Nmap scan report for' | cut -f 5 -d ' ' | shuf -n $3 > $2
|
echo "▅▅▅▅▅▅▅▅▅ Example: expandcidr scope.txt output.txt 4000"
|
||||||
fi
|
echo ""
|
||||||
|
echo "Usage: expandcidr [input file] [output file] [optional-rnd-#-ips]"
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":h" option; do
|
||||||
|
case $option in
|
||||||
|
h) # display Help
|
||||||
|
Help
|
||||||
|
exit;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then Help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# command chain
|
||||||
|
|
||||||
|
if [ -z $3 ]
|
||||||
|
then
|
||||||
|
nmap -sL -n -iL $1 | grep 'Nmap scan report for' | cut -f 5 -d ' ' > $2
|
||||||
|
else
|
||||||
|
nmap -sL -n -iL $1 | grep 'Nmap scan report for' | cut -f 5 -d ' ' | shuf -n $3 > $2
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user