updated IP address for demo.snmplabs.com in examples

pull/45/head
Ilya Etingof 2016-07-30 23:30:35 +02:00
parent b373b1d647
commit f63149c938
40 changed files with 113 additions and 112 deletions

View File

@ -15,6 +15,7 @@ Github `repo <https://github.com/etingof/pysnmp>`_
- Fix to Pythonized MIBs loading when only .pyc files are
present (e.g. py2exe/cx_freeze environments).
- Fix to key localization for 3DES-based encryption.
- Updated IP address for demo.snmplabs.com in examples.
Revision 4.3.2, released 2016-02-12
-----------------------------------

View File

@ -13,7 +13,7 @@ wait for responses asynchronously:
* with TRAP ID 'coldStart' specified as a MIB symbol
* include managed object information specified as var-bind objects pair
| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 195.218.195.228 6 432 12345 1.3.6.1.2.1.1.1.0 s "my system"
| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 demo.snmplabs.com 6 432 12345 1.3.6.1.2.1.1.1.0 s "my system"
| $ snmptrap -v2c -c public demo.snmplabs.com 123 1.3.6.1.6.3.1.1.5.1
"""#

View File

@ -8,7 +8,7 @@ The following script sends SNMP INFORM notification using the following options:
* with community name 'public'
* over IPv4/UDP and IPv6/UDP
* send INFORM notification
* to a Manager at 195.218.195.228:162 and [::1]:162
* to a Manager at demo.snmplabs.com:162 and [::1]:162
* with TRAP ID 'coldStart' specified as an OID
The following Net-SNMP command will produce similar SNMP notification:

View File

@ -9,7 +9,7 @@ following options:
* with community name 'public'
* over IPv4/UDP and IPv6/UDP
* send TRAP notification
* to a Manager at 195.218.195.228:162 and [::1]
* to a Manager at demo.snmplabs.com:162 and [::1]
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
* with default Uptime value

View File

@ -6,12 +6,12 @@ Perform SNMP GET operation with the following options:
* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at demo.snmplabs.com:161
* for OIDs in tuple form
This script performs similar to the following Net-SNMP command:
| $ snmpget -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.3.0
| $ snmpget -v1 -c public -ObentU demo.snmplabs.com 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.3.0
"""#
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher

View File

@ -6,13 +6,13 @@ Perform SNMP GETBULK operation with the following options:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at demo.snmplabs.com:161
* for OID in tuple form
* with non-repeaters=0 and max-repeaters=25
This script performs similar to the following Net-SNMP command:
| $ snmpbulkwalk -v2c -c public -ObentU -Cn0 -Cr25 195.218.195.228 1.3.6
| $ snmpbulkwalk -v2c -c public -ObentU -Cn0 -Cr25 demo.snmplabs.com 1.3.6
"""#
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher

View File

@ -6,12 +6,12 @@ Perform SNMP GETNEXT operation with the following options:
* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at demo.snmplabs.com:161
* for OID in tuple form
This script performs similar to the following Net-SNMP command:
| $ snmpwalk -v1 -c public -ObentU 195.218.195.228 1.3.6
| $ snmpwalk -v1 -c public -ObentU demo.snmplabs.com 1.3.6
"""#
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher

View File

@ -6,13 +6,13 @@ Send SNMP GET request from a non-local IP address:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* from a non-local, spoofed IP 1.2.3.4 (root and Python 3.3+ required)
* for OIDs in string 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 1.3.6.1.2.1.1.3.0
| $ snmpget -v2c -c public -ObentU 104.236.166.95 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.3.0
But unlike the above command, this script issues SNMP request from a
non-default, non-local IP address.
@ -35,7 +35,7 @@ from pyasn1.codec.ber import encoder, decoder
from time import time
# Send request message to this address
transportAddress = udp.UdpTransportAddress(('195.218.195.228', 161))
transportAddress = udp.UdpTransportAddress(('104.236.166.95', 161))
# Send request message from this non-local (!) IP address
transportAddress.setLocalAddress(('1.2.3.4', 0))

View File

