Nmap Development mailing list archives

Re: [NSE] Yet another SMB version!


From: Ron <ron () skullsecurity net>
Date: Tue, 21 Oct 2008 21:53:13 -0500

jah wrote:
On 22/10/2008 00:20, Brandon Enright wrote:
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

In this particular case, the output that Brandon pasted was sufficient
for me to track down the problem, so that worked out. But in general,
would there be an issue with adding the corouting.running() call right
to the stdnse library? It seems like a logical thing to print out, and
changing the 286 times I call print_debug() to do that would be a little
ewwy. :)

I also store the host/port in the 'smbstate' table, so I actually have
fairly easy access to it throughout the modules. But I don't like the
idea of using that in print_debug(), that just feels too messy.

Ron


-- 
Ron Bowes
http://www.skullsecurity.org/
http://www.javaop.com/

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


Current thread: