summaryrefslogtreecommitdiff
path: root/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py')
-rw-r--r--examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py49
1 files changed, 25 insertions, 24 deletions
diff --git a/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py b/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py
index cab29126..998d40f4 100644
--- a/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py
+++ b/examples/v3arch/asyncore/manager/cmdgen/spoof-source-address.py
@@ -1,27 +1,28 @@
-#
-# GET Command Generator
-#
-# Send a SNMP GET request
-# with SNMPv2c, community 'public'
-# over IPv4/UDP
-# to an Agent at 195.218.195.228:161
-# from a non-local, spoofed IP 1.2.3.4 (root and Python 3.3+ required)
-# for an OID in tuple form
-#
-# This script performs similar to the following Net-SNMP command:
-#
-# $ snmpget -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1.1.0
-#
-# But unlike the above command, this script issues SNMP request from
-# a non-default, non-local IP address.
-#
-# It is indeed possible to originate SNMP traffic from any valid local
-# IP addresses. It could be a secondary IP interface, for instance.
-# Superuser privileges are only required to send spoofed packets.
-# Alternatively, sending from local interface could also be achieved by
-# binding to it (via openClientMode() parameter).
-#
-#
+"""
+Spoof source address
+++++++++++++++++++++
+
+Send a SNMP GET request
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at 195.218.195.228:161
+* from a non-local, spoofed IP 1.2.3.4 (root and Python 3.3+ required)
+* for an OID in tuple form
+
+This script performs similar to the following Net-SNMP command:
+
+| $ snmpget -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1.1.0
+
+But unlike the above command, this script issues SNMP request from
+a non-default, non-local IP address.
+
+It is indeed possible to originate SNMP traffic from any valid local
+IP addresses. It could be a secondary IP interface, for instance.
+Superuser privileges are only required to send spoofed packets.
+Alternatively, sending from local interface could also be achieved by
+binding to it (via openClientMode() parameter).
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.carrier.asyncore.dgram import udp
from pysnmp.entity.rfc3413 import cmdgen