Adds a "duplicate_ok" option to report_auth_info to allow for multiple passwords on the same username. Never came up before I took a look at SNMP.

Also normalizes the print_status messages to be explicit about which module is reporting (important when you're running several at once).



git-svn-id: file:///home/svn/framework3/trunk@11267 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2010-12-09 21:23:39 +00:00
parent dd992fe77a
commit 493db14006
2 changed files with 14 additions and 5 deletions

View File

@ -700,6 +700,7 @@ class DBManager
proof = opts.delete(:proof)
source_id = opts.delete(:source_id)
source_type = opts.delete(:source_type)
duplicate_ok = opts.delete(:duplicate_ok)
# Nil is true for active.
active = (opts[:active] || opts[:active].nil?) ? true : false
@ -718,8 +719,14 @@ class DBManager
# Get the service
service ||= get_service(wspace, host, proto, port)
# Create the cred by username only (so we can change passwords)
cred = service.creds.find_or_initialize_by_user_and_ptype(token[0] || "", ptype)
# If duplicate usernames are okay, find by both user and password (allows
# for actual duplicates to get modified updated_at, sources, etc)
if duplicate_ok
cred = service.creds.find_or_initialize_by_user_and_ptype_and_pass(token[0] || "", ptype, token[1] || "")
else
# Create the cred by username only (so we can change passwords)
cred = service.creds.find_or_initialize_by_user_and_ptype(token[0] || "", ptype)
end
# Update with the password
cred.pass = (token[1] || "")

View File

@ -73,7 +73,7 @@ class Metasploit3 < Msf::Auxiliary
udp_sock = Rex::Socket::Udp.create( { 'LocalHost' => datastore['CHOST'] || nil, 'Context' => {'Msf' => framework, 'MsfExploit' => self} })
add_socket(udp_sock)
print_status(">> progress (#{batch[0]}-#{batch[-1]}) #{idx}/#{@comms.length * batch.length}...") if datastore['ShowProgress']
print_status("SNMP scan progress (#{batch[0]}-#{batch[-1]}): #{idx}/#{@comms.length * batch.length}...") if datastore['ShowProgress']
@comms.each do |comm|
data1 = create_probe_snmp1(comm)
@ -97,7 +97,7 @@ class Metasploit3 < Msf::Auxiliary
end
if( (idx+=1) % 1000 == 0) and datastore['ShowProgress']
print_status(">> progress (#{batch[0]}-#{batch[-1]}) #{idx}/#{@comms.length * batch.length}...")
print_status("SNMP scan progress (#{batch[0]}-#{batch[-1]}): #{idx}/#{@comms.length * batch.length}...")
end
end
end
@ -136,7 +136,7 @@ class Metasploit3 < Msf::Auxiliary
if(com)
@found[pkt[1]]||={}
if(not @found[pkt[1]][com])
print_status("#{pkt[1]} '#{com}' '#{inf}'")
print_status("SNMP: #{pkt[1]} community string: '#{com}' info: '#{inf}'")
@found[pkt[1]][com] = inf
end
@ -154,8 +154,10 @@ class Metasploit3 < Msf::Auxiliary
:host => pkt[1],
:port => pkt[2],
:proto => 'udp',
:sname => 'snmp',
:user => '',
:pass => com,
:duplicate_ok => true,
:active => true
)