MCPcopy Index your code
hub / github.com/secdev/scapy / snmpwalk

Function snmpwalk

scapy/layers/snmp.py:290–304  ·  view source on GitHub ↗
(dst, oid="1", community="public")

Source from the content-addressed store, hash-verified

288
289
290def snmpwalk(dst, oid="1", community="public"):
291 try:
292 while True:
293 r = sr1(IP(dst=dst) / UDP(sport=RandShort()) / SNMP(community=community, PDU=SNMPnext(varbindlist=[SNMPvarbind(oid=oid)])), timeout=2, chainCC=1, verbose=0, retry=2) # noqa: E501
294 if r is None:
295 print("No answers")
296 break
297 if ICMP in r:
298 print(repr(r))
299 break
300 print("%-40s: %r" % (r[SNMPvarbind].oid.val, r[SNMPvarbind].value))
301 oid = r[SNMPvarbind].oid
302
303 except KeyboardInterrupt:
304 pass

Callers

nothing calls this directly

Calls 7

sr1Function · 0.90
IPClass · 0.90
UDPClass · 0.90
RandShortClass · 0.90
SNMPClass · 0.85
SNMPnextClass · 0.85
SNMPvarbindClass · 0.85

Tested by

no test coverage detected