Nmap Development mailing list archives

Re: Bash-completion script for Nmap


From: Daniel Miller <bonsaiviking () gmail com>
Date: Wed, 4 May 2011 22:05:26 -0500

Thanks for the feedback and suggestions! I've implemented Patrick and
Vasiliy's suggestions in the latest revision, as well as fixing a couple
things related to --spoof-mac and script categories.

One thing I found was that the Nmap man page is missing the "broadcast"
category in its list of defined categories.

I appreciate any feedback anyone has on this script!

Dan

On Wed, May 4, 2011 at 2:36 PM, Patrick Donnelly <batrick () batbytes com>wrote:

On Wed, May 4, 2011 at 1:23 PM, Daniel Miller <bonsaiviking () gmail com>
wrote:
Hey list,

I posted this a long time ago, but just recently put it out on github.
Bash-completion is programmable tab-completion for Bash 3.0 and newer.
This
is my implementation of a completion script for Nmap. Some highlights:

  - tab-complete options with both short and long versions
  - tab-complete time options with h, m, s, ms
  - tab-complete script names and categories (requires perl)
  - tab-complete interface names for -e
  - tab-complete timing options with names: "paranoid," "insane," etc.

https://github.com/bonsaiviking/nmap-completion

Cool! I think by default the script should accept a pre-defined
NMAPDIR. I decided to install this completion script locally by
patching it to use NMAPDIR if already set and adding to my .bashrc
file:

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
   . /etc/bash_completion
fi

. "$HOME/.bash_completion.nmap"

^ The last line is the addition. I also pasted the Ubuntu bash
completion stuff to point out you have to load the custom nmap
completion script last (so it replaces any default nmap completion
script that comes with the system).

I think there is a syntax bug:

batrick@neverwinter:~/bonsaiviking-nmap-completion-6d487b5$ bash ./nmap
./nmap: line 30: syntax error near unexpected token `('
./nmap: line 30: `            +($any_file_opts))'

I fixed it by surrounding +($any_file_opts) in quotes.

Patch attached.

--
- Patrick Donnelly

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: