class Metadata(Packet): name = "Metadata" fields_desc = [ XByteField("metadata_id", 1), XByteField("test", 1), XByteField("port", 1) ]
class VxLAN(Packet): """Define the vxlan protocol for the packet analysis.""" name = "vxlan" fields_desc = [ XByteField("flags", 0x08), BitField("reserved", 0, 24), BitField("vni", 0, 24), XByteField("reserved", 0x00) ]
class UsageReport(Tag): name = 'Tag - UsageReport' fields_desc = [ LenField('len', None), XByteField('tag', 0x01), XByteField('unknown', None), StrLenField('data', None, length_from=lambda pkt: pkt.len - 2) ]
class VxLANGPE(Packet): """Define the vxlan-gpe protocol for the packet analysis.""" name = "vxlan-gpe" fields_desc = [ XByteField("flags", 0x0c), ShortField("reserved", 0), XByteField("nextproto", 0x3), BitField("vni", 0, 24), XByteField("reserved", 0x0) ]
class P4inc(Packet): name = "P4inc" fields_desc = [ StrFixedLenField("P", "P", length=1), # P StrFixedLenField("Four", "4", length=1), # 4 XByteField("version", 0x01), # version XByteField("bos", 0x00), # bottom of stack, last packet 0/1 IntField("data", 0), # data packet IntField("result", 112) ] # aggregated data
class P4inc(Packet): name = "P4inc" fields_desc = [ StrFixedLenField("P", "P", length=1), # P StrFixedLenField("Four", "4", length=1), # 4 XByteField("version", 0x01), # version XByteField("bos", 0x00), IntField("data", 0), IntField("result", 0) ]
class FlashAirUpdateHeader(Packet): name = "FlashAir Update Header" fields_desc = [StrFixedLenEnumField("card", "FLASHAIR", 8, UPDATE_HEADER_TYPES), # 'name' is not a valid Scapy field name StrFixedLenField("type", "MAIN2", 8), StrFixedLenField("unk0", "\x01\x02\x03\x04", 4), XShortField("unk1", 0), XIntField("unk2", 0), XByteField("checksum", 0), XByteField("unk3", 0), LEIntField("length", 0), ]
class NSH(Packet): """Define the NSH protocol for the packet analysis.""" name = "nsh" fields_desc = [ XBitField("flags", 0x0, 10), XBitField("length", 0x6, 6), XByteField("MDtype", 0x1), XByteField("nextproto", 0x3), IntField("nsp_nsi", 0), IntField("c1", 0), IntField("c2", 0), IntField("c3", 0), IntField("c4", 0) ]
class CodingHdrS(Packet): global payload_size fields_desc = [ XByteField("num_switch_stats", 0x01), StrFixedLenField("P", "P", length=1), StrFixedLenField("Four", "4", length=1), XByteField("version", 0x01), XByteField("stream_id", 0x01), XByteField("packet_todo", 0x01), StrFixedLenField("packet_contents", ' ', length=1), IntField("coded_packets_batch_num", 0), StrFixedLenField("packet_payload", ' ' * (payload_size / 8), length=payload_size / 8) ]
class switchml(Packet): """ Switchml Header. """ name = "switchml" fields_desc = [ BitField('msg_type', 0, 4), BitField('sign_packet_flag', 0, 1), BitField('size', 0, 3), ByteField('job_id', 0), BitField('tsi', 0, 32), XByteField('pool_index', 0), BitField('k', 1, 8), XByteField("packet_id", 0), # ++ ByteField("packet_type", 4) # CONSUME0 : 4 ]
class Padding(Packet): fields_desc = [ FieldListField('padding', None, XByteField('x', 0), count_from=lambda p: 2) ]
class ExtendedBroadcastData(Packet): fields_desc = [ XByteField('extended', 0x80), XShortField('device_number', 0), ByteEnumField('device_type', 0, ENUM_DEVICE_TYPE), # ByteField('transmission_type', 0), BitEnumField( 'channel_type', 0, 2, { 0: 'RESERVED', 1: 'INDEPENDENT', 2: 'SHARED 1-BYTE ADDR', 3: 'SHARED 2-BYTE ADDR', }, ), BitEnumField('global_data', 0, 1, { 0: 'NOT USED', 1: 'USED' }), BitField('undefined', 0, 1), BitField('ext_serial_number', 0, 4), ]
class UDP(Packet): name = "UDP" fields_desc = [ ShortEnumField("sport", 53, UDP_SERVICES), #standard UDP ShortEnumField("dport", 53, UDP_SERVICES), ShortField("len", None), XShortField("chksum", None), XByteField("ack",0), #Acknowlegment number - 8bit X3BytesField("pkg",1)] #pakcage number -24 bit
class RadioEvent(Tag): name = 'Tag - RadioEvent' fields_desc = [ LenField('len', None), XByteField('tag', 0x00), StrLenField('message', None, length_from=lambda pkt: pkt.len - 1) ]
class DisableFaults(Tag): name = 'Tag - DisableFaults' fields_desc = [ LenField('len', None), XByteField('tag', 0x04), ShortField('comms', 0), ShortField('volts12', 0) ]
class CodingHdrR(Packet): global payload_size fields_desc = [ XByteField("num_switch_stats", 0x0), PacketListField("swtraces", [], SwitchStatsHdr, count_from=lambda pkt: (pkt.num_switch_stats * 1)), StrFixedLenField("P", "P", length=1), StrFixedLenField("Four", "4", length=1), XByteField("version", 0x01), XByteField("stream_id", 0x01), XByteField("packet_todo", 0x01), StrFixedLenField("packet_contents", ' ', length=1), IntField("coded_packets_batch_num", 0), StrFixedLenField("packet_payload", ' ' * (payload_size / 8), length=payload_size / 8) ]
class P4calc(Packet): name = "P4calc" fields_desc = [ StrFixedLenField("P", "P", length=1), StrFixedLenField("Four", "4", length=1), XByteField("version", 0x01), StrFixedLenField("op", "+", length=1), IntField("operand_a", 0), IntField("operand_b", 0), IntField("result", 0xDEADBABE)]
class RailFaults(Tag): name = 'Tag - RailFaults' fields_desc = [ LenField('len', None), XByteField('tag', 0x05), ShortField('volts6', 0), ShortField('volts5', 0), ShortField('volts3_3', 0) ]
class StdOut(Tag): name = 'Tag - StdOut' fields_desc = [ LenField('len', None), XByteField('tag', 0x0b), IEEEFloatField('timestamp', 0.0), ShortField('seqnum', 0), StrLenField('message', '', length_from=lambda pkt: pkt.len - 7), ]
class P4kway(Packet): name = "p4kway" fields_desc = [ StrFixedLenField("P", "P", length=1), StrFixedLenField("Four", "4", length=1), XByteField("version", 0x01), StrFixedLenField("type", "F", length=1), BitField("k", 0, 8), XShortField("v", 0), BitField("cache", 0, 8), ]
class P4tcp(Packet): name = "P4tcp" fields_desc = [ StrFixedLenField("P", "P", length=1), StrFixedLenField("Four", "4", length=1), XByteField("version", 0x01), StrFixedLenField("packetType", "D", length=1), StrFixedLenField("srcPort", "0", length=2), StrFixedLenField("dstPort", "0", length=2), IntField("seqNo", 0), IntField("ackNo", 0), StrFixedLenField("dataPayload", "", length=PAYLOAD_LENGTH)]
class HRMPayload(OptionalExtended): fields_desc = [ BitField('page_change_toggle', 0, 1), BitField('data_page_number', None, 7), # ignore differences between page types FieldListField('data', None, XByteField('x', 0), count_from=lambda p: 5), ByteField('beat_count', 0), ByteField('heart_rate', 0), ]
class OpenFlowQueueProprieties_v1_3(Packet): """ OpenFlow Queue Properties Field """ name = 'OpenFlowBucket_v1_3' fields_desc = [ ShortField('Property', None), ShortField('Length', None), XByteField('Pad', None), ]
class ActionDescriptorField_v1_3(Packet): """ OpenFlow Action Descriptor Field """ name = 'ActionDescriptorField_v1_3' fields_desc = [ ShortField('Type', None), ShortField('Length', None), XByteField('Pad', None), ]
class Date(Tag): # 0x0f fields_desc = [ LenField('len', None, fmt='B'), XByteField('tag', None), IntField('microseconds', None), ByteField('second', None), ByteField('minute', None), ByteField('hour', None), ByteField('day', None), ByteField('month', None), ByteField('year', None), ]
class CadencePayload(Packet): fields_desc = [ BitField('page_change_toggle', 0, 1), BitField('data_page_number', None, 7), # ignore differences between page types FieldListField('data', None, XByteField('x', 0), count_from=lambda p: 3), LEShortField('cadence_event_time', 0), LEShortField('cadence_rev_count', 0), ]
class PortDescriptorField_v1_3(Packet): """ OpenFlow Port Descriptor Field """ name = 'PortDescriptorField_v1_3' fields_desc = [ ShortField('<PortNumber>', None), XByteField('PortDescriptorFieldPad', None), MACField('EthernetAddress', None), XByteField('PortDescriptorFieldPad2', None), StrFixedLenField('Name', None, 16), XIntField('<PortConfigurationFlags>', None), XIntField('<PortStatusFlags>', None), XIntField('Current<PortFeatureFlags>', None), XIntField('Advertising<PortFeatureFlags>', None), XIntField('Supported<PortFeatureFlags>', None), XIntField('PeerAdvertising<PortFeatureFlags>', None), IntField('CurrentSpeed', None), IntField('MaxSpeed', None), ]
class VersionInfo(Tag): name = 'Tag - VersionInfo' fields_desc = [ LenField('len', None), XByteField('tag', 0x0a), ByteField('type', None), XShortField('unknown', None), ByteField('id', None), FieldLenField('name_len', None, fmt='B', length_of='name'), StrLenField('name', None, length_from=lambda pkt: pkt.name_len), FieldLenField('ver_len', None, fmt='B', length_of='version'), StrLenField('version', None, length_from=lambda pkt: pkt.ver_len) ]
class FlowMatchDescriptorField_v1_0(Packet): """ OpenFlow Flow Match Descriptor Field """ name = 'FlowMatchDescriptorField_v1_0' fields_desc = [ IntField('<FlowWildcard>', None), ShortField('Ingresss<PortNumber>', None), SourceMACField(MACField('EthernetSourceAddress', None)), DestMACField(MACField('EthernetDestinationAddress', None)), XShortField('<VD+802.1QVID>', None), XByteField('PCP', None), XByteField('Reserved', None), ShortField('EthernetType/Length', None), ByteField('IPv4Protocol', None), X3BytesField('_Reserved', None), SourceIPField('IPv4SourceAddress', None), IPField('IPv4DestinationAddress', None), ShortField('SourcePort', None), ShortField('DestinationPort', None), ]
class TWAMPTestResponse(Packet): """A packet representing a TWAMP response""" name = "TWAMPResponse" fields_desc = [ IntField("SequenceNumber", 0), LongField("TransmitCounter", 0), BitField("X", 0, 1), BitField("B", 0, 1), BitField("MBZ", 0, 6), XByteField("BlockNumber", 0), ShortField("MBZ", 0), LongField("ReceiveCounter", 0), IntField("SenderSequenceNumber", 0), LongField("SenderCounter", 0), BitField("X2", 0, 1), BitField("B2", 0, 1), BitField("MBZ", 0, 6), XByteField("SenderBlockNumber", 0), XByteField("MBZ", 0), ByteEnumField("ReceverControlCode", 0, {1: "Error - Invalid Message"}), XByteField("SenderTTL", 0) ] # manca il padding