class OFPTPortStatus(_ofp_header): name = "OFPT_PORT_STATUS" fields_desc = [ByteEnumField("version", 0x01, ofp_version), ByteEnumField("type", 12, ofp_type), ShortField("len", None), IntField("xid", 0), ByteEnumField("reason", 0, {0: "OFPPR_ADD", 1: "OFPPR_DELETE", 2: "OFPPR_MODIFY"}), XBitField("pad", 0, 56), PacketField("desc", OFPPhyPort(), OFPPhyPort)] overload_fields = {TCP: {"dport": 6653}}
class PPP_LCP_Protocol_Reject(PPP_LCP): fields_desc = [ ByteEnumField("code", 8, _PPP_lcptypes), XByteField("id", 0), FieldLenField("len", None, fmt="H", length_of="rejected_information", adjust=lambda _, val: val + 6), ShortEnumField("rejected_protocol", None, _PPP_PROTOCOLS), PacketField("rejected_information", None, Packet), ]
class STDOBJREF(Packet): name = 'stdObjRef' fields_desc = [ LEIntEnumField('flags', 1, { 0: 'PINGING', 8: 'SORF_NOPING' }), LEIntField('cPublicRefs', 0), LELongField('OXID', 0), LELongField('OID', 0), PacketField('IPID', None, UUIDField), ]
class ResultElement(Packet): # p_result_list_t - DCE 1.1 RPC - p591 name = "p_result_t" fields_desc = [ ShortEnumField('resultContextNegotiation', 0, _defResult), ConditionalField(ShortEnumField('reason', 0, _defReason), lambda pkt: pkt.resultContextNegotiation != 0), PacketField('transferSyntax', '\x00' * 20, SyntaxId), ] def extract_padding(self, p): return b"", p
class PPP_LCP_Code_Reject(PPP_LCP): fields_desc = [ ByteEnumField("code", 7, _PPP_lcptypes), XByteField("id", 0), FieldLenField( "len", None, fmt="H", length_of="rejected_packet", # noqa: E501 adjust=lambda p, x: x + 4), PacketField("rejected_packet", None, PPP_LCP) ]
class IE_ULI(gtp.IE_Base): name = "IE User Location Information" fields_desc = [ ByteEnumField("ietype", 86, IEType), ShortField("length", 0), BitField("CR_flag", 0, 4), BitField("instance", 0, 4), BitField("SPARE", 0, 2), BitField("LAI_Present", 0, 1), BitField("ECGI_Present", 0, 1), BitField("TAI_Present", 0, 1), BitField("RAI_Present", 0, 1), BitField("SAI_Present", 0, 1), BitField("CGI_Present", 0, 1), ConditionalField(PacketField("CGI", 0, ULI_CGI), lambda pkt: bool(pkt.CGI_Present)), ConditionalField(PacketField("SAI", 0, ULI_SAI), lambda pkt: bool(pkt.SAI_Present)), ConditionalField(PacketField("RAI", 0, ULI_RAI), lambda pkt: bool(pkt.RAI_Present)), ConditionalField(PacketField("TAI", 0, ULI_TAI), lambda pkt: bool(pkt.TAI_Present)), ConditionalField(PacketField("ECGI", 0, ULI_ECGI), lambda pkt: bool(pkt.ECGI_Present)), ConditionalField(PacketField("LAI", 0, ULI_LAI), lambda pkt: bool(pkt.LAI_Present)), ]
class AOE(Packet): name = "ATA over Ethernet" fields_desc = [ BitField("version", 1, 4), FlagsField("flags", 0, 4, ["Response", "Error", "r1", "r2"]), ByteEnumField( "error", 0, { 1: "Unrecognized command code", 2: "Bad argument parameter", 3: "Device unavailable", 4: "Config string present", 5: "Unsupported exception", 6: "Target is reserved" }), XShortField("major", 0xFFFF), XByteField("minor", 0xFF), ByteEnumField( "cmd", 1, { 0: "Issue ATA Command", 1: "Query Config Information", 2: "Mac Mask List", 3: "Reserve / Release" }), XIntField("tag", 0), ConditionalField( PacketField("i_ata_cmd", IssueATACommand(), IssueATACommand), lambda x: x.cmd == 0), ConditionalField( PacketField("q_conf_info", QueryConfigInformation(), QueryConfigInformation), lambda x: x.cmd == 1), ConditionalField(PacketField("mac_m_list", MacMaskList(), MacMaskList), lambda x: x.cmd == 2), ConditionalField( PacketField("res_rel", ReserveRelease(), ReserveRelease), lambda x: x.cmd == 3) ] def extract_padding(self, s): return "", s
class OpcDaAlter_Context_RespLE(Packet): name = "OpcDaAlter_Context_RespLE" fields_desc = [ LEShortField('maxXmitFrag', 5840), LEShortField('maxRecvtFrag', 5840), LEIntField('assocGroupId', 0), PacketField('portSpec', '\x00\x00\x00\x00', LenStringPacketLE), LEIntField('numResult', 0), # PacketField('authentication', None, AuthentificationProtocol), ] # To complete def extract_padding(self, p): return b"", p
class KNXTunnelingRequest(Packet): name = "TUNNELING_REQUEST" fields_desc = [ ByteField("structure_length", 0x04), ByteField("communication_channel_id", 0x01), ByteField("sequence_counter", None), ByteField("reserved", None), PacketField("cemi", CEMI(), CEMI) ] def post_build(self, p, pay): p = (len(p[:4])).to_bytes(1, byteorder='big') + p[1:] return p + pay
class OFPTPacketOut(_ofp_header): name = "OFPT_PACKET_OUT" fields_desc = [ByteEnumField("version", 0x01, ofp_version), ByteEnumField("type", 13, ofp_type), ShortField("len", None), IntField("xid", 0), IntEnumField("buffer_id", "NO_BUFFER", ofp_buffer), ShortEnumField("in_port", "NONE", ofp_port_no), FieldLenField("actions_len", None, fmt="H", length_of="actions"), # noqa: E501 PacketListField("actions", [], OFPAT, ofp_action_cls, length_from=lambda pkt:pkt.actions_len), # noqa: E501 PacketField("data", None, Ether)]
class OFPTPacketIn(_ofp_header): name = "OFPT_PACKET_IN" fields_desc = [ByteEnumField("version", 0x01, ofp_version), ByteEnumField("type", 10, ofp_type), ShortField("len", None), IntField("xid", 0), IntEnumField("buffer_id", "NO_BUFFER", ofp_buffer), ShortField("total_len", 0), ShortEnumField("in_port", 0, ofp_port_no), ByteEnumField("reason", 0, {0: "OFPR_NO_MATCH", 1: "OFPR_ACTION"}), XByteField("pad", 0), PacketField("data", None, Ether)]
class SetConfiguration(RequestDescriptor): fields_desc = [ PacketField("bmRequestType", bmRequestType(direction=0), bmRequestType), ByteEnumField("bRequest", URBDefs.Request.SET_CONFIGURATION, URBDefs.Request.desc), ByteField("bConfigurationValue", 1), LEShortField("wIndex", 0), LEShortField("wLength", 0), ] def desc(self): return "SetConfiguration %u" % (self.bConfigurationValue, )
class OFPTStatsRequestAggregate(_ofp_header): name = "OFPST_STATS_REQUEST_AGGREGATE" fields_desc = [ByteEnumField("version", 0x01, ofp_version), ByteEnumField("type", 16, ofp_type), ShortField("len", None), IntField("xid", 0), ShortEnumField("stats_type", 2, ofp_stats_types), FlagsField("flags", 0, 16, []), PacketField("match", OFPMatch(), OFPMatch), ByteEnumField("table_id", "ALL", ofp_table), ByteField("pad", 0), ShortEnumField("out_port", "NONE", ofp_port_no)] overload_fields = {TCP: {"sport": 6653}}
class ContextElement(Packet): name = "context element" fields_desc = [ ShortField('contxtId', 0), ByteField('nbTransferSyn', 0), ByteField('reserved', 0), PacketField('abstractSyntax', None, SyntaxId), PacketListField('transferSyntax', None, SyntaxId, count_from=lambda pkt:pkt.nbTransferSyn), ] def extract_padding(self, p): return b"", p
class SYMLINK_Reply(Packet): name = 'SYMLINK Reply' fields_desc = [ IntEnumField('status', 0, nfsstat3), ConditionalField(IntField('handle_follows', 0), lambda pkt: pkt.status == 0), ConditionalField( PacketField('filehandle', File_Object(), File_Object), lambda pkt: pkt.status == 0 and pkt.handle_follows == 1), ConditionalField(IntField('attributes_follow', 0), lambda pkt: pkt.status == 0), ConditionalField( PacketField('attributes', Fattr3(), Fattr3), lambda pkt: pkt.status == 0 and pkt.attributes_follow == 1), IntField('af_before', 0), ConditionalField( PacketField('dir_attributes_before', WCC_Attr(), WCC_Attr), lambda pkt: pkt.af_before == 1), IntField('af_after', 0), ConditionalField(PacketField('dir_attributes_after', Fattr3(), Fattr3), lambda pkt: pkt.af_after == 1) ]
class PID_METATRAFFIC_MULTICAST_LOCATOR(PIDPacketBase): name = "PID_METATRAFFIC_MULTICAST_LOCATOR" fields_desc = [ EField( ParameterIdField("parameterId", 0), endianness=FORMAT_LE, endianness_from=None, ), EField(ShortField("parameterLength", 0), endianness=FORMAT_LE, endianness_from=None), PacketField("locator", "", LocatorPacket), ]
class ParticipantMessageDataPacket(EPacket): name = "Participant Message Data" fields_desc = [ PacketField("guidPrefix", "", GUIDPrefixPacket), XIntField("kind", 0), EField(XIntField("sequenceSize", 0)), # octets StrLenField( "serializedData", "", length_from=lambda x: x.sequenceSize * 4, max_length=STR_MAX_LEN, ), ]
class PID_ENDPOINT_GUID(PIDPacketBase): name = "PID_ENDPOINT_GUID" fields_desc = [ EField( ParameterIdField("parameterId", 0), endianness=FORMAT_LE, endianness_from=None, ), EField(ShortField("parameterLength", 0), endianness=FORMAT_LE, endianness_from=None), PacketField("guid", "", GUIDPacket), ]
class OCSPStatusRequest(Packet): """ This is the structure defined in RFC 6066, not in RFC 6960! """ name = "OCSPStatusRequest structure" fields_desc = [FieldLenField("respidlen", None, length_of="respid"), PacketListField("respid", [], ResponderID, length_from=lambda pkt: pkt.respidlen), FieldLenField("reqextlen", None, length_of="reqext"), PacketField("reqext", "", X509_Extensions)] def guess_payload_class(self, p): return Padding
class PPP_LCP_Protocol_Reject(PPP_LCP): fields_desc = [ ByteEnumField("code", 8, _PPP_lcptypes), XByteField("id", 0), FieldLenField( "len", None, fmt="H", length_of="rejected_information", # noqa: E501 adjust=lambda p, x: x + 6), ShortEnumField("rejected_protocol", None, _PPP_proto), PacketField("rejected_information", None, Packet) ]
class PID_REACHABILITY_LEASE_DURATION(PIDPacketBase): name = "PID_REACHABILITY_LEASE_DURATION" fields_desc = [ EField( ParameterIdField("parameterId", 0), endianness=FORMAT_LE, endianness_from=None, ), EField(ShortField("parameterLength", 0), endianness=FORMAT_LE, endianness_from=None), PacketField("lease_duration", "", LeaseDurationPacket), ]
class PID_PRODUCT_VERSION(PIDPacketBase): name = "PID_PRODUCT_VERSION" fields_desc = [ EField( ParameterIdField("parameterId", 0), endianness=FORMAT_LE, endianness_from=None, ), EField(ShortField("parameterLength", 0), endianness=FORMAT_LE, endianness_from=None), PacketField("productVersion", "", ProductVersionPacket), ]
class ACCESS_Reply(Packet): name = 'ACCESS Reply' fields_desc = [ IntEnumField('status', 0, nfsstat3), IntField('attributes_follow', 0), ConditionalField( PacketField('attributes', Fattr3(), Fattr3), lambda pkt: pkt.attributes_follow == 1 ), ConditionalField( XIntField('access_rights', 0), lambda pkt: pkt.status == 0 ) ]
class WRITE_Call(Packet): name = 'WRITE Call' fields_desc = [ PacketField('filehandle', File_Object(), File_Object), LongField('offset', 0), IntField('count', 0), IntEnumField('stable', 0, { 0: 'UNSTABLE', 1: 'STABLE' }), IntField('length', 0), StrLenField('contents', b'', length_from=lambda pkt: pkt.length), StrLenField('fill', b'', length_from=lambda pkt: (4 - pkt.length) % 4) ]
class KNXTunnelingRequest(Packet): name = "TUNNELING_REQUEST" fields_desc = [ ByteField("structure_length", 0x04), ByteField("communication_channel_id", 0x01), ByteField("sequence_counter", None), ByteField("reserved", None), PacketField("cemi", CEMI(), CEMI) ] def post_build(self, p, pay): if self.structure_length is None: p = struct.pack("!B", len(p[:4])) + p[1:] return p + pay
class ModifyQpIn(Packet): fields_desc = [ ShortField('opcode', 0), ShortField('uid', 0), ShortField('vhca_tunnel_id', 0), ShortField('op_mod', 0), ByteField('reserved2', 0), BitField('qpn', 0, 24), IntField('reserved3', 0), IntField('opt_param_mask', 0), IntField('ece', 0), PacketField('sw_qpc', SwQpc(), SwQpc), StrFixedLenField('reserved4', None, length=16), ]
class SAPCARCompressedBlockFormat(PacketNoPadded): """SAP CAR compressed block This is used for decompressing blocks inside the file info format. """ name = "SAP CAR Archive Compressed block" fields_desc = [ StrFixedLenField("type", SAPCAR_BLOCK_TYPE_COMPRESSED_LAST, 2), ConditionalField(PacketField("compressed", None, SAPCARCompressedBlobFormat), lambda x: x.type in [SAPCAR_BLOCK_TYPE_COMPRESSED_LAST, SAPCAR_BLOCK_TYPE_COMPRESSED]), ConditionalField(LESignedIntField("checksum", 0), lambda x: x.type == SAPCAR_BLOCK_TYPE_COMPRESSED_LAST), ]
class WRITE_Reply(Packet): name = 'WRITE Reply' fields_desc = [ IntEnumField('status', 0, nfsstat3), IntField('af_before', 0), ConditionalField( PacketField('attributes_before', WCC_Attr(), WCC_Attr), lambda pkt: pkt.af_before == 1 ), IntField('af_after', 0), ConditionalField( PacketField('attributes_after', Fattr3(), Fattr3), lambda pkt: pkt.af_after == 1 ), ConditionalField(IntField('count', 0), lambda pkt: pkt.status == 0), ConditionalField( IntEnumField('committed', 0, {0: 'UNSTABLE', 1: 'STABLE'}), lambda pkt: pkt.status == 0 ), ConditionalField( XLongField('verifier', 0), lambda pkt: pkt.status == 0 ) ]
class OFPTStatsRequestFlow(_ofp_header): name = "OFPST_STATS_REQUEST_FLOW" fields_desc = [ ByteEnumField("version", 0x01, ofp_version), ByteEnumField("type", 16, ofp_type), ShortField("len", None), IntField("xid", 0), ShortEnumField("stats_type", 1, ofp_stats_types), FlagsField("flags", 0, 16, []), PacketField("match", OFPMatch(), OFPMatch), ByteEnumField("table_id", "ALL", ofp_table), ByteField("pad", 0), ShortEnumField("out_port", "NONE", ofp_port_no) ]
class CRD(Packet): name = "CRD (Connection Response Data)" fields_desc = [ ByteField("structure_length", 0x00), ByteEnumField("connection_type", 0x03, CONNECTION_TYPE_CODES), ConditionalField( PacketField("connection_data", CRDTunnelingConnection(), CRDTunnelingConnection), lambda pkt: pkt.connection_type == 0x04) ] def post_build(self, p, pay): p = (len(p)).to_bytes(1, byteorder='big') + p[1:] return p + pay