Exemple #1
0
class CIP_ReqForwardOpen(scapy_all.Packet):
    """Forward Open request"""
    name = "CIP_ReqForwardOpen"
    fields_desc = [
        scapy_all.BitField("priority", 0, 4),
        scapy_all.BitField("tick_time", 0, 4),
        scapy_all.ByteField("timeout_ticks", 249),
        scapy_all.LEIntField("OT_network_connection_id", 0x80000031),
        scapy_all.LEIntField("TO_network_connection_id", 0x80fe0030),
        scapy_all.LEShortField("connection_serial_number", 0x1337),
        scapy_all.LEShortField("vendor_id", 0x004d),
        scapy_all.LEIntField("originator_serial_number", 0xdeadbeef),
        scapy_all.ByteField("connection_timeout_multiplier", 0),
        scapy_all.X3BytesField("reserved", 0),
        scapy_all.LEIntField("OT_rpi", 0x007a1200),  # 8000 ms For ToCNC and ToCell
        #scapy_all.LEIntField("OT_rpi", 0x00000000),     # for j
        scapy_all.LEShortField("OT_connection_param", 0x4802), #for ToCNC and ToCell
        #scapy_all.LEShortField("OT_connection_param", 0x0400), #for j
        #scapy_all.PacketField('OT_connection_param', CIP_ConnectionParam(), CIP_ConnectionParam),
        scapy_all.LEIntField("TO_rpi", 0x007a1200),     #ToCNC and ToCell
        #scapy_all.LEIntField("TO_rpi", 0x00000000),     #for j
        scapy_all.LEShortField("TO_connection_param", 0x281a), #for ToCNC and ToCell
        #scapy_all.LEShortField("TO_connection_param", 0x0400),  #for j
        #scapy_all.PacketField('TO_connection_param', CIP_ConnectionParam(), CIP_ConnectionParam),
        scapy_all.XByteField("transport_type", 0x81),  # direction server, application object, class 3
        scapy_all.ByteField("path_wordsize", None),
        CIP_PathField("path", None, length_from=lambda p: 2 * p.path_wordsize),
    ]
