lextudio / pysnmp

Python SNMP library
https://www.pysnmp.com/pysnmp/
BSD 2-Clause "Simplified" License
78 stars 21 forks source link

bulkCmd IndexError, when connecting to a non snmp device #120

Closed Noppes closed 2 weeks ago

Noppes commented 3 weeks ago

Expected behavior

I expect an connection error

Actual behavior

I'd expect errorIndication to return the error or for it to throw an exception, but instead I get IndexError

Detailed steps

Im checking if a device is an snmp device by logging into it, in this case its a generic non snmp device.

In pysnmp-lexistudio I used walkCmd with multiple varBinds, but this is no longer supported in latest pysnmp, so now trying to use bulkCmd and am getting this error.

Python package information

7.1.2

Operating system information

ubuntu

Python information

3.12

(Optional) Contents of your test script

No response

Relevant log output

2024-09-15 16:52:46 Traceback (most recent call last):
2024-09-15 16:52:46   File "scan.py", line 156, in scanner.Scanner.snmp_run
2024-09-15 16:52:46   File "/usr/local/lib/python3.12/site-packages/pysnmp/hlapi/v3arch/asyncio/cmdgen.py", line 609, in bulkCmd
2024-09-15 16:52:46     return await future
2024-09-15 16:52:46            ^^^^^^^^^^^^
2024-09-15 16:52:46   File "/usr/local/lib/python3.12/site-packages/pysnmp/hlapi/v3arch/asyncio/cmdgen.py", line 583, in __cbFun
2024-09-15 16:52:46     snmpEngine.cache, varBindTable[0], lookupMib
2024-09-15 16:52:46                       ~~~~~~~~~~~~^^^
2024-09-15 16:52:46 IndexError: tuple index out of range
lextm commented 2 weeks ago

Fixed in release 7.1.3.