scapy.contrib.pnio_dcp

class scapy.contrib.pnio_dcp.DCPAliasNameBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPAliasNameBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

6

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

alias_name

StrLenField

b'et200sp'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPBaseBlock

Bases: scapy.packet.Packet

所有DCP模块的基本类

aliastypes
extract_padding(s)
fields_desc
DCPBaseBlock字段

option

ByteEnumField

1

sub_option

MultiEnumField (取决于选项)

2

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

data

StrLenField

b''

class scapy.contrib.pnio_dcp.DCPControlBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPControlBlock字段

option

ByteEnumField

5

sub_option

MultiEnumField (取决于选项)

4

dcp_block_length

LenField

3

response

ByteEnumField

2

response_sub_option

MultiEnumField (取决于选项)

2

block_error

ByteEnumField

0

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceIDBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceIDBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

3

dcp_block_length

LenField

None

block_info

ShortEnumField

0

vendor_id

XShortField

42

device_id

XShortField

787

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceInstanceBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceInstanceBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

7

dcp_block_length

LenField

4

block_info

ShortEnumField

0

device_instance_high

XByteField

0

device_instance_low

XByteField

1

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceOptionsBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceOptionsBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

5

dcp_block_length

LenField

None

block_info

ShortEnumField

0

device_options

PacketListField

[]

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPDeviceRoleBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPDeviceRoleBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (Depends on option)

4

dcp_block_length

LenField

4

block_info

ShortEnumField

0

device_role_details

ByteEnumField

1

reserved

XByteField

0

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPIPBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPIPBlock字段

option

ByteEnumField

1

sub_option

MultiEnumField (取决于选项)

2

dcp_block_length

LenField

None

block_info

ShortEnumField

1

ip

IPField

'192.168.0.2'

netmask

IPField

'255.255.255.0'

gateway

IPField

'192.168.0.1'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPMACBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPMACBlock字段

option

ByteEnumField

1

sub_option

MultiEnumField (取决于选项)

1

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

mac

MACField

'00:00:00:00:00:00'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPManufacturerSpecificBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPManufacturerSpecificBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

1

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

device_vendor_value

StrLenField

b'et200sp'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DCPNameOfStationBlock

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DCPNameOfStationBlock字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

2

dcp_block_length

FieldLenField

None

block_info

ShortEnumField

0

name_of_station

StrLenField

b'et200sp'

padding

PadField

b'\x00'

class scapy.contrib.pnio_dcp.DeviceOption

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
DeviceOption字段

option

ByteEnumField

2

sub_option

MultiEnumField (取决于选项)

5

class scapy.contrib.pnio_dcp.ProfinetDCP

Bases: scapy.packet.Packet

Profinet DCP数据包

通过ConditionalField处理请求,因为这里每次仅使用1个Block.

响应可以包含1..n块,为此您必须将一个ProfinetDCP层与一个或多个DCP * Block层一起使用:

ProfinetDCP / DCPNameOfStationBlock / DCPDeviceIDBlock ...

DCP识别所有请求的示例:

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)

DCP识别响应示例:

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")

DCP设置请求示例:

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
ProfinetDCP字段

service_id

ByteEnumField

5

service_type

ByteEnumField

0

xid

XIntField

16777217

reserved

ShortField

0

dcp_data_length

LenField

None

option

ByteEnumField (Cond)

2

sub_option

MultiEnumField (条件,取决于选项)

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)

[]

payload_guess

可能的子层: Padding

post_build(pkt, pay)
scapy.contrib.pnio_dcp.guess_dcp_block_class(packet, **kargs)

如果找不到任何内容,则返回解析当前标签所需的正确dcp块类->将使用dcp基本块

Parameters

数据包 –当前数据包

Returns

dcp块类