Skip to content

Commit

Permalink
Land #3088, SNMP timestamp elements fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wvu committed Mar 13, 2014
2 parents 5cf5643 + f51ee2d commit 5aad8f2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/auxiliary/scanner/snmp/snmp_enum.rb
Expand Up @@ -92,19 +92,18 @@ def run_host(ip)
systemDate = systemDate.unpack('C*')

year = systemDate[0] * 256 + systemDate[1]
month = systemDate[2]
day = systemDate[3]
hour = systemDate[4]
minutes = systemDate[5]
seconds = systemDate[6]
tenths = systemDate[7]
month = systemDate[2] || 0
day = systemDate[3] || 0
hour = systemDate[4] || 0
minutes = systemDate[5] || 0
seconds = systemDate[6] || 0
tenths = systemDate[7] || 0
output_data["System date"] = sprintf("%d-%d-%d %02d:%02d:%02d.%d", year, month, day, hour, minutes, seconds, tenths)
end

#
#
if (sysDesc =~ /Windows/)
usersLine = ""
domPrimaryDomain = snmp.get_value('1.3.6.1.4.1.77.1.4.1.0').to_s

output_data["Domain"] = domPrimaryDomain.strip
Expand Down Expand Up @@ -958,6 +957,8 @@ def run_host(ip)
raise $!
rescue ::Exception => e
print_status("Unknown error: #{e.class} #{e}")
elog("Unknown error: #{e.class} #{e}")
elog("Call stack:\n#{e.backtrace.join "\n"}")
ensure
disconnect_snmp
end
Expand Down

0 comments on commit 5aad8f2

Please sign in to comment.