1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

Fix usage of nmap.fetchfile in several scripts

Discussion thread: http://seclists.org/nmap-dev/2013/q2/121

Existing behavior preserved and preferred, but absolute and local paths
should also work now. Notably, smb-psexec's locate_file function claimed
to check current directory but did not.
This commit is contained in:
dmiller
2013-04-26 12:14:44 +00:00
parent 666de7b83f
commit 93eee124c2
5 changed files with 30 additions and 26 deletions

View File

@@ -12,7 +12,7 @@ Attempts to exploit java's remote debugging port. When remote debugging port is
After injection, class' run() method is executed.
Method run() has no parameters, and is expected to return a string.
You can specify your own .class file to inject by <code>filename</code> argument.
You must specify your own .class file to inject by <code>filename</code> argument.
See nselib/data/jdwp-class/README for more.
]]
@@ -51,7 +51,7 @@ action = function(host, port)
if filename == nil then
return stdnse.format_output(false, "This script requires a .class file to inject.")
end
local file = io.open(nmap.fetchfile(filename), "rb")
local file = io.open(nmap.fetchfile(filename) or filename, "rb")
local class_bytes = file:read("*all")
-- inject the class