Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #=================================================================
- # Speedy Nmap
- #=================================================================
- # Performs nmap scan in hyper speed.
- # Usage: ./speedy_nmap.sh <IP> <output file>
- #
- # Author: PotatoMaster101
- # Date: 22/10/2018
- # File: speedy_nmap.sh
- #=================================================================
- #-----------------------------------------------------------------
- # main
- #-----------------------------------------------------------------
- # Starts the scanning process.
- #
- # PARAMS:
- # $1 - the IP to scan
- # $2 - the output file name
- #-----------------------------------------------------------------
- function main {
- if [[ $# -ne 2 ]]; then
- echo "usage ./speedy_nmap.sh <IP> <output file>"
- return 1
- fi
- rm -f $2
- # start scanning
- limit=4369
- for i in {1..15}; do
- lower=$((limit - 4368))
- echo "scanning $lower to $limit..."
- nmap_range $lower $limit $1 $2 &
- limit=$((limit + 4369))
- done
- wait
- echo "scan done"
- }
- #-----------------------------------------------------------------
- # nmap_range
- #-----------------------------------------------------------------
- # Scans the specified port range using nmap.
- #
- # PARAMS:
- # $1 - the lower bound
- # $2 - the upper bound
- # $3 - the IP to scan
- # $4 - the output file name
- #-----------------------------------------------------------------
- function nmap_range {
- nmap "-p$1-$2" -T5 -Pn -n -sS -sV $3 > $1
- # write to file if output contains any open port
- grep -q All $1
- if [[ $? -ne 0 ]]; then
- cat $1 >> $4
- fi
- rm -f $1
- }
- main $@
- exit $?
Add Comment
Please, Sign In to add comment