@@ -52,7 +52,7 @@ def run_host(ip)
52
52
output_data = { }
53
53
output_data = { "Host IP" => ip }
54
54
55
- if snmp . get_value ( 'sysDescr.0' ) =~ /SBG6580/
55
+ if snmp . get_value ( 'sysDescr.0' ) . to_s =~ /SBG6580/
56
56
# print connected status after the first query so if there are
57
57
# any timeout or connectivity errors; the code would already
58
58
# have jumped to error handling where the error status is
@@ -170,20 +170,22 @@ def run_host(ip)
170
170
}
171
171
172
172
print_line ( line )
173
+ else
174
+ print_error ( "#{ ip } does not appear to be a SBG6580." )
173
175
end
174
176
175
177
rescue SNMP ::RequestTimeout
176
- vprint_status ( "#{ ip } SNMP request timeout." )
178
+ print_error ( "#{ ip } SNMP request timeout." )
177
179
rescue Rex ::ConnectionError
178
- print_status ( "#{ ip } Connection refused." )
180
+ print_error ( "#{ ip } Connection refused." )
179
181
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'." )
181
183
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'." )
183
185
rescue ::Interrupt
184
186
raise $!
185
187
rescue ::Exception => e
186
- print_status ( "Unknown error: #{ e . class } #{ e } " )
188
+ print_error ( "Unknown error: #{ e . class } #{ e } " )
187
189
elog ( "Unknown error: #{ e . class } #{ e } " )
188
190
elog ( "Call stack:\n #{ e . backtrace . join "\n " } " )
189
191
ensure
0 commit comments