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.

https://gist.github.com/0xdevalias/5963377

#!/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