mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
merge soc07 r4989 - applied mathew boyle's patch for print_debug
This commit is contained in:
@@ -402,13 +402,14 @@ static int l_print_debug_unformatted(lua_State *l) {
|
||||
int verbosity=1, stack_counter(1);
|
||||
const char *out;
|
||||
|
||||
if (lua_isnumber (l, 1) && (lua_gettop(l) > 1)) {
|
||||
verbosity = lua_tointeger(l, 1);
|
||||
if (verbosity > o.verbose) return 0;
|
||||
stack_counter++;
|
||||
}
|
||||
out = luaL_checkstring(l, stack_counter);
|
||||
log_write(LOG_STDOUT, "%s NSE DEBUG: %s\n", SCRIPT_ENGINE, out);
|
||||
if (lua_gettop(l) != 2) return luaL_error(l, "Incorrect number of arguments\n");
|
||||
|
||||
verbosity = luaL_checkinteger(l, 1);
|
||||
if (verbosity > o.verbose) return 0;
|
||||
out = luaL_checkstring(l, 2);
|
||||
|
||||
log_write(LOG_STDOUT, "%s DEBUG: %s\n", SCRIPT_ENGINE, out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
9
nselib/stdnse.lua
Normal file
9
nselib/stdnse.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
print_debug = function(...)
|
||||
local verbosity = 1;
|
||||
if ((#arg > 1) and (tonumber(arg[1]))) then
|
||||
verbosity = table.remove(arg, 1);
|
||||
end
|
||||
|
||||
nmap.print_debug_unformatted(verbosity, string.format(unpack(arg, start)));
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ action = function(host, port)
|
||||
if title ~= nil then
|
||||
result = string.gsub(title , "[\n\r\t]", "")
|
||||
if string.len(title) > 50 then
|
||||
nmap.print_debug_unformatted("showHTMLTitle.nse: Title got truncated!");
|
||||
nmap.print_debug("showHTMLTitle.nse: Title got truncated!");
|
||||
result = string.sub(result, 1, 62) .. "..."
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user