mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Fix #2175: NSE script output now tagged to Target obj, not IP or targetname
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
#Nmap Changelog ($Id$); -*-text-*-
|
#Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o [NSE][GH#2175] Fixed NSE so it will not consolidate all port script output
|
||||||
|
for targets which share an IP (e.g. HTTP vhosts) under one target. [Daniel Miller]
|
||||||
|
|
||||||
o [Zenmap][GH#2157] Fixed an issue where a failure to execute Nmap would result
|
o [Zenmap][GH#2157] Fixed an issue where a failure to execute Nmap would result
|
||||||
in a Zenmap crash with "TypeError: coercing to Unicode" exception.
|
in a Zenmap crash with "TypeError: coercing to Unicode" exception.
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ static void push_osmatch_table(lua_State *L, const FingerMatch *match,
|
|||||||
* points to nil!
|
* points to nil!
|
||||||
* */
|
* */
|
||||||
void set_hostinfo(lua_State *L, Target *currenths) {
|
void set_hostinfo(lua_State *L, Target *currenths) {
|
||||||
|
nseU_setpfield(L, -1, "_Target", (void *)currenths);
|
||||||
nseU_setsfield(L, -1, "ip", currenths->targetipstr());
|
nseU_setsfield(L, -1, "ip", currenths->targetipstr());
|
||||||
nseU_setsfield(L, -1, "name", currenths->HostName());
|
nseU_setsfield(L, -1, "name", currenths->HostName());
|
||||||
nseU_setsfield(L, -1, "targetname", currenths->TargetName());
|
nseU_setsfield(L, -1, "targetname", currenths->TargetName());
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ void nseU_setbfield (lua_State *L, int idx, const char *field, int b)
|
|||||||
lua_setfield(L, idx, field);
|
lua_setfield(L, idx, field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nseU_setpfield (lua_State *L, int idx, const char *field, void * p)
|
||||||
|
{
|
||||||
|
idx = lua_absindex(L, idx);
|
||||||
|
lua_pushlightuserdata(L, p);
|
||||||
|
lua_setfield(L, idx, field);
|
||||||
|
}
|
||||||
|
|
||||||
void nseU_appendfstr (lua_State *L, int idx, const char *fmt, ...)
|
void nseU_appendfstr (lua_State *L, int idx, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
@@ -180,10 +187,16 @@ Target *nseU_gettarget (lua_State *L, int idx)
|
|||||||
Target *target;
|
Target *target;
|
||||||
idx = lua_absindex(L, idx);
|
idx = lua_absindex(L, idx);
|
||||||
luaL_checktype(L, idx, LUA_TTABLE);
|
luaL_checktype(L, idx, LUA_TTABLE);
|
||||||
|
lua_getfield(L, idx, "_Target");
|
||||||
lua_getfield(L, idx, "targetname");
|
lua_getfield(L, idx, "targetname");
|
||||||
lua_getfield(L, idx, "ip");
|
lua_getfield(L, idx, "ip");
|
||||||
if (!(lua_isstring(L, -2) || lua_isstring(L, -1)))
|
if (!(lua_isstring(L, -2) || lua_isstring(L, -1)))
|
||||||
luaL_error(L, "host table does not have a 'ip' or 'targetname' field");
|
luaL_error(L, "host table does not have a 'ip' or 'targetname' field");
|
||||||
|
if (lua_islightuserdata(L, -3)) /* _Target */
|
||||||
|
{
|
||||||
|
lua_pop(L, 2); /* pop ip and targetname, leaving _Target on top */
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
/* IP is preferred to targetname because it is more unique. Really, though, a
|
/* IP is preferred to targetname because it is more unique. Really, though, a
|
||||||
* user can scan the same IP or targetname multiple times, and NSE will get
|
* user can scan the same IP or targetname multiple times, and NSE will get
|
||||||
* all mixed up. */
|
* all mixed up. */
|
||||||
|
|||||||
@@ -73,6 +73,13 @@ void nseU_setifield (lua_State *L, int idx, const char *field, lua_Integer value
|
|||||||
*/
|
*/
|
||||||
void nseU_setbfield (lua_State *L, int idx, const char *field, int value);
|
void nseU_setbfield (lua_State *L, int idx, const char *field, int value);
|
||||||
|
|
||||||
|
/* void nseU_setpfield (lua_State *L, int idx, [-0, +0, e]
|
||||||
|
* const char *field, void *p)
|
||||||
|
*
|
||||||
|
* Sets the field for table at index idx to lightuserdata p.
|
||||||
|
*/
|
||||||
|
void nseU_setpfield (lua_State *L, int idx, const char *field, void * p);
|
||||||
|
|
||||||
/* void nseU_appendfstr (lua_State *L, int idx, [-0, +0, m]
|
/* void nseU_appendfstr (lua_State *L, int idx, [-0, +0, m]
|
||||||
* const char *fmt, ...)
|
* const char *fmt, ...)
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user