Nmap Development mailing list archives

Re: [NSE] Getting a backtrace?


From: Ron <ron () skullsecurity net>
Date: Sat, 25 Oct 2008 00:29:05 -0500

Patrick Donnelly wrote:
On Fri, Oct 24, 2008 at 8:47 AM, Ron <ron () skullsecurity net> wrote:

As of right now NSE does not print out a backtrace (it could easily if
there is a general desire for this). You can get the information when
debugging by hooking your action function (emphasis on "when
debugging") like so:

function action (host, port)
 -- your script does stuff
end

-- ... other stuff in file

local real_action = action;

function action (...)
  local t = {n = select("#", ...), ...};
  local status, ret = xpcall(function() return real_action(unpack(t,
1, t.n)) end,
      debug.traceback)
  if not status then error(ret) end
  return ret
end

Cheers,


Awesome, thanks!

I personally think printing a stacktrace would be useful in higher debug
levels (-d2 or -d3?) -- generally, if you're getting a runtime error,
being able to pull more information about it is useful.

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: