Skip to content

Commit 0735de0

Browse files
committed
Changes to error output per PR comments
1 parent 0a01da1 commit 0735de0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/auxiliary/scanner/snmp/sbg6580_enum.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def run_host(ip)
5252
output_data = {}
5353
output_data = {"Host IP" => ip}
5454

55-
if snmp.get_value('sysDescr.0') =~ /SBG6580/
55+
if snmp.get_value('sysDescr.0').to_s =~ /SBG6580/
5656
# print connected status after the first query so if there are
5757
# any timeout or connectivity errors; the code would already
5858
# have jumped to error handling where the error status is
@@ -170,20 +170,22 @@ def run_host(ip)
170170
}
171171

172172
print_line(line)
173+
else
174+
print_error("#{ip} does not appear to be a SBG6580.")
173175
end
174176

175177
rescue SNMP::RequestTimeout
176-
vprint_status("#{ip} SNMP request timeout.")
178+
print_error("#{ip} SNMP request timeout.")
177179
rescue Rex::ConnectionError
178-
print_status("#{ip} Connection refused.")
180+
print_error("#{ip} Connection refused.")
179181
rescue SNMP::InvalidIpAddress
180-
print_status("#{ip} Invalid IP Address. Check it with 'snmpwalk tool'.")
182+
print_error("#{ip} Invalid IP Address. Check it with 'snmpwalk tool'.")
181183
rescue SNMP::UnsupportedVersion
182-
print_status("#{ip} Unsupported SNMP version specified. Select from '1' or '2c'.")
184+
print_error("#{ip} Unsupported SNMP version specified. Select from '1' or '2c'.")
183185
rescue ::Interrupt
184186
raise $!
185187
rescue ::Exception => e
186-
print_status("Unknown error: #{e.class} #{e}")
188+
print_error("Unknown error: #{e.class} #{e}")
187189
elog("Unknown error: #{e.class} #{e}")
188190
elog("Call stack:\n#{e.backtrace.join "\n"}")
189191
ensure

0 commit comments

Comments
 (0)