1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Use creds username as SNMP community if no ':' indicates password. Fixes #862

This commit is contained in:
dmiller
2017-04-22 19:31:24 +00:00
parent 8f3137bac7
commit 13d06eb738
2 changed files with 12 additions and 3 deletions

View File

@@ -447,9 +447,14 @@ Helper = {
local creds_store = creds.Credentials:new(creds.ALL_DATA, host, port)
for _,cs in ipairs({creds.State.PARAM, creds.State.VALID}) do
local account = creds_store:getCredentials(cs)()
if (account and account.pass) then
o.community = account.pass == "<empty>" and "" or account.pass
break
if account then
if account.pass and account.pass ~= "<empty>" and account.pass ~= "" then
o.community = account.pass
break
elseif account.user then
o.community = account.user
break
end
end
end
end