Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
This packet is encapsulated inside SAPMS packet
and before the MS ADM payload. Kernel 720.
"""
name = "SAP Dispatcher Info v2"
fields_desc = [
ByteEnumKeysField("dp_req_prio", 0x1, dp_prio_values),
XByteField("dp_blob_00", 0x2),
XByteField("dp_blob_01", 0x80),
XByteField("dp_blob_02", 0x21),
ShortField("dp_blob_03", 0x0),
ShortField("dp_blob_04", 0xffff),
StrFixedLenField("dp_blob_05", "\xff\xff\xff\xff\xff", 5),
ByteField("dp_addr_from_t", 0x0),
StrFixedLenField("dp_blob_06", "\xff\xff", 2),
StrFixedLenField("dp_blob_07", "\xff\xff\xff\xff", 4),
StrFixedLenField("dp_blob_08", "\xff\xff\xff\xff", 4),
StrFixedLenField("dp_blob_09", "\xff\xcc", 2),
StrFixedLenField("dp_blob_10", "\x01\x00", 2),
ByteField("dp_addr_from_m", 0x0),
ByteField("dp_addr_from_u", 0x0),
StrFixedLenField("dp_blob_11", "\xff\xff", 2),
StrFixedLenField("dp_blob_12", "\xff\xff\xff\xff", 4),
StrFixedLenField("dp_blob_13", "", 86),
StrFixedLenField("dp_blob_14", "", 5),
StrFixedLenField("dp_name_to", "", 40),
XByteField("dp_blob_15", 0x0),
ByteField("dp_addr_to_t", 0x0),
ShortField("dp_addr_to_u", 0x0),
ShortField("Data2", 0xfd01),
ShortField("Data3", 0),
ShortField("Data4", 0xacde),
ShortField("Data5", 0x0fe5),
ShortField("Data6", 0xd10a),
ShortField("Data7", 0x374c),
ShortField("Data8", 0x83e2),
ShortField("Data9", 0x7dd9),
ShortField("Data10", 0x3a16),
ShortField("Data11", 0x73ff),
ByteField("Data12", 0x04),
StrFixedLenField("Data13", "rmff", 4),
ByteField("Data14", 0x0),
ShortField("Data16", 0xc018),
ByteField("Data18", 0x0a),
StrFixedLenField("Data20", "rmff-win2k", 10),
ByteField("Data21", 0xc0),
ShortField("Data22", 0x18c0),
ShortField("Data23", 0x180a),
StrFixedLenField("Data24", "RMFF-WIN2K", 10),
ShortField("Data25", 0),
ByteField("Data26", 0x17),
StrFixedLenField("Data27", "Default-First-Site-Name", 23),
ShortField("Data28", 0x00c0),
ShortField("Data29", 0x3c10),
ShortField("Data30", 0x00c0),
ShortField("Data31", 0x0200),
ShortField("Data32", 0x0),
ShortField("Data33", 0xac14),
ShortField("Data34", 0x0064),
ShortField("Data35", 0x0),
ShortField("Data36", 0x0),
StrFixedLenField("no_send_by_name_padd", "", 4),
IntField("no_send_by_type", 0),
StrFixedLenField("no_send_by_type_padd", "", 4),
IntField("no_adm_messages", 0),
StrFixedLenField("no_adm_messages_padd", "", 4),
IntField("no_adms", 0),
StrFixedLenField("no_amds_padd", "", 4),
StrFixedLenField("no_adm_type", "", 648),
IntField("no_mod_types", 0),
StrFixedLenField("no_mod_types_padd", "", 4),
IntField("no_opcodes_rcvd", 0),
StrFixedLenField("no_opcodes_rcvd_padd", "", 4),
IntField("no_opcodes_send", 0),
StrFixedLenField("no_opcodes_send_padd", "", 4),
IntField("no_opcodes", 0),
StrFixedLenField("no_opcode_type", "", 408),
IntField("no_keepalive_send", 0),
StrFixedLenField("no_keepalive_send_padd", "", 4),
IntField("no_keepalive_rcvd", 0),
StrFixedLenField("no_keepalive_rcvd_padd", "", 4),
IntField("no_keepalive_disc", 0),
StrFixedLenField("no_keepalive_disc_padd", "", 4),
IntField("no_bytes_read", 0),
StrFixedLenField("no_bytes_read_padd", "", 12),
IntField("no_bytes_written", 0),
StrFixedLenField("no_bytes_written_padd", "", 12),
IntField("no_clients", 0),
StrFixedLenField("sta_time", "", 30),
StrFixedLenField("act_time", "", 30),
]
IntField("_filler0", 0)
]
class NTPInfoIfStatsIPv6(Packet):
"""
Interface statistics.
"""
name = "info_if_stats"
fields_desc = [
IP6Field("unaddr", "::"),
IP6Field("unbcast", "::"),
IP6Field("unmask", "::"),
IntField("v6_flag", 0),
StrFixedLenField("ifname", "", length=32),
IntField("flags", 0),
IntField("last_ttl", 0),
IntField("num_mcast", 0),
IntField("received", 0),
IntField("sent", 0),
IntField("notsent", 0),
IntField("uptime", 0),
IntField("scopeid", 0),
IntField("ifindex", 0),
IntField("ifnum", 0),
IntField("peercnt", 0),
ShortField("family", 0),
ByteField("ignore_packets", 0),
ByteField("action", 0),
IntField("_filler0", 0)
]
ConditionalField(ShortField("security2_port", 0), lambda pkt:pkt.opcode == 0x09),
ConditionalField(StrFixedLenField("security2_key", None, 256), lambda pkt:pkt.opcode == 0x09),
ConditionalField(IP6Field("security2_addressv6", "::"), lambda pkt:pkt.opcode == 0x09),
# Hardware ID field
ConditionalField(StrNullFixedLenField("hwid", "", length=99), lambda pkt:pkt.opcode == 0x0a),
# Statistics
ConditionalField(PacketField("stats", None, SAPMSStat3), lambda pkt:pkt.opcode == 0x11 and pkt.flag == 0x03),
# Codepage
ConditionalField(IntField("codepage", 0), lambda pkt:pkt.opcode == 0x1c and pkt.flag == 0x03),
# Dump Info Request fields
ConditionalField(ByteField("dump_dest", 0x02), lambda pkt:pkt.opcode == 0x1E and pkt.flag == 0x02),
ConditionalField(StrFixedLenField("dump_filler", "\x00\x00\x00", 3), lambda pkt:pkt.opcode == 0x1E and pkt.flag == 0x02),
ConditionalField(ShortField("dump_index", 0x00), lambda pkt:pkt.opcode == 0x1E and pkt.flag == 0x02),
ConditionalField(ShortEnumKeysField("dump_command", 0x01, ms_dump_command_values), lambda pkt:pkt.opcode == 0x1E and pkt.flag == 0x02),
ConditionalField(StrFixedLenField("dump_name", "\x00" * 40, 40), lambda pkt:pkt.opcode == 0x1E and pkt.flag == 0x02),
# File Reload fields
ConditionalField(ByteEnumKeysField("file_reload", 0, ms_file_reload_values), lambda pkt:pkt.opcode == 0x1f),
ConditionalField(StrFixedLenField("file_padding", "\x00\x00", 2), lambda pkt:pkt.opcode == 0x1f),
# Get/Set/Del Logon fields
ConditionalField(PacketField("logon", None, SAPMSLogon), lambda pkt:pkt.opcode in [0x2b, 0x2c, 0x2d]),
# Server Disconnect/Shutdown fields
ConditionalField(PacketField("shutdown_client", None, SAPMSClient3), lambda pkt:pkt.opcode in [0x2e, 0x2f, 0x30, 0x4a]),
ConditionalField(FieldLenField("shutdown_reason_length", None, length_of="shutdown_reason", fmt="!H"), lambda pkt:pkt.opcode in [0x2e, 0x2f, 0x30, 0x4a]),
ConditionalField(StrLenField("shutdown_reason", "", length_from=lambda pkt:pkt.shutdown_reason_length), lambda pkt:pkt.opcode in [0x2e, 0x2f, 0x30, 0x4a]),
class SAPDPInfo2(Packet):
"""SAP Dispatcher Info packet
This packet is encapsulated inside SAPMS packet
and before the MS ADM payload. Kernel 720.
"""
name = "SAP Dispatcher Info v2"
fields_desc = [
ByteEnumKeysField("dp_req_prio", 0x1, dp_prio_values),
XByteField("dp_blob_00", 0x2),
XByteField("dp_blob_01", 0x80),
XByteField("dp_blob_02", 0x21),
ShortField("dp_blob_03", 0x0),
ShortField("dp_blob_04", 0xffff),
StrFixedLenField("dp_blob_05", "\xff\xff\xff\xff\xff", 5),
ByteField("dp_addr_from_t", 0x0),
StrFixedLenField("dp_blob_06", "\xff\xff", 2),
StrFixedLenField("dp_blob_07", "\xff\xff\xff\xff", 4),
StrFixedLenField("dp_blob_08", "\xff\xff\xff\xff", 4),
StrFixedLenField("dp_blob_09", "\xff\xcc", 2),
StrFixedLenField("dp_blob_10", "\x01\x00", 2),
ByteField("dp_addr_from_m", 0x0),
ByteField("dp_addr_from_u", 0x0),
StrFixedLenField("dp_blob_11", "\xff\xff", 2),
StrFixedLenField("dp_blob_12", "\xff\xff\xff\xff", 4),
StrFixedLenField("dp_blob_13", "", 86),
StrFixedLenField("dp_blob_14", "", 5),
StrFixedLenField("dp_name_to", "", 40),
class SkinnyMessageDialedNumber(Packet):
name = 'dialed number'
fields_desc = [StrFixedLenField("number", "1337", 24),
LEIntField("instance", 1),
LEIntField("callid", 0)]
_skinny_message_callinfo_restrictions = ['CallerName', 'CallerNumber', 'CalledName', 'CalledNumber', 'OriginalCalledName', 'OriginalCalledNumber', 'LastRedirectName', 'LastRedirectNumber'] + ['Bit%d' % i for i in range(8, 15)] # noqa: E501
class SkinnyMessageCallInfo(Packet):
name = 'call information'
fields_desc = [StrFixedLenField("callername", "Jean Valjean", 40),
StrFixedLenField("callernum", "1337", 24),
StrFixedLenField("calledname", "Causette", 40),
StrFixedLenField("callednum", "1034", 24),
LEIntField("lineinstance", 1),
LEIntField("callid", 0),
StrFixedLenField("originalcalledname", "Causette", 40),
StrFixedLenField("originalcallednum", "1034", 24),
StrFixedLenField("lastredirectingname", "Causette", 40),
StrFixedLenField("lastredirectingnum", "1034", 24),
LEIntField("originalredirectreason", 0),
LEIntField("lastredirectreason", 0),
StrFixedLenField('voicemailboxG', b'\0' * 24, 24),
StrFixedLenField('voicemailboxD', b'\0' * 24, 24),
StrFixedLenField('originalvoicemailboxD', b'\0' * 24, 24),
StrFixedLenField('lastvoicemailboxD', b'\0' * 24, 24),
LEIntField('security', 0),
FlagsField('restriction', 0, 16, _skinny_message_callinfo_restrictions), # noqa: E501
]
mandatory_operations = {OP.Get, OP.Set}
notifications = {OP.AttributeValueChange, OP.AlarmNotification}
alarms = {
0: 'Plug-in circuit pack missing',
1: 'Plug-in type mismatch alarm',
2: 'Improper card removal',
3: 'Plug-in equipment ID mismatch alarm',
4: 'Protection switch',
}
class CircuitPack(EntityClass):
class_id = 6
attributes = [
ECA(StrFixedLenField("managed_entity_id", None, 22), {AA.R, AA.SBC},
range_check=lambda x: 0 <= x < 255 or 256 <= x < 511),
ECA(ByteField("type", None), {AA.R, AA.SBC}),
ECA(ByteField("number_of_ports", None), {AA.R}, optional=True),
ECA(OmciSerialNumberField("serial_number"), {AA.R}),
ECA(StrFixedLenField("version", None, 14), {AA.R}),
ECA(StrFixedLenField("vendor_id", None, 4), {AA.R}),
ECA(ByteField("administrative_state", None), {AA.R, AA.W}),
ECA(ByteField("operational_state", None), {AA.R}, optional=True, avc=True),
ECA(ByteField("bridged_or_ip_ind", None), {AA.R, AA.W}, optional=True,
range_check=lambda x: 0 <= x <= 2),
ECA(StrFixedLenField("equipment_id", None, 20), {AA.R}, optional=True),
ECA(ByteField("card_configuration", None), {AA.R, AA.W, AA.SBC},
optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
ECA(ByteField("total_tcont_buffer_number", None), {AA.R},
optional=True), # not really mandatory, see spec ITU-T G.988, 9.1.6
ECA(ByteField("total_priority_queue_number", None), {AA.R},
References: RFC 4360
"""
name = "IPv4 Address Specific Extended Community"
fields_desc = [
IntField("global_administrator", 0), ShortField("local_administrator", 0)] # noqa: E501
class BGPPAExtCommOpaque(Packet):
"""
Packet handling the Opaque Extended Community attribute value.
References: RFC 4360
"""
name = "Opaque Extended Community"
fields_desc = [StrFixedLenField("value", "", length=6)]
#
# FlowSpec related extended communities
#
class BGPPAExtCommTrafficRate(Packet):
"""
Packet handling the (FlowSpec) "traffic-rate" extended community.
References: RFC 5575
"""
name = "FlowSpec traffic-rate extended community"
fields_desc = [
ShortField("id", 0),
IEEEFloatField("rate", 0)
FlagsField("flags", 0, 16, [])]
overload_fields = {TCP: {"sport": 6653}}
class OFPTStatsReplyDesc(_ofp_header):
name = "OFPST_STATS_REPLY_DESC"
fields_desc = [ByteEnumField("version", 0x01, ofp_version),
ByteEnumField("type", 17, ofp_type),
ShortField("len", None),
IntField("xid", 0),
ShortEnumField("stats_type", 0, ofp_stats_types),
FlagsField("flags", 0, 16, []),
StrFixedLenField("mfr_desc", "", 256),
StrFixedLenField("hw_desc", "", 256),
StrFixedLenField("sw_desc", "", 256),
StrFixedLenField("serial_num", "", 32),
StrFixedLenField("dp_desc", "", 256)]
overload_fields = {TCP: {"dport": 6653}}
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)]