Nmap Development mailing list archives

Re: [NSELIB/NSE] Updates SMB/MSRPC scripts


From: David Fifield <david () bamsoftware com>
Date: Sat, 4 Oct 2008 13:37:01 -0600

On Sat, Oct 04, 2008 at 02:04:24PM -0500, Ron wrote:
You can make the constants tables even more concise and expressive by
writing

local command_codes = {
SMB_COM_CREATE_DIRECTORY             = 0x00,
SMB_COM_DELETE_DIRECTORY             = 0x01,
...
}

Likewise you can say command_codes.SMB_COM_CREATE_DIRECTORY rather than
command_codes['SMB_COM_CREATE_DIRECTORY']. This is possible because all
the table keys are legal identifiers.

Makes sense. If I do that with the error constants, is it possible to
reverse it so I can look up the name by the code?

Yes, it shouldn't require any other code changes. It's just building the
exact same table using a table constructor rather than assigning
elements one by one in separate statements.

A reminder to everyone: I'm just waiting for someone to try these
scripts and say, "Yes, they worked" or "No, they didn't." It's not that
I distrust Ron, it's just that sometimes running a new piece of software
on a different machine can uncover something you never thought of.

David Fifield

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


Current thread: