scapy.contrib.pnio_dcp¶
-
class
scapy.contrib.pnio_dcp.
DCPAliasNameBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | ALIAS NAME | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPAliasNameBlock
DCPAliasNameBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)6
dcp_block_length
None
block_info
0
alias_name
b'et200sp'
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPBaseBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
base class for all DCP Blocks
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPBaseBlock
DCPBaseBlock fields¶ option
1
sub_option
MultiEnumField
(Depends on option)2
dcp_block_length
None
block_info
0
data
b''
-
-
class
scapy.contrib.pnio_dcp.
DCPControlBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESPONSE |RESPONSE SUB OP| BLOCK ERROR | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. DCPControlBlock
DCPControlBlock fields¶ option
5
sub_option
MultiEnumField
(Depends on option)4
dcp_block_length
3
response
2
response_sub_option
MultiEnumField
(Depends on option)2
block_error
0
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPDeviceIDBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | VENDOR ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DEVICE ID | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPDeviceIDBlock
DCPDeviceIDBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)3
dcp_block_length
None
block_info
0
vendor_id
42
device_id
787
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPDeviceInstanceBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO |DEVICE INSTANCE|DEVICE INSTANCE| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPDeviceInstanceBlock
DCPDeviceInstanceBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)7
dcp_block_length
4
block_info
0
device_instance_high
0
device_instance_low
1
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPDeviceOptionsBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | DEVICE OPTIONS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPDeviceOptionsBlock
DCPDeviceOptionsBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)5
dcp_block_length
None
block_info
0
device_options
[]
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPDeviceRoleBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO |DEVICE ROLE DET| RESERVED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPDeviceRoleBlock
DCPDeviceRoleBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)4
dcp_block_length
4
block_info
0
device_role_details
1
reserved
0
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPIPBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | IP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | NETMASK | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | GATEWAY | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPIPBlock
DCPIPBlock fields¶ option
1
sub_option
MultiEnumField
(Depends on option)2
dcp_block_length
None
block_info
1
ip
'192.168.0.2'
netmask
'255.255.255.0'
gateway
'192.168.0.1'
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPMACBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | MAC | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPMACBlock
DCPMACBlock fields¶ option
1
sub_option
MultiEnumField
(Depends on option)1
dcp_block_length
None
block_info
0
mac
'00:00:00:00:00:00'
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPManufacturerSpecificBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | DEVICE VENDOR VALUE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPManufacturerSpecificBlock
DCPManufacturerSpecificBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)1
dcp_block_length
None
block_info
0
device_vendor_value
b'et200sp'
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DCPNameOfStationBlock
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | DCP BLOCK LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BLOCK INFO | NAME OF STATION | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PADDING | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DCPNameOfStationBlock
DCPNameOfStationBlock fields¶ option
2
sub_option
MultiEnumField
(Depends on option)2
dcp_block_length
None
block_info
0
name_of_station
b'et200sp'
padding
b'\x00'
-
-
class
scapy.contrib.pnio_dcp.
DeviceOption
(*args, **kargs)¶ Bases:
scapy.packet.Packet
-
aliastypes
¶
-
extract_padding
(s)¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION | SUB OPTION | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. DeviceOption
DeviceOption fields¶ option
2
sub_option
MultiEnumField
(Depends on option)5
-
-
class
scapy.contrib.pnio_dcp.
ProfinetDCP
(*args, **kargs)¶ Bases:
scapy.packet.Packet
Profinet DCP Packet
Requests are handled via ConditionalField because here only 1 Block is used every time.
Response can contain 1..n Blocks, for that you have to use one ProfinetDCP Layer with one or multiple DCP*Block Layers:
ProfinetDCP / DCPNameOfStationBlock / DCPDeviceIDBlock ...
Example for a DCP Identify All Request:
Ether(dst="01:0e:cf:00:00:00") / ProfinetIO(frameID=DCP_IDENTIFY_REQUEST_FRAME_ID) / ProfinetDCP(service_id=DCP_SERVICE_ID_IDENTIFY, service_type=DCP_REQUEST, option=255, sub_option=255, dcp_data_length=4)
Example for a DCP Identify Response:
Ether(dst=dst_mac) / ProfinetIO(frameID=DCP_IDENTIFY_RESPONSE_FRAME_ID) / ProfinetDCP( service_id=DCP_SERVICE_ID_IDENTIFY, service_type=DCP_RESPONSE) / DCPNameOfStationBlock(name_of_station="device1")
Example for a DCP Set Request:
Ether(dst=mac) / ProfinetIO(frameID=DCP_GET_SET_FRAME_ID) / ProfinetDCP(service_id=DCP_SERVICE_ID_SET, service_type=DCP_REQUEST, option=2, sub_option=2, dcp_data_length=14, dcp_block_length=10, name_of_station=name, reserved=0)
-
aliastypes
¶
-
fields_desc
¶ Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SERVICE ID | SERVICE TYPE | XID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | RESERVED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DCP DATA LENGTH | OPTION | SUB OPTION | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DCP BLOCK LENGTH | BLOCK QUALIFIER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NAME OF STATION | MAC | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | IP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NETMASK | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | GATEWAY | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NAME OF STATION | ALIAS NAME | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DCP BLOCKS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. ProfinetDCP
ProfinetDCP fields¶ service_id
5
service_type
0
xid
16777217
reserved
0
dcp_data_length
None
option
ByteEnumField
(Cond)2
sub_option
MultiEnumField
(Cond, Depends on option)3
dcp_block_length
LenField
(Cond)0
block_qualifier
ShortEnumField
(Cond)1
name_of_station
StrLenField
(Cond)b'et200sp'
mac
MACField
(Cond)'00:00:00:00:00:00'
ip
IPField
(Cond)'192.168.0.2'
netmask
IPField
(Cond)'255.255.255.0'
gateway
IPField
(Cond)'192.168.0.1'
name_of_station
StrLenField
(Cond)b'et200sp'
alias_name
StrLenField
(Cond)b'et200sp'
dcp_blocks
PacketListField
(Cond)[]
-
post_build
(pkt, pay)¶
-
-
scapy.contrib.pnio_dcp.
guess_dcp_block_class
(packet, **kargs)¶ returns the correct dcp block class needed to dissect the current tag if nothing can be found -> dcp base block will be used
- Parameters
packet – the current packet
- Returns
dcp block class