Nmap Development mailing list archives
Re: [NSE] Getting a backtrace?
From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Fri, 24 Oct 2008 22:27:46 -0600
On Fri, Oct 24, 2008 at 8:47 AM, Ron <ron () skullsecurity net> wrote:
Hello, When trying to troubleshoot problems with my scripts, I often get errors such as this: SCRIPT ENGINE: /usr/share/nmap/nselib/msrpc.lua:139: bad argument #1 to 'char' (number expected, got nil) The problem is, the error is happening inside a function that's being called from 100+ places. Is there some way to get more information when there's a failure (the most important being, the backtrace/call stack/whatever)? Thanks! Ron
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,
--
-Patrick Donnelly
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."
-Will Durant
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
Current thread:
- [NSE] Getting a backtrace? Ron (Oct 24)
- Re: [NSE] Getting a backtrace? Kris Katterjohn (Oct 24)
- Re: [NSE] Getting a backtrace? Patrick Donnelly (Oct 24)
- Re: [NSE] Getting a backtrace? Ron (Oct 24)
- Re: [NSE] Getting a backtrace? Ron (Oct 25)
- Re: [NSE] Getting a backtrace? Patrick Donnelly (Oct 25)
