diff options
Diffstat (limited to 'examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py')
-rw-r--r-- | examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py b/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py index 953f80e6..229ffdab 100644 --- a/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py +++ b/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py @@ -70,6 +70,7 @@ config.addTargetAddr( sourceAddress=('1.2.3.4', 0) ) + # Error/response receiver # noinspection PyUnusedLocal,PyUnusedLocal,PyUnusedLocal def cbFun(snmpEngine, sendRequestHandle, errorIndication, @@ -79,21 +80,19 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication, # SNMPv1 response may contain noSuchName error *and* SNMPv2c exception, # so we ignore noSuchName error here elif errorStatus and errorStatus != 2: - print('%s at %s' % ( - errorStatus.prettyPrint(), - errorIndex and varBinds[int(errorIndex)-1][0] or '?' - ) - ) + print('%s at %s' % (errorStatus.prettyPrint(), + errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) else: for oid, val in varBinds: print('%s = %s' % (oid.prettyPrint(), val.prettyPrint())) + # Prepare and send a request message cmdgen.GetCommandGenerator().sendVarBinds( snmpEngine, 'my-router', None, '', # contextEngineId, contextName - [ ((1,3,6,1,2,1,1,1,0), None) ], + [((1, 3, 6, 1, 2, 1, 1, 1, 0), None)], cbFun ) |