Nmap Development mailing list archives

Re: [NSE] vim syntax file


From: Ron <ron () skullsecurity net>
Date: Sat, 16 Oct 2010 17:42:04 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 16 Oct 2010 15:36:51 -0700 Fyodor <fyodor () insecure org> wrote:
On Sat, Oct 16, 2010 at 11:01:00AM -0500, Ron wrote:

I used some scripts to put together a vim syntax file that knows
about every public function in nselib. I included the (ugly++)
shellscripts I used to generate the file within the file itself.
It's attached.

Thanks Ron!  The shell scripts didn't get through (perhaps the list
blocked them based on content-type, or maybe you forgot to attach
them), but thanks for creating and sending the syntax file!

If people find this nse.vim useful, perhaps Ron can check it in to
/nmap/docs, particularly if he'll keep it up to date with the latest
library functions from time to time.

Cheers,
-F
Hey,

The shellscripts are actually just little one-liners that are comments in the syntax file:

Functions in the form, 'function aaa(...)':
export TAB=`echo -ne '\t'`; for i in *.lua; do i=`echo "$i" | sed s/\.lua//`; cat $i.lua | grep function | grep -v 
local | grep -v -- '--' | egrep -v '^ ' | egrep -v "^$TAB" | grep '^function' | sed -r "s/function 
([a-zA-Z0-9_-:]+).*/$i\\.\1/" | egrep '^[a-zA-Z0-9._-:]+$' | sed -r 's/\./\\./g' | sed -r 's/(.*)/syn match   nseFunc 
\/\1\//'; done

Functions in the form, "aaa = function(...)":
export TAB=`echo -ne '\t'`; for i in *.lua; do i=`echo "$i" | sed
s/\.lua//`; cat $i.lua | grep function | grep -v local | grep -v --
'--' | egrep -v '^ ' | egrep -v "^$TAB" | grep -v '^function' | sed -r
"s/^([a-zA-Z0-9_-:]+).*function.*/$i\\.\1/" | egrep
'^[a-zA-Z0-9._-]+$'  | sed -r 's/\./\\./g' | sed -r 's/(.*)/syn match
nseFunc \/\1\//'; done

I don't claim that's the best solution - they're just a quick hackjob - but they do the trick. :)

Ron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAky6KkAACgkQ2t2zxlt4g/SEZwCdGTUz3Sfm5xCkyuvQxtQsuNs0
BOAAn2sCwH+mqUdRI/T+Uyaql6WVqv0J
=Ai9O
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: