Nmap Development mailing list archives

Re: parsing of script-args is broken


From: Patrick Donnelly <batrick () batbytes com>
Date: Fri, 15 May 2009 18:30:11 -0600

On Sun, May 10, 2009 at 7:23 AM, Patrick Donnelly <batrick () batbytes com> wrote:
Ok I've taken another attempt at getting this correct. This patch is
unfortunately much larger than previously. Alas, Lua's pattern
matching facilities are far too weak to come up with an appropriate
grammar. I have created a semi-complex state machine to work instead.

Here are the rules for --script-args definitively:

--script-args <string>

<string> may contain a sequence of key=value pairs and array entries
separated by commas. All whitespace except where noted below is
ignored.

A key, value, or array value may be a sequence of characters except
'{', '}', ',', '=', and all space characters. You may overcome this
restriction by using quotes (single or double) to allow all characters
within the quotation marks. You may also use the quote delimiter
inside the sequence so long as it is escaped by a backslash.

A value is allowed to be a nested table delimited by '{' and '}'.

A string (for a key, value, or array value) may have arbitrary byte
sequences using "\ddd" where ddd is a decimal number up to 255
signifying its corresponding byte. You may avoid this translation by
escaping the backslash with another (e.g. \\123).

Jah found a problem with empty tables being parsed (the lack of script
arguments causes this). This patch corrects that.

-- 
-Patrick Donnelly

"Let all men know thee, but no man know thee thoroughly: Men freely
ford that see the shallows."

- Benjamin Franklin

Attachment: sargs5.patch
Description:


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

Current thread: