Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: Bash-completion script for Nmap
From: Vasiliy Kulikov <segooon () gmail com>
Date: Wed, 4 May 2011 21:45:38 +0400

On Wed, May 04, 2011 at 12:23 -0500, Daniel Miller wrote:
https://github.com/bonsaiviking/nmap-completion

Cool!  To be able to complete local scripts in ~/.nmap/scripts/:

@@ -41,14 +41,15 @@
                 ;;
             --script)
                 categories=$(perl -ne '$s{$1}=undef if/categories = {
"([^"]+)", /gc;$s{$1}=undef while(/\G"([^"]+)", /gc);END{$,=" ";print
keys %s}' $NMAPDIR/scripts/script.db)
+                lscripts=$(cd ~/.nmap/scripts/ 2>/dev/null && ls *.nse)
                 if [[ "$cur" == *,* ]]; then
                 realcur=${cur##*,}
                 prefix=${cur%,*}
                 COMPREPLY=( $( cd $NMAPDIR/scripts/ >/dev/null && 
-                    compgen -W "$categories all" -G "*.nse" -X
                     "!$realcur*" -P "$prefix," -- $realcur ) )
+                    compgen -W "$lscripts $categories all" -G "*.nse"
-X "!$realcur*" -P "$prefix," -- $realcur ) )
                 else
                 COMPREPLY=( $( cd $NMAPDIR/scripts/ >/dev/null && 
-                    compgen -W "$categories all" -G "*.nse" -X "!$cur*"
                     -- $cur ) )
+                    compgen -W "$lscripts $categories all" -G "*.nse"
-X "!$cur*" -- $cur ) )
                 fi
                 ;;
             -e)
--

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


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault