nmap.sh - Saving Precious Seconds

In the course of my work I end up issuing the same simple commands again and again, and while they are pretty easy to remember, they still take more time than they really need to.

With that in mind, here's a little bash script I threw together today to reduce the time it takes to kick off a standard (in my day to day usage) nmap scan. Hopefully you can get some use out of it.

#!/bin/bash
echo "-----------------------------------------------"
echo "A very simple script to make nmap scanning a little quicker to kick off"
echo "By Glenn '/dev/alias' Grant (devalias.net)"
echo "v0.3"
echo "-----------------------------------------------"
iphost=$1
_now=$(date +"%Y%m%d-%H%M")
_nmapopts="-A -vvv ${@:2}"
_nmapoptshidden="--webxml"
_nmapoptsfilename=$(echo $nmapopts | tr -d ' ') 
file="nmap-$now-$iphost$nmapoptsfilename"

if [ -z "$1" ]; then echo "Usage: nmap.sh ipOrHostnameToScan [any other arguments here]" echo "Default Options: $nmapoptshidden $nmapopts" exit fi

nmap -oA $file $nmapoptshidden $nmapopts $iphost