Nmap Development mailing list archives
Re: [NSE] [patch] Big changes to http-enum.nse
From: Patrick Donnelly <batrick () batbytes com>
Date: Wed, 20 Oct 2010 02:12:39 -0400
On Wed, Oct 20, 2010 at 1:30 AM, David Fifield <david () bamsoftware com> wrote:
On Tue, Oct 19, 2010 at 04:32:15PM -0700, David Fifield wrote:On Tue, Oct 19, 2010 at 03:15:16PM -0500, Ron wrote:On Mon, 18 Oct 2010 14:50:26 -0500 Ron <ron () skullsecurity net> wrote:Sure, that's a do-able change. I like the idea of expanding a 'probes' table like that, it means we can add extra stuff to probes fairly easily, if it becomes necessary (maybe a HTTP header or something). I also want to move 'severity' into the match table, so each match can have a different severity rating. Right now, the severities are ignored, and maybe we'll never use them, but it's there if we want it. I'll work on this tonight and post an updated patch, if I finish it.Attaching current version of http-fingerprints.lua. The current revision in my nmap-http branch reads this and makes the checks properly.I'll give it a try tonight but I suspect this will be ready to commit.[...] In response_contains, I think I see what you're doing: + result, _, m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9] = string.find(case(response['status-line']), pattern) You can do it more robustly with this: (maybe someone else knows an even better way) local function matches(...) return table.remove(arg, 1), table.remove(arg, 1), arg end result, _, m = matches(string.find(case(response['status-line']), pattern))
The use of 'arg' is deprecated. I assume you read about vararg handling from the online version Programming in Lua [1]. That is the first edition and covers Lua 5.0. In Lua 5.1 the 'arg' table is deprecated. The new vararg handling is covered in the manual [2] (and in second edition PiL, print only). Anyway, you can use this instead: local m = {string.match(...)}; Note that string.match behaves exactly like string.find except it doesn't return the two integers where the match occurs. It only returns captured values (or the entire match if the pattern has no captures). If you really want to use string.find, you can also do this: local m = {select(3, string.find(...))}; The select function discards the first two return values of string.find. [1] http://www.lua.org/pil/ [2] http://www.lua.org/manual/5.1/ -- - 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:
- Re: [NSE] [patch] Big changes to http-enum.nse, (continued)
- Re: [NSE] [patch] Big changes to http-enum.nse Patrik Karlsson (Oct 17)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 17)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 17)
- Re: [NSE] [patch] Big changes to http-enum.nse Patrik Karlsson (Oct 17)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 18)
- Re: [NSE] [patch] Big changes to http-enum.nse David Fifield (Oct 18)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 18)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 19)
- Re: [NSE] [patch] Big changes to http-enum.nse David Fifield (Oct 19)
- Re: [NSE] [patch] Big changes to http-enum.nse David Fifield (Oct 19)
- Re: [NSE] [patch] Big changes to http-enum.nse Patrick Donnelly (Oct 19)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 21)
- Re: [NSE] [patch] Big changes to http-enum.nse David Fifield (Oct 21)
- Re: [NSE] [patch] Big changes to http-enum.nse Jacky Jack (Oct 23)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 26)
- Re: [NSE] [patch] Big changes to http-enum.nse David Fifield (Oct 27)
- Re: [NSE] [patch] Big changes to http-enum.nse Martin Holst Swende (Oct 18)
- Re: [NSE] [patch] Big changes to http-enum.nse Ron (Oct 19)
- Re: [NSE] [patch] Big changes to http-enum.nse Patrik Karlsson (Oct 18)
- Re: [NSE] [patch] Big changes to http-enum.nse Martin Holst Swende (Oct 18)
- Re: [NSE] [patch] Big changes to http-enum.nse Martin Holst Swende (Oct 18)