scapy.contrib.isotp.isotp_utils

class scapy.contrib.isotp.isotp_utils.ISOTPMessageBuilder(use_ext_address: bool | None = None, rx_id: int | ~typing.List[int] | ~typing.Iterable[int] | None = None, basecls: ~typing.Type[~scapy.contrib.isotp.isotp_packet.ISOTP] = <class 'scapy.contrib.isotp.isotp_packet.ISOTP'>)[源代码]

基类:object

Initialize a ISOTPMessageBuilder object

Utility class to build ISOTP messages out of CAN frames, used by both ISOTP.defragment() and ISOTPSession.

This class attempts to interpret some CAN frames as ISOTP frames, both with and without extended addressing at the same time. For example, if an extended address of 07 is being used, all frames will also be interpreted as ISOTP single-frame messages.

CAN frames are fed to an ISOTPMessageBuilder object with the feed() method and the resulting ISOTP frames can be extracted using the pop() method.

参数:
  • use_ext_address -- True for only attempting to defragment with extended addressing, False for only attempting to defragment without extended addressing, or None for both

  • rx_id -- Destination Identifier

  • basecls -- The class of packets that will be returned, defaults to ISOTP

class Bucket(total_len: int, first_piece: bytes, ts: EDecimal | float)[源代码]

基类:object

Helper class to store not finished ISOTP messages while building.

push(piece: bytes) None[源代码]
property count: int

Returns the number of ready ISOTP messages built from the provided can frames

返回:

Number of ready ISOTP messages

feed(can: Iterable[Packet] | Packet) None[源代码]

Attempt to feed an incoming CAN frame into the state machine

pop(identifier: int | None = None, ext_addr: int | None = None) ISOTP | None[源代码]

Returns a built ISOTP message

参数:
  • identifier -- if not None, only return isotp messages with this destination

  • ext_addr -- if identifier is not None, only return isotp messages with this extended address for destination

返回:

an ISOTP packet, or None if no message is ready

class scapy.contrib.isotp.isotp_utils.ISOTPMessageBuilderIter(builder: ISOTPMessageBuilder)[源代码]

基类:object

Iterator class for ISOTPMessageBuilder

next() ISOTP[源代码]
slots = ['builder']
class scapy.contrib.isotp.isotp_utils.ISOTPSession(*args: Any, **kwargs: Any)[源代码]

基类:DefaultSession

Defragment ISOTP packets 'on-the-flow'.

Usage:
>>> sniff(session=ISOTPSession)
on_packet_received(pkt: Packet | None) None[源代码]