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''))
hln = 6
hrd = 1
op = 1
pln = 4
pro = 2048
sha = b''
sha_s
spa = b''
spa_s
tha = b''
tha_s
tpa = b''
tpa_s

cdp Module

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'>))
v = 0
class pypacker.layer12.dtp.TV(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('t', 'H', 0), ('len', 'H', 0))
len = 0
t = 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

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

Custom bin(): handle padding for Ethernet.

dst = b'\xff\xff\xff\xff\xff\xff'
dst_s
padding
src = b'\xff\xff\xff\xff\xff\xff'
src_s
type = 2048
vlan = None

ieee80211 Module

IEEE 802.11

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

Bases: pypacker.pypacker.Packet

class ACK(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'),)
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
class IEEE80211.AssocReq(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('capa', 'H', 0), ('interval', 'H', 0), ('params', None, <class 'pypacker.triggerlist.TriggerList'>))
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
capa = 0
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
interval = 0
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.AssocResp(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('capa', 'H', 0), ('status', 'H', 0), ('aid', 'H', 0), ('params', None, <class 'pypacker.triggerlist.TriggerList'>))
aid = 0
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
capa = 0
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
status = 0
class IEEE80211.Auth(*args, **kwargs)

Bases: pypacker.pypacker.Packet

Authentication request.

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('algo', 'H', 0), ('seq', 'H', 256), ('status', 'H', 0))
algo = 0
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
seq = 256
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
status = 0
class IEEE80211.Beacon(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('_ts', 'Q', 0), ('interval', 'H', 25600), ('capa', 'H', 256), ('params', None, <class 'pypacker.triggerlist.TriggerList'>))
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
capa = 256
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
interval = 25600
seq
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
ts
class IEEE80211.BlockAck(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('reqctrl', 'H', 0), ('seq', 'H', 0), ('bitmap', 'Q', 0))
bitmap = 0
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
reqctrl = 0
seq = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.BlockAckReq(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('reqctrl', 'H', 0), ('seq', 'H', 0))
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
reqctrl = 0
seq = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.CF(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'B', 0), ('len', 'B', 0), ('count', 'B', 0), ('period', 'B', 0), ('max', 'H', 0), ('dur', 'H', 0))
count = 0
dur = 0
id = 0
len = 0
max = 0
period = 0
class IEEE80211.CTS(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'),)
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
class IEEE80211.DS(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'B', 0), ('len', 'B', 0), ('ch', 'B', 0))
ch = 0
id = 0
len = 0
class IEEE80211.Dataframe(*arg, **kwargs)

Bases: pypacker.pypacker.Packet

DataFrames need special care: there are too many types of field combinations to create classes for everyone. Solution: initiate giving lower type via constructor.

__hdr__ = (('addr1', '6s', b'\x00\x00\x00\x00\x00\x00'), ('addr2', '6s', b'\x00\x00\x00\x00\x00\x00'), ('addr3', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('addr4', '6s', None), ('qos_ctrl', 'H', 0), ('sec_param', 'Q', 0))
addr1 = b'\x00\x00\x00\x00\x00\x00'
addr2 = b'\x00\x00\x00\x00\x00\x00'
addr3 = b'\x00\x00\x00\x00\x00\x00'
addr4 = None
bssid
bssid_s
dst
dst_s
qos_ctrl = 0
sec_param = 0
seq_frag = 0
src
src_s
class IEEE80211.Deauth(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('reason', 'H', 0))
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
reason = 0
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.Disassoc(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('reason', 'H', 0))
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
reason = 0
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.FH(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'B', 0), ('len', 'B', 0), ('tu', 'H', 0), ('hopset', 'B', 0), ('hoppattern', 'B', 0), ('hopindex', 'B', 0))
hopindex = 0
hoppattern = 0
hopset = 0
id = 0
len = 0
tu = 0
class IEEE80211.IBSS(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'B', 0), ('len', 'B', 0), ('atim', 'H', 0))
atim = 0
id = 0
len = 0
class IEEE80211.IE(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'B', 0), ('len', 'B', 0))
id = 0
len = 0
IEEE80211.IE_CF = 4
IEEE80211.IE_DS = 3
IEEE80211.IE_ESR = 50
IEEE80211.IE_FH = 2
IEEE80211.IE_HT_CAPA = 45
IEEE80211.IE_HT_INFO = 61
IEEE80211.IE_IBSS = 6
IEEE80211.IE_RATES = 1
IEEE80211.IE_SSID = 0
IEEE80211.IE_TIM = 5
class IEEE80211.ProbeReq(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('params', None, <class 'pypacker.triggerlist.TriggerList'>))
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.ProbeResp(*args, **kwargs)

Bases: pypacker.layer12.ieee80211.Beacon

bssid = b'\x00\x00\x00\x00\x00\x00'
capa = 256
dst = b'\x00\x00\x00\x00\x00\x00'
interval = 25600
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
class IEEE80211.RTS(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'))
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.ReassocReq(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('dst', '6s', b'\x00\x00\x00\x00\x00\x00'), ('bssid', '6s', b'\x00\x00\x00\x00\x00\x00'), ('src', '6s', b'\x00\x00\x00\x00\x00\x00'), ('seq_frag', 'H', 0), ('capa', 'H', 0), ('interval', 'H', 0), ('current_ap', '6s', b'\x00\x00\x00\x00\x00\x00'))
bssid = b'\x00\x00\x00\x00\x00\x00'
bssid_s
capa = 0
current_ap = b'\x00\x00\x00\x00\x00\x00'
dst = b'\x00\x00\x00\x00\x00\x00'
dst_s
interval = 0
seq_frag = 0
src = b'\x00\x00\x00\x00\x00\x00'
src_s
class IEEE80211.TIM(*args, **kwargs)

Bases: pypacker.pypacker.Packet

__hdr__ = (('id', 'B', 0), ('len', 'B', 0), ('count', 'B', 0), ('period', 'B', 0), ('ctrl', 'H', 0))
count = 0
ctrl = 0
id = 0
len = 0
period = 0
IEEE80211.__hdr__ = (('framectl', 'H', 0), ('duration', 'H', 0))
IEEE80211.c_decoder = {8: <class 'pypacker.layer12.ieee80211.IEEE80211.BlockAckReq'>, 9: <class 'pypacker.layer12.ieee80211.IEEE80211.BlockAck'>, 11: <class 'pypacker.layer12.ieee80211.IEEE80211.RTS'>, 12: <class 'pypacker.layer12.ieee80211.IEEE80211.CTS'>, 13: <class 'pypacker.layer12.ieee80211.IEEE80211.ACK'>}
IEEE80211.d_decoder = {0: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 1: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 2: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 3: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 4: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 5: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 6: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 7: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 8: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 9: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 10: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 11: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 12: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>, 14: <class 'pypacker.layer12.ieee80211.IEEE80211.Dataframe'>}
IEEE80211.duration = 0
IEEE80211.framectl = 0
IEEE80211.from_ds
IEEE80211.from_to_ds
IEEE80211.ie_decoder = {0: <class 'pypacker.layer12.ieee80211.IEEE80211.IE'>, 1: <class 'pypacker.layer12.ieee80211.IEEE80211.IE'>, 2: <class 'pypacker.layer12.ieee80211.IEEE80211.FH'>, 3: <class 'pypacker.layer12.ieee80211.IEEE80211.DS'>, 4: <class 'pypacker.layer12.ieee80211.IEEE80211.CF'>, 5: <class 'pypacker.layer12.ieee80211.IEEE80211.TIM'>, 6: <class 'pypacker.layer12.ieee80211.IEEE80211.IBSS'>, 61: <class 'pypacker.layer12.ieee80211.IEEE80211.IE'>, 45: <class 'pypacker.layer12.ieee80211.IEEE80211.IE'>, 50: <class 'pypacker.layer12.ieee80211.IEEE80211.IE'>}
IEEE80211.m_decoder = {0: <class 'pypacker.layer12.ieee80211.IEEE80211.AssocReq'>, 1: <class 'pypacker.layer12.ieee80211.IEEE80211.AssocResp'>, 2: <class 'pypacker.layer12.ieee80211.IEEE80211.ReassocReq'>, 3: <class 'pypacker.layer12.ieee80211.IEEE80211.AssocResp'>, 4: <class 'pypacker.layer12.ieee80211.IEEE80211.ProbeReq'>, 5: <class 'pypacker.layer12.ieee80211.IEEE80211.ProbeResp'>, 8: <class 'pypacker.layer12.ieee80211.IEEE80211.Beacon'>, 10: <class 'pypacker.layer12.ieee80211.IEEE80211.Disassoc'>, 11: <class 'pypacker.layer12.ieee80211.IEEE80211.Auth'>, 12: <class 'pypacker.layer12.ieee80211.IEEE80211.Deauth'>}
IEEE80211.more_data
IEEE80211.more_frag
IEEE80211.order
IEEE80211.protected
IEEE80211.pwr_mgt
IEEE80211.retry
IEEE80211.subtype
IEEE80211.to_ds
IEEE80211.type
IEEE80211.version
pypacker.layer12.ieee80211.val

alias of Dataframe

ieee80211_bak Module

llc Module

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

Bases: pypacker.pypacker.Packet

ppp Module

Point-to-Point Protocol.

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

Bases: pypacker.pypacker.Packet

__hdr__ = (('p', None, <class 'pypacker.triggerlist.TriggerList'>),)

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))
code = 0
len = 0
session = 0
type
v
v_type = 17

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))
id = 0
len = 0
status = 0
value = 0
class pypacker.layer12.prism.Prism(*args, **kwargs)

Bases: pypacker.pypacker.Packet

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

radiotap Module

Radiotap

class pypacker.layer12.radiotap.FlagTriggerList(lst=[], clz=None, packet=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', 2048), ('present_flags', 'I', 0), ('flags', None, <class 'pypacker.layer12.radiotap.FlagTriggerList'>))
bin()

Custom bin(): handle FCS.

fcs
len = 2048
pad = 0
present_flags = 0
version = 0
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))
age = 0
bridge_id = b''
fd = 0
flags = 0
hello = 0
max_age = 0
port_id = 0
proto_id = 0
root_id = b''
root_path = 0
type = 0
v = 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))
advtime = 0
atype = 0
bin()
count = 0
priority = 0
sum
type
v
vrid = 0
vtype = 33