layer12 Package

arp Module

Address Resolution Protocol.

class pypacker.layer12.arp.ARP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('hrd', 'H', 1), ('pro', 'H', 2048), ('hln', 'B', 6), ('pln', 'B', 4), ('op', 'H', 1), ('sha', '6s', b''), ('spa', '4s', b''), ('tha', '6s', b''), ('tpa', '4s', b''))

cdp Module

Cisco Discovery Protocol.

class pypacker.layer12.cdp.CDP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('version', 'B', 2), ('ttl', 'B', 180), ('sum', 'H', 0))

dtp Module

Dynamic Trunking Protocol.

class pypacker.layer12.dtp.DTP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('v', 'B', 0), ('tvs', None, <class 'pypacker.triggerlist.TriggerList'>))
class pypacker.layer12.dtp.TV(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('t', 'H', 0), ('len', 'H', 0))

ethernet Module

Ethernet II, LLC (802.3+802.2), LLC/SNAP, and Novell raw 802.3, with automatic 802.1q, MPLS, PPPoE, and Cisco ISL decapsulation.

RFC 1042

class pypacker.layer12.ethernet.Ethernet(*args, **kwargs)

Bases: pypacker.pypacker.Packet

Convenient access for: dst[_s], src[_s]. VLAN-Tag can by accessed via ‘vlan’, header structure will be changed accordingly using fomrmat ‘H’. Disable using value ‘None’.

__hdr__ = (('dst', '6s', b'\xff\xff\xff\xff\xff\xff'), ('src', '6s', b'\xff\xff\xff\xff\xff\xff'), ('type', 'H', 2048))
bin()

Custom bin(): handle padding for Ethernet.

ieee80211 Module

IEEE 802.11

class pypacker.layer12.ieee80211.IEEE80211(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('framectl', 'H', 0), ('duration', 'H', 0))
classmethod unpack_ies(buf)

Parse IEs and return them as Triggerlist.

llc Module

class pypacker.layer12.llc.LLC(*args, **kwargs)

Bases: pypacker.pypacker.Packet

ospf Module

Open Shortest Path First.

class pypacker.layer12.ospf.OSPF(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('v', 'B', 0), ('type', 'B', 0), ('len', 'H', 0), ('router', 'I', 0), ('area', 'I', 0), ('_sum', 'H', 0), ('atype', 'H', 0), ('auth', '8s', b''))

ppp Module

Point-to-Point Protocol.

class pypacker.layer12.ppp.PPP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = ()

pppoe Module

PPP-over-Ethernet.

class pypacker.layer12.pppoe.PPPoE(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('v_type', 'B', 17), ('code', 'B', 0), ('session', 'H', 0), ('len', 'H', 0))

prism Module

Prism header. This packet type exists just for convenience. Radiotap should be prefered over prism because of its superior flexibility. Only use this if there is no support for Radiotap eg for some Broadcom-Chipsets (stop buying crap man).

class pypacker.layer12.prism.Did(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'I', 0), ('status', 'H', 0), ('len', 'H', 0), ('value', 'I', 0))
class pypacker.layer12.prism.Prism(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('code', 'I', 0), ('len', 'I', 144), ('dev', '16s', b''), ('dids', None, <class 'pypacker.triggerlist.TriggerList'>))

radiotap Module

Radiotap

class pypacker.layer12.radiotap.FlagTriggerList(lst=[], clz=None)

Bases: pypacker.triggerlist.TriggerList

class pypacker.layer12.radiotap.Radiotap(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('version', 'B', 0), ('pad', 'B', 0), ('len', 'H', 0), ('present_flags', 'I', 0), ('flags', None, <class 'pypacker.layer12.radiotap.FlagTriggerList'>))
pypacker.layer12.radiotap.get_channelinfo(channel_bytes)

return – [channel_mhz, channel_flags]

stp Module

Spanning Tree Protocol.

class pypacker.layer12.stp.STP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('proto_id', 'H', 0), ('v', 'B', 0), ('type', 'B', 0), ('flags', 'B', 0), ('root_id', '8s', b''), ('root_path', 'I', 0), ('bridge_id', '8s', b''), ('port_id', 'H', 0), ('age', 'H', 0), ('max_age', 'H', 0), ('hello', 'H', 0), ('fd', 'H', 0))

vrrp Module

Virtual Router Redundancy Protocol.

class pypacker.layer12.vrrp.VRRP(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('vtype', 'B', 33), ('vrid', 'B', 0), ('priority', 'B', 0), ('count', 'B', 0), ('atype', 'B', 0), ('advtime', 'B', 0), ('_sum', 'H', 0))