1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-17 13:09:02 +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

@@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*- # Nmap Changelog ($Id$); -*-text-*-
o [NSE][GH#862] SNMP scripts will now take a community string provided like
`--script-args creds.snmp=private`, which previously did not work because it
was interpreted as a username. [Daniel Miller]
o [NSE] Resolved several issues in the default HTTP redirect rules: o [NSE] Resolved several issues in the default HTTP redirect rules:
- [GH#826] A redirect is now cancelled if the original URL contains - [GH#826] A redirect is now cancelled if the original URL contains
embedded credentials embedded credentials

View File

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