-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
res0nat0r/nmap
#1Closed
Copy link
Labels
Description
When running http-default-accounts.nse if a fingerprint is not matched during the setup_check function loop, add output to stdout and into the output file (nmap, gnmap, xml) that a fingerprint was not found. This would be more apparent to end users and allow easier methods to identify web hosts that do not have a fingerprint.
Script:
https://github.com/nmap/nmap/blob/master/scripts/http-default-accounts.nse
Example POC code:
(lines 416-446)
local fingerprint_found = nil
for _, fingerprint in ipairs(fingerprints) do
local target_check = fingerprint.target_check or default_target_check
local credentials_found = false
stdnse.debug(1, "Processing %s", fingerprint.name)
for _, probe in ipairs(fingerprint.paths) do
local result = results[pathmap[probe.path]]
if result and not credentials_found then
local path = basepath .. probe.path
if target_check(host, port, path, result) then
fingerprint_found = true
local out, txtout = test_credentials(host, port, fingerprint, path)
if out then
output[fingerprint.name] = out
table.insert(text_output, txtout)
credentials_found = true
end
end
end
end
end
if not fingerprint_found then
stdnse.debug(1, "Fingerprint not found")
local txtout = "Fingerprint not found"
table.insert(text_output,("%s"):format(stdnse.string_or_blank(txtout)))
end
if #text_output > 0 then
return output, stdnse.format_output(true, text_output)
end
end
This would output Fingerprint not found at the end of the for loop and also inside of an output file if specified. However, there may be a more elegant solution, was just a proof of concept to see how level of effort was.
Perhaps, like in XML, create a Fingerprint.name tag and if nil, it would be empty.