Exemple #2
0
class SWAT_MV(scapy_all.Packet):
    name = 'SWAT_MV'
    fields_desc = [
        scapy_all.ByteEnumField('cmd', 0, {1: 'closed', 2: 'open'}),
        scapy_all.ByteField('spare2', 0),
        scapy_all.ByteEnumField('status', 0, {1: 'closed', 2: 'open'}),
        scapy_all.ByteField('spare3', 0),
        scapy_all.BitEnumField('spare4', 0, 1, {}),
        scapy_all.BitEnumField('spare5', 0, 1, {}),
        scapy_all.BitEnumField('spare6', 0, 1, {}),
        scapy_all.BitEnumField('Avl', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('FTC', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('FTO', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('Auto', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('Reset', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.X3BytesField('Spare7', 0)
    ] 
Exemple #3
0
class CIP_ReqForwardOpen(scapy_all.Packet):
    """Forward Open request"""
    name = "CIP_ReqForwardOpen"
    
    SEGMENT_TYPE = {
        0x00: "Port Segment",
        0x01: "Logical Segment",
        0x02: "Network Segment",
        0x03: "Symbolic Segment",
        0x04: "Data Segment",
        0x05: "Data Type (constructed)",
        0x06: "Data Type (elementary)",
        0x07: "Reserved for future use",
    }

    fields_desc = [
        # Updated a few field descriptions to adjust how they are displayed
        # Altered fields begin with utils. rather than scapy_all. - MED
        scapy_all.BitField("priority", 0, 4),
        scapy_all.BitField("tick_time", 0, 4),
        scapy_all.ByteField("timeout_ticks", 249),
        utils.XLEIntField("OT_network_connection_id", 0x80000031),
        utils.XLEIntField("TO_network_connection_id", 0x80fe0030),
        scapy_all.LEShortField("connection_serial_number", 0x1337),
        utils.XLEShortField("vendor_id", 0x004d),
        utils.XLEIntField("originator_serial_number", 0xdeadbeef),
        scapy_all.ByteField("connection_timeout_multiplier", 0),
        scapy_all.X3BytesField("reserved", 0),
        utils.XLEIntField("OT_rpi", 0x007a1200),  # 8000 ms
        scapy_all.PacketField('OT_connection_param', CIP_ConnectionParam(), CIP_ConnectionParam),
        utils.XLEIntField("TO_rpi", 0x007a1200),
        scapy_all.PacketField('TO_connection_param', CIP_ConnectionParam(), CIP_ConnectionParam),
        scapy_all.XByteField("transport_type", 0xa3),  # direction server, application object, class 3
        # Changed  name - MED
        scapy_all.ByteField("Connection_Path_Size", None),  #The number of 16 bit words in the Connection_Path field.
        # scapy_all.PacketListField("path_segment_items", [], CIP_Path1, length_from=lambda p: 2 * p.Connection_Path_Size),
        # Modified Implementation - MED
        scapy_all.PacketListField("path_segment_items", [], CIP_PathPadded, length_from=lambda p: 6),
        # CIP_PathField("path", None, length_from=lambda p: 2 * p.path_wordsize),
    ]
Exemple #4
0
class SWAT_AIT(scapy_all.Packet):
    name = 'SWAT_AIT'
    fields_desc = [        
        scapy_all.LEIntField('Pv', 0),
        scapy_all.LEIntField('Heu', 0),
        scapy_all.LEIntField('Leu', 0),
        scapy_all.LEIntField('SALL', 0),
        scapy_all.LEIntField('SAL', 0),
        scapy_all.LEIntField('SAH', 0),
        scapy_all.LEIntField('SAHH', 0),
        scapy_all.BitEnumField('status', 0, 1, {0: 'unhealthy', 1: 'healthy'}),
        scapy_all.BitEnumField('Rst_Totaliser', 0, 1, {0: 'unhealthy', 1: 'healthy'}),
        scapy_all.BitEnumField('WiFi', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('control', 0, 1, {0: 'actual', 1: 'simulation'}),
        scapy_all.BitEnumField('ALL', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('AL', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('AH', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('AHH', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.X3BytesField('Spare', 0),
        scapy_all.LEIntField('Sim_Pv', 0),

    ]            
Exemple #5
0
class SWAT_P1_ALL(scapy_all.Packet):
    name = 'SWAT_P1_ALL'
    fields_desc = [
        scapy_all.LEIntField('FIT101_Pv', 0),
        scapy_all.LEIntField('LIT101_Pv', 0),
        scapy_all.ByteField('spare3', 0),
        scapy_all.ByteField('spare4', 0),
        scapy_all.ByteEnumField('P101_cmd', 0, {1: 'off', 2: 'on'}),
        scapy_all.ByteField('spare5', 0),
        scapy_all.ByteEnumField('P102_cmd', 0, {1: 'off', 2: 'on'}),
        scapy_all.ByteField('spare6', 0),
        scapy_all.ByteField('spare7', 0),
        scapy_all.ByteField('spare8', 0),
        scapy_all.BitEnumField('FIT101_status', 0, 1, {0: 'unhealthy', 1: 'healthy'}),
        scapy_all.BitEnumField('FIT101_Rst_Totaliser', 0, 1, {0: 'unhealthy', 1: 'healthy'}),
        scapy_all.BitEnumField('FIT101_WiFi', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('FIT101_control', 0, 1, {0: 'actual', 1: 'simulation'}),
        scapy_all.BitEnumField('FIT101_ALL', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('FIT101_AL', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('FIT101_AH', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('FIT101_AHH', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.ByteField('spare9', 0),
        scapy_all.LEIntField('FIT101_H', 0),
        scapy_all.LEIntField('FIT101_HH', 0),
        scapy_all.LEIntField('FIT101_L', 0),
        scapy_all.LEIntField('FIT101_LL', 0),
        scapy_all.BitEnumField('LIT101_spare', 0, 1, {}),
        scapy_all.BitEnumField('LIT101_control', 0, 1, {0: 'actual', 1: 'simulation'}),
        scapy_all.BitEnumField('LIT101_status', 0, 1, {0: 'unhealthy', 1: 'healthy'}),
        scapy_all.BitEnumField('LIT101_WiFi', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('LIT101_ALL', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('LIT101_AL', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('LIT101_AH', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('LIT101_AHH', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.LEIntField('LIT101_SALL', 0),
        scapy_all.LEIntField('LIT101_SAL', 0),
        scapy_all.LEIntField('LIT101_SAH', 0),
        scapy_all.LEIntField('LIT101_SAHH', 0),
        scapy_all.BitEnumField('spare10', 0, 1, {}),
        scapy_all.BitEnumField('spare11', 0, 1, {}),
        scapy_all.BitEnumField('spare12', 0, 1, {}),
        scapy_all.BitEnumField('MV101_Avl', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('MV101_FTC', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('MV101_FTO', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('MV101_Auto', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.BitEnumField('MV101_Reset', 0, 1, {0: 'disable', 1: 'enable'}),
        scapy_all.ByteEnumField('MV101_status', 0, {1: 'off', 2: 'on'}),
        scapy_all.ByteField('spare13', 0),
        scapy_all.ByteField('spare14', 0),
        scapy_all.ByteEnumField('P101_status', 0, {1: 'off', 2: 'on'}),
        scapy_all.X3BytesField('Spare', 0),
        scapy_all.LEIntField('spare15', 0),
        scapy_all.LEIntField('spare16', 0),
        scapy_all.LEIntField('spare17', 0),
        scapy_all.LEIntField('spare18', 0),
        scapy_all.LEIntField('P101_RunHr', 0),
        scapy_all.LEIntField('P101_RunHr2', 0),
        scapy_all.ByteField('spare19', 0),
        scapy_all.ByteField('spare20', 0),
        scapy_all.LEIntField('P101_Permissive', 0),
        scapy_all.LEIntField('spare21', 0)
        # scapy_all.ByteField('spare4', 0),
        # scapy_all.LEIntField('spare', 0),
        # scapy_all.LEIntField('LIT101_Sim_Pv', 0),
        # scapy_all.ByteField('spare4', 0),
        # scapy_all.ByteField('spare5', 0),
        # scapy_all.LEIntField('P102_RunHr', 0),
        # scapy_all.LEIntField('P102_RunHr', 0),
        # scapy_all.ByteField('spare4', 0),
        # scapy_all.ByteField('spare5', 0),
        # scapy_all.LEIntField('P102_Permissive', 0),
        # scapy_all.LEIntField('spare', 0)
    ]