scapy.contrib.automotive.gm.gmlanutils

scapy.contrib.automotive.gm.gmlanutils.GMLAN_BroadcastSocket(interface: str) SuperSocket[源代码]

Returns a GMLAN broadcast socket using interface.

参数:

interface -- interface name

返回:

ISOTPSocket configured as GMLAN Broadcast Socket

scapy.contrib.automotive.gm.gmlanutils.GMLAN_GetSecurityAccess(sock: SuperSocket, key_function: Callable[[int], int], level: int = 1, timeout: int | None = None, retry: int = 0, unittest: bool = False) bool[源代码]

Authenticate on ECU. Implements Seey-Key procedure.

参数:
  • sock -- socket to send the message on.

  • key_function -- function implementing the key algorithm.

  • level -- level of access

  • timeout -- timeout for sending, receiving or sniffing packages.

  • retry -- number of retries in case of failure.

  • unittest -- disable internal delays

返回:

True on success.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_InitDiagnostics(sock: SuperSocket, broadcast_socket: SuperSocket | None = None, timeout: int = 1, retry: int = 0, unittest: bool = False) bool[源代码]

Send messages to put an ECU into diagnostic/programming state.

参数:
  • sock -- socket for communication.

  • broadcast_socket -- socket for broadcasting. If provided some message will be sent as broadcast. Recommended when used on a network with several ECUs.

  • timeout -- timeout for sending, receiving or sniffing packages.

  • retry -- number of retries in case of failure.

  • unittest -- disable delays

返回:

True on success else False

scapy.contrib.automotive.gm.gmlanutils.GMLAN_ReadMemoryByAddress(sock: SuperSocket, addr: int, length: int, timeout: int | None = None, retry: int = 0) bytes | None[源代码]

Read data from ECU memory.

参数:
  • sock -- socket to send the data on.

  • addr -- source memory address on the ECU.

  • length -- bytes to read.

  • timeout -- timeout for sending, receiving or sniffing packages.

  • retry -- number of retries in case of failure.

返回:

bytes red or None

scapy.contrib.automotive.gm.gmlanutils.GMLAN_RequestDownload(sock: SuperSocket, length: int, timeout: int | None = None, retry: int = 0) bool[源代码]

Send RequestDownload message.

Usually used before calling TransferData.

参数:
  • sock -- socket to send the message on.

  • length -- value for the message's parameter 'unCompressedMemorySize'.

  • timeout -- timeout for sending, receiving or sniffing packages.

  • retry -- number of retries in case of failure.

返回:

True on success

class scapy.contrib.automotive.gm.gmlanutils.GMLAN_TesterPresentSender(sock: ~scapy.supersocket.SuperSocket, pkt: ~scapy.packet.Packet = <GMLAN  service=TesterPresent |>, interval: int = 2)[源代码]

基类:PeriodicSenderThread

run() None[源代码]
scapy.contrib.automotive.gm.gmlanutils.GMLAN_TransferData(sock: SuperSocket, addr: int, payload: bytes, maxmsglen: int | None = None, timeout: int | None = None, retry: int = 0) bool[源代码]

Send TransferData message.

Usually used after calling RequestDownload.

参数:
  • sock -- socket to send the message on.

  • addr -- destination memory address on the ECU.

  • payload -- data to be sent.

  • maxmsglen -- maximum length of a single iso-tp message. default: maximum length

  • timeout -- timeout for sending, receiving or sniffing packages.

  • retry -- number of retries in case of failure.

返回:

True on success.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_TransferPayload(sock: SuperSocket, addr: int, payload: bytes, maxmsglen: int | None = None, timeout: int | None = None, retry: int = 0) bool[源代码]

Send data by using GMLAN services.

参数:
  • sock -- socket to send the data on.

  • addr -- destination memory address on the ECU.

  • payload -- data to be sent.

  • maxmsglen -- maximum length of a single iso-tp message. default: maximum length

  • timeout -- timeout for sending, receiving or sniffing packages.

  • retry -- number of retries in case of failure.

返回:

True on success.