scapy.contrib.isotp.isotp_packet

class scapy.contrib.isotp.isotp_packet.ISOTP(_pkt, /, *, data=b'')[source]

Bases: scapy.packet.Packet

Packet class for ISOTP messages. This class contains additional slots for source address (src), destination address (dst), extended source address (exsrc) and extended destination address (exdst) information. This information gets filled from ISOTPSockets or the ISOTPMessageBuilder, if it is available. Address information is not used for Packet comparison.

Parameters
  • args – Arguments for Packet init, for example bytes string

  • kwargs – Keyword arguments for Packet init.

aliastypes
default_fields
static defragment(can_frames, use_extended_addressing=None)[source]

Helper function to defragment a list of CAN frames to one ISOTP message

Parameters
  • can_frames – A list of CAN frames

  • use_extended_addressing – Specify if extended ISO-TP addressing is used in the packets for defragmentation.

Returns

An ISOTP message containing the data of the CAN frames or None

direction
dst
exdst
explicit
exsrc
fields
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              DATA             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                            Fig. ISOTP                            
ISOTP fields

data

StrField

b''

fieldtype
fragment(*args, **kargs)[source]

Helper function to fragment an ISOTP message into multiple CAN frames.

Returns

A list of CAN frames

name
original
overload_fields
overloaded_fields
packetfields
payload
post_transforms
raw_packet_cache
raw_packet_cache_fields
sent_time
sniffed_on
src
time
underlayer
validate_fields()[source]

Helper function to validate information in src, dst, exsrc and exdst slots

wirelen
class scapy.contrib.isotp.isotp_packet.ISOTPHeader(_pkt, /, *, flags=<Flag 0 ()>, identifier=0, length=None, reserved=0)[source]

Bases: scapy.layers.can.CAN

aliastypes
extract_padding(p)[source]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|FLAGS|                        IDENTIFIER                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     LENGTH    |                    RESERVED                   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |
+-+-+-+-+-+-+-+-+

                         Fig. ISOTPHeader                         
ISOTPHeader fields

flags

FlagsField

<Flag 0 ()>

identifier

XBitField (29 bits)

0

length

ByteField

None

reserved

ThreeBytesField

0

guess_payload_class(payload)[source]

ISO-TP encodes the frame type in the first nibble of a frame. This is used to determine the payload_class

Parameters

payload – payload bytes string

Returns

Type of payload class

post_build(pkt, pay)[source]

This will set the ByteField ‘length’ to the correct value.

class scapy.contrib.isotp.isotp_packet.ISOTPHeaderEA(_pkt, /, *, flags=<Flag 0 ()>, identifier=0, length=None, reserved=0, extended_address=0)[source]

Bases: scapy.contrib.isotp.isotp_packet.ISOTPHeader

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|FLAGS|                        IDENTIFIER                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     LENGTH    |                    RESERVED                   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |EXTENDED ADDRES|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. ISOTPHeaderEA                        
ISOTPHeaderEA fields

flags

FlagsField

<Flag 0 ()>

identifier

XBitField (29 bits)

0

length

ByteField

None

reserved

ThreeBytesField

0

extended_address

XByteField

0

post_build(p, pay)[source]

This will set the ByteField ‘length’ to the correct value. ‘chb(len(pay) + 1)’ is required, because the field ‘extended_address’ is counted as payload on the CAN layer

class scapy.contrib.isotp.isotp_packet.ISOTP_CF(_pkt, /, *, type=2, index=0, data=b'')[source]

Bases: scapy.packet.Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  TYPE | INDEX |      DATA     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. ISOTP_CF                           
ISOTP_CF fields

type

BitEnumField

2

index

BitField (4 bits)

0

data

StrField

b''

class scapy.contrib.isotp.isotp_packet.ISOTP_FC(_pkt, /, *, type=3, fc_flag=0, block_size=0, separation_time=0)[source]

Bases: scapy.packet.Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  TYPE |FC FLAG|   BLOCK SIZE  |SEPARATION TIME|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. ISOTP_FC                           
ISOTP_FC fields

type

BitEnumField

3

fc_flag

BitEnumField

0

block_size

ByteField

0

separation_time

ByteField

0

class scapy.contrib.isotp.isotp_packet.ISOTP_FF(_pkt, /, *, type=1, message_size=0, extended_message_size=0, data=b'')[source]

Bases: scapy.packet.Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  TYPE |      MESSAGE SIZE     |     EXTENDED MESSAGE SIZE     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |      DATA     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. ISOTP_FF                           
ISOTP_FF fields

type

BitEnumField

1

message_size

BitField (12 bits)

0

extended_message_size

BitField (Cond) (32 bits)

0

data

StrField

b''

class scapy.contrib.isotp.isotp_packet.ISOTP_SF(_pkt, /, *, type=0, message_size=None, data=b'')[source]

Bases: scapy.packet.Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  TYPE |MESSAGE|              DATA             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. ISOTP_SF                           
ISOTP_SF fields

type

BitEnumField

0

message_size

BitFieldLenField (4 bits)

None

data

StrLenField

b''