Skip to content

Commit c1b8cee

Browse files
committed
Land rapid7#5369, @dmaloney-r7's snmp_login fixes
2 parents 84060bb + 69a7a89 commit c1b8cee

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

lib/metasploit/framework/credential.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ def inspect
7575
def to_s
7676
if realm && realm_key == Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN
7777
"#{self.realm}\\#{self.public}:#{self.private}"
78-
else
78+
elsif self.private
7979
"#{self.public}:#{self.private}#{at_realm}"
80+
else
81+
self.public
8082
end
8183
end
8284

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ def print_brute(opts={})
566566
else
567567
level = opts[:level].to_s.strip
568568
end
569-
570569
host_ip = opts[:ip] || opts[:rhost] || opts[:host] || (rhost rescue nil) || datastore['RHOST']
571570
host_port = opts[:port] || opts[:rport] || (rport rescue nil) || datastore['RPORT']
572571
msg = opts[:msg] || opts[:message] || opts[:legacy_msg]

lib/msf/core/auxiliary/report.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,43 @@ module Auxiliary::Report
1212

1313
optionally_include_metasploit_credential_creation
1414

15+
def db_warning_given?
16+
if @warning_issued
17+
true
18+
else
19+
@warning_issued = true
20+
false
21+
end
22+
end
23+
1524
def create_cracked_credential(opts={})
1625
if active_db?
1726
super(opts)
18-
else
27+
elsif !db_warning_given?
1928
vprint_warning('No active DB -- Credential data will not be saved!')
2029
end
2130
end
2231

2332
def create_credential(opts={})
2433
if active_db?
2534
super(opts)
26-
else
35+
elsif !db_warning_given?
2736
vprint_warning('No active DB -- Credential data will not be saved!')
2837
end
2938
end
3039

3140
def create_credential_login(opts={})
3241
if active_db?
3342
super(opts)
34-
else
43+
elsif !db_warning_given?
3544
vprint_warning('No active DB -- Credential data will not be saved!')
3645
end
3746
end
3847

3948
def invalidate_login(opts={})
4049
if active_db?
4150
super(opts)
42-
else
51+
elsif !db_warning_given?
4352
vprint_warning('No active DB -- Credential data will not be saved!')
4453
end
4554
end

modules/auxiliary/scanner/snmp/snmp_login.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def run_batch(batch)
8585
print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: #{result.credential} (Access level: #{result.access_level})"
8686
else
8787
invalidate_login(credential_data)
88-
vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})"
88+
print_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status})"
8989
end
9090
end
9191
end

0 commit comments

Comments
 (0)