Nmap Development mailing list archives

[NSE] fixes to snmp-interfaces


From: jah <jah () zadkiel plus com>
Date: Thu, 19 Jul 2012 18:22:52 +0100

Folks,

r29271 fixes a few bugs in snmp-interfaces to get it working again.  This error, below, caused the script to abort 
before it did any real work in the pre-scanning phase:

NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 1) scan.
NSE: Starting 'snmp-interfaces' (thread: 02AC61B0).
Initiating NSE at 03:20
NSE: 'snmp-interfaces' (thread: 02AC61B0) threw an error!
C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:410: attempt to index local 'host' (a nil value)
stack traceback:
    C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:410: in function <C:\Program Files 
(x86)\Nmap/scripts\snmp-interfaces.nse:395>
    (...tail calls...)
Completed NSE at 03:20, 0.00s elapsed

These errors prevented the script from outputting information obtained from a successful walk of the IF-MIB tree

NSE: SNMP walk of IF-MIB returned 110 lines
NSE: 'snmp-interfaces' (thread: 02954E60) threw an error!
C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:230: invalid use of '%' in replacement string
stack traceback:
    [C]: in function 'gsub'
    C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:230: in function 'process_interfaces'
    C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:449: in function <C:\Program Files 
(x86)\Nmap/scripts\snmp-interfaces.nse:395>
    (...tail calls...)
NSOCK (1.4600s) nsi_new (IOD #2)

NSE: 'snmp-interfaces' (thread: 027F61B0) threw an error!
C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:364: bad argument #2 to 'format' (number expected, got nil)
stack traceback:
    [C]: in function 'format'
    C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:364: in function 'build_results'
    C:\Program Files (x86)\Nmap/scripts\snmp-interfaces.nse:460: in function <C:\Program Files 
(x86)\Nmap/scripts\snmp-interfaces.nse:395>
    (...tail calls...)

This is some output from the fixed script:

Pre-scan script results:
| snmp-interfaces:
|   Ethernet0
|     MAC address: 00:50:7f:d5:5e:30 (DrayTek)
|     Type: ethernetCsmacd  Speed: 100 Mbps
|     Status: up
|     Traffic stats: 2.21 Mb sent, 1.97 Mb received
|   Interface 2
|     MAC address: 00:00:00:00:00:00 (Xerox)
|     Type: other  Speed: 0 Kbps
|     Traffic stats: 0.00 Kb sent, 0.00 Kb received
|   Interface 3
|     MAC address: 00:00:00:00:00:00 (Xerox)
|     Type: other  Speed: 0 Kbps
|     Traffic stats: 0.00 Kb sent, 0.00 Kb received
|   ADSL
|     MAC address: 00:00:00:00:00:00 (Xerox)
|     Type: adsl  Speed: 8 Mbps
|     Status: up
|     Traffic stats: 652.49 Kb sent, 1.70 Mb received
|   ifDescrVpn1
|     MAC address: 01:01:01:01:01:01 (Unknown)
|     Type: other  Speed: 1 Kbps
|     Status: up
|_    Traffic stats: 1.00 Kb sent, 1.00 Kb received

Scanned at 2012-07-19 14:21:46 GMT Daylight Time for 2s
PORT    STATE SERVICE REASON
161/udp open  snmp    script-set
| snmp-interfaces:
|   Ethernet0
|     MAC address: 00:50:7f:d5:5e:30 (DrayTek)
|     Type: ethernetCsmacd  Speed: 100 Mbps
|     Status: up
|     Traffic stats: 255.02 Mb sent, 34.95 Mb received
|   Interface 2
|     MAC address: 00:00:00:00:00:00 (Xerox)
|     Type: other  Speed: 0 Kbps
|     Traffic stats: 0.00 Kb sent, 0.00 Kb received
|   Interface 3
|     MAC address: 00:00:00:00:00:00 (Xerox)
|     Type: other  Speed: 0 Kbps
|     Traffic stats: 0.00 Kb sent, 0.00 Kb received
|   ADSL
|     MAC address: 00:00:00:00:00:00 (Xerox)
|     Type: adsl  Speed: 8 Mbps
|     Status: up
|     Traffic stats: 12.67 Mb sent, 248.82 Mb received
|   ifDescrVpn1
|     MAC address: 01:01:01:01:01:01 (Unknown)
|     Type: other  Speed: 1 Kbps
|     Status: up
|_    Traffic stats: 1.00 Kb sent, 1.00 Kb received
MAC Address: 00:50:7F:D5:5E:30 (DrayTek)

I haven't (yet) properly validated these results, which may be correct, but they aren't quite what I expected.  I hoped 
to see an IP address for some of these interfaces and the MAC for the ADSL interface is wrong (ifDescrVpn1 looks odd too).

Regards,

jah

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: