scapy.contrib.automotive.bmw.hsfz

class scapy.contrib.automotive.bmw.hsfz.HSFZ(_pkt, /, *, length=None, type=1, src=0, dst=0)[source]

Bases: Packet

aliastypes
extract_padding(s: bytes) Tuple[bytes, bytes][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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             LENGTH                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              TYPE             |      SRC      |      DST      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                            Fig. HSFZ                             
HSFZ fields

length

IntField

None

type

ShortEnumField

1

src

XByteField

0

dst

XByteField

0

hashret() bytes[source]
payload_guess

Possible sublayers: UDS

post_build(pkt: bytes, pay: bytes) bytes[source]

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

class scapy.contrib.automotive.bmw.hsfz.HSFZSocket(ip: str = '127.0.0.1', port: int = 6801)[source]

Bases: StreamSocket

recv(x: int | None = 65535, **kwargs: Any) Packet | None[source]
class scapy.contrib.automotive.bmw.hsfz.UDS_HSFZSocket(src: int, dst: int, ip: str = '127.0.0.1', port: int = 6801, basecls: ~typing.Type[~scapy.packet.Packet] = <class 'scapy.contrib.automotive.uds.UDS'>)[source]

Bases: HSFZSocket

recv(x: int | None = 65535, **kwargs: Any) Packet | None[source]
send(x: Packet) int[source]
scapy.contrib.automotive.bmw.hsfz.hsfz_scan(ip: str, scan_range: Iterable[int] = range(0, 256), src: int = 244, timeout: int | float = 0.1, verbose: bool = True) List[UDS_HSFZSocket][source]

Helper function to scan for HSFZ endpoints.

Example

>>> sockets = hsfz_scan("192.168.0.42")
Parameters:
  • ip – IPv4 address of target to scan

  • scan_range – Range for HSFZ destination address

  • src – HSFZ source address, used during the scan

  • timeout – Timeout for each request

  • verbose – Show information during scan, if True

Returns:

A list of open UDS_HSFZSockets