Nmap Development mailing list archives

Re: [NSE] Yet another SMB version!


From: jah <jah () zadkiel plus com>
Date: Wed, 22 Oct 2008 01:13:54 +0100

On 22/10/2008 00:20, Brandon Enright wrote:
On Wed, 22 Oct 2008 00:10:25 +0100
jah <jah () zadkiel plus com> wrote:
 
You might do something like the following within scripts:
stdnse.print_debug( 2, ("%s %s some error happened with
something"):format(id, ip) )
which might give you

The trouble is that the ip and port are locally scoped and the library
doesn't have access.  Maybe good library procedure would be to pass the
ip, port in so that the debugging and error output has more information
available to it.
Ah, yes.  Silly me.  And print_debug doesn't need to be passed a
formatted string either.  Silly me again.

Perhaps though, there is a quick solution.
coroutine.running()  returns a thread.  The currently running thread in
fact - and you can print the thread id:

print( coroutine.running()  )

So what I'm thinking is that you could insert that statement right after:

stdnse.print_debug(5, "MSRPC: Entering unicode_to_string(pos = %d,
length = %d)", pos, length)

in msrpc.lua and then in the action() of each script that you're running do:

print( host.ip, coroutine.running()  )

which should tie a thread id to a host IP and allow you to cross
reference the thread id that failed.

Other than that, as you say, passing the host.ip and script id to the
library would work, but that would be a real pain in the arse as
best-practise for library use.

Regards,

jah

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


Current thread: