mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
nse_check_globals cleanup
This commit is contained in:
parent
860d791aa1
commit
17e56e8271
5 changed files with 16 additions and 11 deletions
|
|
@ -38,6 +38,7 @@ local stdnse = require "stdnse"
|
|||
local string = require "string"
|
||||
local bin = require "bin"
|
||||
local table = require "table"
|
||||
local nmap = require "nmap"
|
||||
|
||||
_ENV = stdnse.module("jdwp", stdnse.seeall)
|
||||
|
||||
|
|
@ -615,6 +616,7 @@ function newClassInstance(socket,id,classID,threadID,methodID,numberOfArguments,
|
|||
-- parse data
|
||||
stdnse.print_debug("newClassInstance data: %s",stdnse.tohex(data))
|
||||
local pos, tag = bin.unpack(">C",data)
|
||||
local objectID
|
||||
pos, objectID = bin.unpack(">L",data,pos)
|
||||
return true,objectID
|
||||
end
|
||||
|
|
@ -896,9 +898,8 @@ end
|
|||
-- @param methodName Name of the method.
|
||||
-- @param skipFirst Skip first found method.
|
||||
function findMethod(socket,class,methodName,skipFirst)
|
||||
local methods
|
||||
local methodID
|
||||
status, methods = getMethodsWithGeneric(socket,0,class)
|
||||
local status, methods = getMethodsWithGeneric(socket,0,class)
|
||||
if not status then
|
||||
return false
|
||||
end
|
||||
|
|
@ -1023,7 +1024,7 @@ function injectClass(socket,class_bytes)
|
|||
end
|
||||
-- to trigger the singlestep event, VM must be resumed
|
||||
stdnse.print_debug("Resuming VM and waiting for single step event from main thread...")
|
||||
status, _ = resumeVM(socket,0)
|
||||
local status, _ = resumeVM(socket,0)
|
||||
-- clear singlestep since we need to run our code in this thread and we don't want it to stop after each instruction
|
||||
clearThreadSinglestep(socket,0,eventID)
|
||||
stdnse.print_debug("Cleared singlesteping from main thread.")
|
||||
|
|
@ -1083,7 +1084,7 @@ function injectClass(socket,class_bytes)
|
|||
if not status then
|
||||
return false, injectedClassInstance
|
||||
end
|
||||
injected_class = {
|
||||
local injected_class = {
|
||||
id = injectedClassID,
|
||||
instance = injectedClassInstance,
|
||||
thread = main_thread
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
local bin = require "bin"
|
||||
local io = require "io"
|
||||
local jdwp = require "jdwp"
|
||||
local stdnse = require "stdnse"
|
||||
local nmap = require "nmap"
|
||||
|
|
@ -78,8 +80,7 @@ action = function(host, port)
|
|||
local result
|
||||
status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,1,runArgs)
|
||||
-- get the result string
|
||||
local stringID
|
||||
_,_,stringID = bin.unpack(">CL",result)
|
||||
local _,_,stringID = bin.unpack(">CL",result)
|
||||
status,result = jdwp.readString(socket,0,stringID)
|
||||
return stdnse.format_output(true,result)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
local bin = require "bin"
|
||||
local io = require "io"
|
||||
local jdwp = require "jdwp"
|
||||
local stdnse = require "stdnse"
|
||||
local nmap = require "nmap"
|
||||
|
|
@ -78,8 +80,7 @@ action = function(host, port)
|
|||
local result
|
||||
status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,0,nil)
|
||||
-- get the result string
|
||||
local stringID
|
||||
_,_,stringID = bin.unpack(">CL",result)
|
||||
local _,_,stringID = bin.unpack(">CL",result)
|
||||
status,result = jdwp.readString(socket,0,stringID)
|
||||
-- parse results
|
||||
return stdnse.format_output(true,result)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
local bin = require "bin"
|
||||
local io = require "io"
|
||||
local jdwp = require "jdwp"
|
||||
local stdnse = require "stdnse"
|
||||
local nmap = require "nmap"
|
||||
|
|
@ -70,8 +72,7 @@ action = function(host, port)
|
|||
local result
|
||||
status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,0,nil)
|
||||
-- get the result string
|
||||
local stringID
|
||||
_,_,stringID = bin.unpack(">CL",result)
|
||||
local _,_,stringID = bin.unpack(">CL",result)
|
||||
status,result = jdwp.readString(socket,0,stringID)
|
||||
-- parse results
|
||||
return stdnse.format_output(true,result)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ local packet = require "packet"
|
|||
local ipOps = require "ipOps"
|
||||
local bin = require "bin"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local target = require "target"
|
||||
local table = require "table"
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ local mrinfoListen = function(interface, timeout, responses)
|
|||
local condvar = nmap.condvar(responses)
|
||||
local start = nmap.clock_ms()
|
||||
local listener = nmap.new_socket()
|
||||
local p, mrinfo_raw, status, l3data, response
|
||||
local p, mrinfo_raw, status, l3data, response, _
|
||||
|
||||
-- IGMP packets that are sent to our host
|
||||
local filter = 'ip proto 2 and dst host ' .. interface.address
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue