From b89efa188810bf95a9d245e69e2961b5721c3b0f Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 21 Mar 2016 16:03:47 +0200 Subject: scapy python 2/3 --- .../scapy-2.3.1/python3/scapy/contrib/ppi.py | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ppi.py (limited to 'scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ppi.py') diff --git a/scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ppi.py b/scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ppi.py new file mode 100644 index 00000000..f4364096 --- /dev/null +++ b/scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ppi.py @@ -0,0 +1,86 @@ +## This file is (hopefully) part of Scapy +## See http://www.secdev.org/projects/scapy for more informations +## +## This program is published under a GPLv2 license + +# scapy.contrib.description = PPI +# scapy.contrib.status = loads + + +""" +PPI (Per-Packet Information). +""" +import logging,struct +from scapy.config import conf +from scapy.packet import * +from scapy.fields import * +from scapy.layers.l2 import Ether +from scapy.layers.dot11 import Dot11 + +# Dictionary to map the TLV type to the class name of a sub-packet +_ppi_types = {} +def addPPIType(id, value): + _ppi_types[id] = value +def getPPIType(id, default="default"): + return _ppi_types.get(id, _ppi_types.get(default, None)) + + +# Default PPI Field Header +class PPIGenericFldHdr(Packet): + name = "PPI Field Header" + fields_desc = [ LEShortField('pfh_type', 0), + FieldLenField('pfh_length', None, length_of="value", fmt='= 4: + t,pfh_len = struct.unpack(" pfh_len): + out.payload.payload = conf.padding_layer(p[pfh_len:]) + elif (len(p) > pfh_len): + out.payload = conf.padding_layer(p[pfh_len:]) + + else: + out = conf.raw_layer(p, **kargs) + return out + + + + +class PPI(Packet): + name = "PPI Packet Header" + fields_desc = [ ByteField('pph_version', 0), + ByteField('pph_flags', 0), + FieldLenField('pph_len', None, length_of="PPIFieldHeaders", fmt="