@ -6,12 +6,12 @@ Perform SNMP SET operation with the following options:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at demo.snmplabs.com:161
* for OIDs in string form and values in form of pyasn1 objects
This script performs similar to the following Net-SNMP command:
| $ snmpset -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1.9.1.3.1 s 'New description' 1.3.6.1.2.1.1.9.1.4.1 t 12
| $ snmpset -v2c -c public -ObentU demo.snmplabs.com 1.3.6.1.2.1.1.9.1.3.1 s 'New description' 1.3.6.1.2.1.1.9.1.4.1 t 12
"""#
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher

View File

@ -12,15 +12,15 @@ security settings:
* with user 'usr-md5-none', auth: MD5, priv NONE
* over IPv4/UDP
* send INFORM notification
* to multiple Managers at 195.218.195.228:162, 195.218.195.228:162
* to multiple Managers at 104.236.166.95:162, 104.236.166.95:162
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
1.3.6.1.2.1.1.1.0 = 'Example Notificator'
Functionally similar to:
| $ snmpinform -v3 -l authPriv -u usr-md5-none -A authkey1 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification'
| $ snmpinform -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification'
| $ snmpinform -v3 -l authPriv -u usr-md5-none -A authkey1 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification'
| $ snmpinform -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification'
"""#
from pysnmp.entity import engine, config
@ -57,14 +57,14 @@ config.addTransport(
# First target
config.addTargetAddr(
snmpEngine, 'my-nms-1',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds-1',
tagList='all-my-managers'
)
# Second target
config.addTargetAddr(
snmpEngine, 'my-nms-2',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds-2',
tagList='all-my-managers'
)

View File

@ -43,7 +43,7 @@ config.addTransport(
# Create named target
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds'
)

View File

@ -9,7 +9,7 @@ security settings:
* with community name 'public'
* over IPv4/UDP
* send TRAP notification
* to multiple Managers at 195.218.195.228:162, 195.218.195.228:162
* to multiple Managers at 104.236.166.95:162, 104.236.166.95:162
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
1.3.6.1.2.1.1.1.0 = 'Example Notificator'
@ -17,9 +17,9 @@ security settings:
Functionally similar to:
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
"""#
from pysnmp.entity import engine, config
@ -46,21 +46,21 @@ config.addTransport(
# First target
config.addTargetAddr(
snmpEngine, 'my-nms-1',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)
# Second target
config.addTargetAddr(
snmpEngine, 'my-nms-2',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)
# Third target
config.addTargetAddr(
snmpEngine, 'my-nms-3',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -17,7 +17,7 @@ network protocols:
Functionally similar to:
| $ snmptrap -v2c -c public udp:195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public udp:104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public udp6:[::1] 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
"""#
@ -46,7 +46,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms-1',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -7,14 +7,14 @@ Send SNMP notification using the following options:
* SNMPv1
* with community name 'public'
* over IPv4/UDP
* to a Manager at 195.218.195.228 UDP port 162
* to a Manager at 104.236.166.95 UDP port 162
* from local address 0.0.0.0, UDP port 61024
* send TRAP notification
* with TRAP ID 'coldStart' specified as an OID
Functionally similar to:
| $ snmptrap -v1 -c public 195.218.195.228 1.3.6.1.6.3.1.1.5.1 0.0.0.0 1 0 0
| $ snmptrap -v1 -c public 104.236.166.95 1.3.6.1.6.3.1.1.5.1 0.0.0.0 1 0 0
"""#
from pysnmp.entity import engine, config
@ -42,7 +42,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -9,7 +9,7 @@ following options:
* with community name 'public'
* over IPv4/UDP
* send TRAP notification
* to multiple Managers at 195.218.195.228:162, 195.218.195.228:162
* to multiple Managers at 104.236.166.95:162, 104.236.166.95:162
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
1.3.6.1.2.1.1.1.0 = 'Example Notificator'
@ -17,9 +17,9 @@ following options:
Functionally similar to:
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example notification' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
"""#
from pysnmp.entity import engine, config
@ -46,21 +46,21 @@ config.addTransport(
# First target
config.addTargetAddr(
snmpEngine, 'my-nms-1',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)
# Second target
config.addTargetAddr(
snmpEngine, 'my-nms-2',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)
# Third target
config.addTargetAddr(
snmpEngine, 'my-nms-3',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -41,7 +41,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -7,18 +7,18 @@ Send SNMP notification using the following options:
* SNMPv1
* with community name 'public'
* over IPv4/UDP
* to a Manager at 195.218.195.228:162
* to a Manager at 104.236.166.95:162
* send TRAP notification
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
* overriding Uptime value with 12345
* overriding Agent Address with '195.218.195.228'
* overriding Agent Address with '104.236.166.95'
* overriding Enterprise OID with 1.3.6.1.4.1.20408.4.1.1.2
* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
Functionally similar to:
| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 195.218.195.228 6 432 12345 1.3.6.1.2.1.1.1.0 s "my system"
| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 104.236.166.95 6 432 12345 1.3.6.1.2.1.1.1.0 s "my system"
"""#
from pysnmp.entity import engine, config
@ -44,7 +44,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -8,7 +8,7 @@ Send SNMP INFORM notification using the following options:
* with community name 'public'
* over IPv4/UDP
* send INFORM notification
* to a Manager at 195.218.195.228:162
* to a Manager at 104.236.166.95:162
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
1.3.6.1.2.1.1.1.0 = 'Example Notificator'
@ -16,7 +16,7 @@ Send SNMP INFORM notification using the following options:
Functionally similar to:
| $ snmpinform -v2c -c public 195.218.195.228 12345 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example Notificator' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
| $ snmpinform -v2c -c public 104.236.166.95 12345 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s 'Example Notificator' 1.3.6.1.2.1.1.5.0 s 'Notificator Example'
"""#
from pysnmp.entity import engine, config
@ -43,7 +43,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -8,7 +8,7 @@ Send SNMP TRAP notification using the following options:
* with community name 'public'
* over IPv4/UDP
* send TRAP notification
* to a Manager at 195.218.195.228:162
* to a Manager at 104.236.166.95:162
* with TRAP ID IF-MIB::ifLink as MIB symbol
The IF-MIB::ifLink NOTIFICATION-TYPE implies including four other
@ -23,7 +23,7 @@ Where "x" is MIB table index (instance index).
Functionally similar to:
| $ snmptrap -v2c -c public 195.218.195.228 0 1.3.6.1.6.3.1.1.5.3 IF-MIB::ifIndex."1" IF-MIB::ifAdminStatus."1" IF-MIB::ifOperStatus."1" IF-MIB::ifDescr."1"
| $ snmptrap -v2c -c public 104.236.166.95 0 1.3.6.1.6.3.1.1.5.3 IF-MIB::ifIndex."1" IF-MIB::ifAdminStatus."1" IF-MIB::ifOperStatus."1" IF-MIB::ifDescr."1"
"""#
from pysnmp.entity import engine, config
@ -68,7 +68,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms-1',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -8,7 +8,7 @@ Send SNMP TRAP notification using the following options:
* with community name 'public'
* over IPv4/UDP
* send TRAP notification
* to a Manager at 195.218.195.228:162
* to a Manager at 104.236.166.95:162
* with TRAP ID 'coldStart' specified as an OID
* include managed objects information:
1.3.6.1.2.1.1.1.0 = 'Example Notificator'
@ -16,7 +16,7 @@ Send SNMP TRAP notification using the following options:
Functionally similar to:
| $ snmptrap -v2c -c public 195.218.195.228 12345 1.3.6.1.4.1.20408.4.1.1.2
| $ snmptrap -v2c -c public 104.236.166.95 12345 1.3.6.1.4.1.20408.4.1.1.2
"""#
from pysnmp.entity import engine, config
@ -42,7 +42,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -8,7 +8,7 @@ Send SNMP TRAP notification using the following options:
* with user 'usr-md5-des', auth: MD5, priv DES
* over IPv4/UDP
* send TRAP notification
* to a Manager at 195.218.195.228:162
* to a Manager at 104.236.166.95:162
* with TRAP ID 'warmStart' specified as an OID
* include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
@ -46,7 +46,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-nms',
udp.domainName, ('195.218.195.228', 162),
udp.domainName, ('104.236.166.95', 162),
'my-creds',
tagList='all-my-managers'
)

View File

@ -9,12 +9,12 @@ Send a SNMP GET request with the following options:
* contextEngineId: 0x80004fb805636c6f75644dab22cc,
* contextName: da761cfc8c94d3aceef4f60f049105ba
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in tuple form
This script performs similar to the following Net-SNMP command:
| $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -E 80004fb805636c6f75644dab22cc -n da761cfc8c94d3aceef4f60f049105ba -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0
| $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -E 80004fb805636c6f75644dab22cc -n da761cfc8c94d3aceef4f60f049105ba -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.1.0
"""#
from pysnmp.entity import engine, config
@ -49,7 +49,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,13 +6,13 @@ Send a SNMP GET request:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* wait 3 seconds for response, retry 5 times (plus one initial attempt)
* for an OID in tuple form
This script performs similar to the following Net-SNMP command:
| $ snmpget -v2c -c public -ObentU -r 5 -t 1 195.218.195.228 1.3.6.1.2.1.1.1.0
| $ snmpget -v2c -c public -ObentU -r 5 -t 1 104.236.166.95 1.3.6.1.2.1.1.1.0
"""#
from pysnmp.entity import engine, config
@ -45,7 +45,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds',
timeout=300, # in 1/100 sec
retryCount=5

View File

@ -6,14 +6,14 @@ Send a series of SNMP GETBULK requests with the following options:
* with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* with values non-repeaters = 1, max-repetitions = 25
* for two OIDs in tuple form (first OID is non-repeating)
* stop on end-of-mib condition for both OIDs
This script performs similar to the following Net-SNMP command:
| $ snmpbulkwalk -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 -C n1 -C r25 -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
| $ snmpbulkwalk -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 -C n1 -C r25 -ObentU 104.236.166.95 1.3.6.1.2.1.1 1.3.6.1.4.1.1
"""#
from pysnmp.entity import engine, config
@ -48,7 +48,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -5,14 +5,14 @@ Bulk walk MIB
Send a series of SNMP GETBULK requests
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* with values non-repeaters = 0, max-repetitions = 25
* for two OIDs in tuple form
* stop on end-of-mib condition for both OIDs
This script performs similar to the following Net-SNMP command:
| $ snmpbulkwalk -v2c -c public -C n0 -C r25 -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
| $ snmpbulkwalk -v2c -c public -C n0 -C r25 -ObentU 104.236.166.95 1.3.6.1.2.1.1 1.3.6.1.4.1.1
"""#
from pysnmp.entity import engine, config
@ -45,7 +45,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,13 +6,13 @@ Send a series of SNMP GETNEXT requests with the following options:
* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for two OIDs in tuple form
* stop on end-of-mib condition for both OIDs
This script performs similar to the following Net-SNMP command:
| $ snmpwalk -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
| $ snmpwalk -v1 -c public -ObentU 104.236.166.95 1.3.6.1.2.1.1 1.3.6.1.4.1.1
"""#
from pysnmp.entity import engine, config
@ -56,7 +56,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,13 +6,13 @@ Send a series of SNMP GETNEXT requests with the following options:
* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for two OIDs in tuple form
* stop on end-of-mib condition for both OIDs
This script performs similar to the following Net-SNMP command:
| $ snmpwalk -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
| $ snmpwalk -v1 -c public -ObentU 104.236.166.95 1.3.6.1.2.1.1 1.3.6.1.4.1.1
"""#
from pysnmp.entity import engine, config
@ -45,7 +45,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,7 +6,7 @@ Send SNMP GET request with the following options:
* with SNMPv3 with user 'usr-sha-aes', SHA auth and AES128 privacy protocols
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in tuple form
* also registers its own execution observer to snmpEngine
@ -15,7 +15,7 @@ as seen by rfc3412.sendPdu() and rfc3412.receiveMessage() abstract interfaces.
This script performs similar to the following Net-SNMP command:
| $ snmpget -v3 -l authPriv -u usr-sha-aes -a SHA -A authkey1 -x AES -X privkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0
| $ snmpget -v3 -l authPriv -u usr-sha-aes -a SHA -A authkey1 -x AES -X privkey1 -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.1.0
"""#
from pysnmp.entity import engine, config
@ -74,7 +74,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -5,13 +5,13 @@ Pull MIB subtree
Send a series of SNMP GETNEXT requests
* with SNMPv3 with user 'usr-none-none', no auth and no privacy protocols
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in string form
* stop whenever received OID goes out of initial prefix (it may be a table)
This script performs similar to the following Net-SNMP command:
| $ snmpwalk -v3 -l noAuthNoPriv -u usr-none-none -ObentU 195.218.195.228:161 1.3.6.1.2.1.1
| $ snmpwalk -v3 -l noAuthNoPriv -u usr-none-none -ObentU 104.236.166.95:161 1.3.6.1.2.1.1
"""#
from pysnmp.entity import engine, config
@ -48,7 +48,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,14 +6,14 @@ Send a series of SNMP GETNEXT requests with the following options:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* sending packets from primary local interface 0.0.0.0, local port 61024
* for two OIDs in tuple form
* stop on end-of-mib condition for both OIDs
This script performs similar to the following Net-SNMP command:
| $ snmpwalk -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
| $ snmpwalk -v2c -c public -ObentU 104.236.166.95 1.3.6.1.2.1.1 1.3.6.1.4.1.1
"""#
from pysnmp.entity import engine, config
@ -46,7 +46,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,12 +6,12 @@ Send SNMP SET request with the following options:
* with SNMPv1 with community name 'private'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for OIDs in tuple form and an integer and string-typed values
This script performs similar to the following Net-SNMP command:
| $ snmpset -v1 -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123
| $ snmpset -v1 -c private -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123
"""#
from pysnmp.entity import engine, config
@ -45,7 +45,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -5,13 +5,13 @@ Spoof source address
Send a SNMP GET request
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95: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
| $ snmpget -v2c -c public -ObentU 104.236.166.95 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.
@ -65,7 +65,7 @@ config.addTransport(
# Configure destination IPv4 address as well as source IPv4 address
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds',
sourceAddress=('1.2.3.4', 0)
)

View File

@ -5,12 +5,12 @@ SNMPv3, auth: SHA, privacy: AES128
Send a SNMP GET request
* with SNMPv3 with user 'usr-sha-aes', SHA auth and AES128 privacy protocols
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in tuple form
This script performs similar to the following Net-SNMP command:
| $ snmpget -v3 -l authPriv -u usr-sha-aes -a SHA -A authkey1 -x AES -X privkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0
| $ snmpget -v3 -l authPriv -u usr-sha-aes -a SHA -A authkey1 -x AES -X privkey1 -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.1.0
"""#
from pysnmp.entity import engine, config
@ -45,7 +45,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -6,12 +6,12 @@ Send a SNMP SET request with the following options:
* with SNMPv3 with user 'usr-sha-none', SHA auth and no privacy protocols
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in tuple form and a string-typed value
This script performs similar to the following Net-SNMP command:
| $ snmpset -v3 -l authNoPriv -u usr-sha-none -a SHA -A authkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my new value'
| $ snmpset -v3 -l authNoPriv -u usr-sha-none -a SHA -A authkey1 -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.9.1.3.1 s 'my new value'
"""#
from pysnmp.entity import engine, config
@ -46,7 +46,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -4,12 +4,12 @@ SNMPv1
* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in tuple form
This script performs similar to the following Net-SNMP command:
| $ snmpget -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1.1.0
| $ snmpget -v1 -c public -ObentU 104.236.166.95 1.3.6.1.2.1.1.1.0
"""#
from pysnmp.entity import engine, config
@ -42,7 +42,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -5,12 +5,12 @@ Set scalar value
Send a SNMP SET request
* with SNMPv2c with community name 'private'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* to an Agent at 104.236.166.95:161
* for an OID in tuple form and an integer-typed value
This script performs similar to the following Net-SNMP command:
| $ snmpset -v2c -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.4.1 t 123
| $ snmpset -v2c -c private -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.9.1.4.1 t 123
"""#
from pysnmp.entity import engine, config
@ -44,7 +44,7 @@ config.addTransport(
)
config.addTargetAddr(
snmpEngine, 'my-router',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'my-creds'
)

View File

@ -8,7 +8,7 @@ messages to distant SNMPv1/2c Agent over UDP/IPv4 transport:
* with local SNMPv2c community 'public'
* local Agent listening at [::1]:161
* remote SNMPv2c community 'public'
* remote Agent listening at 195.218.195.228:161
* remote Agent listening at 104.236.166.95:161
This script can be queried with the following Net-SNMP command:
@ -16,7 +16,7 @@ This script can be queried with the following Net-SNMP command:
due to proxy, it is equivalent to
| $ snmpget -v2c -c public 195.218.195.228:161 sysDescr.0
| $ snmpget -v2c -c public 104.236.166.95:161 sysDescr.0
Warning: for production operation you would need to modify this script
so that it will re-map possible duplicate request-ID values, coming in
@ -81,7 +81,7 @@ config.addTargetParams(
)
config.addTargetAddr(
snmpEngine, 'distant-agent',
udp.domainName, ('195.218.195.228', 161),
udp.domainName, ('104.236.166.95', 161),
'distant-agent-auth', retryCount=0, tagList='remote'
)

View File

@ -8,7 +8,7 @@ Act as a local SNMPv2c Agent, relay messages to distant SNMPv1 Agent:
* with local SNMPv2c community public
* local Agent listening at 127.0.0.1:161
* remote SNMPv1, community public
* remote Agent listening at 195.218.195.228:161
* remote Agent listening at 104.236.166.95:161
This script can be queried with the following Net-SNMP command:
@ -16,7 +16,7 @@ This script can be queried with the following Net-SNMP command:
due to proxy, it is equivalent to
| $ snmpwalk -v1 -c public 195.218.195.228:161 system
| $ snmpwalk -v1 -c public 104.236.166.95:161 system
Warning: for production operation you would need to modify this script
so that it will re-map possible duplicate request-ID values, coming in
@ -80,7 +80,7 @@ config.addTargetParams(snmpEngine, 'distant-agent-auth', 'distant-area',
config.addTargetAddr(
snmpEngine, 'distant-agent',
udp.domainName + (2,), ('195.218.195.228', 161),
udp.domainName + (2,), ('104.236.166.95', 161),
'distant-agent-auth', retryCount=0, tagList='distant'
)

View File

@ -7,7 +7,7 @@ Act as a local SNMPv1/v2c Agent, relay messages to distant SNMPv3 Agent:
* with local SNMPv2c community 'public'
* local Agent listening at 127.0.0.1:161
* remote SNMPv3 user usr-md5-none, MD5 auth and no privacy protocols
* remote Agent listening at 195.218.195.228:161
* remote Agent listening at 104.236.166.95:161
This script can be queried with the following Net-SNMP command:
@ -15,7 +15,7 @@ This script can be queried with the following Net-SNMP command:
due to proxy, it is equivalent to
| $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0
| $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -ObentU 104.236.166.95:161 1.3.6.1.2.1.1.1.0
Warning: for production operation you would need to modify this script
so that it will re-map possible duplicate request-ID values, coming in
@ -80,7 +80,7 @@ config.addTargetParams(
)
config.addTargetAddr(
snmpEngine, 'distant-agent',
udp.domainName + (2,), ('195.218.195.228', 161),
udp.domainName + (2,), ('104.236.166.95', 161),
'distant-agent-auth', retryCount=0
)

View File

@ -7,7 +7,7 @@ Act as a local SNMPv3 Agent, relay messages to distant SNMPv1/v2c Agent:
* with local SNMPv3 user usr-md5-des, MD5 auth and DES privacy protocols
* local Agent listening at 127.0.0.1:161
* remote SNMPv1, community public
* remote Agent listening at 195.218.195.228:161
* remote Agent listening at 104.236.166.95:161
This script can be queried with the following Net-SNMP command:
@ -15,7 +15,7 @@ This script can be queried with the following Net-SNMP command:
due to proxy, it is equivalent to
| $ snmpget -v2c -c public 195.218.195.228:161 1.3.6.1.2.1.1.1.0
| $ snmpget -v2c -c public 104.236.166.95:161 1.3.6.1.2.1.1.1.0
Warning: for production operation you would need to modify this script
so that it will re-map possible duplicate request-ID values, coming in
@ -83,7 +83,7 @@ config.addTargetParams(snmpEngine, 'distant-agent-auth', 'my-area',
config.addTargetAddr(
snmpEngine, 'distant-agent',
udp.domainName + (2,), ('195.218.195.228', 161),
udp.domainName + (2,), ('104.236.166.95', 161),
'distant-agent-auth', retryCount=0
)