scapy.contrib.automotive.gm.gmlanutils

scapy.contrib.automotive.gm.gmlanutils.GMLAN_BroadcastSocket(interface)

Returns a GMLAN broadcast socket using interface.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_GetSecurityAccess(sock, keyFunction, level=1, timeout=None, verbose=None, retry=0)

Authenticate on ECU. Implements Seey-Key procedure.

Parameters
  • sock – socket to send the message on.

  • keyFunction – function implementing the key algorithm.

  • level – level of access

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

  • verbose – set verbosity level

  • retry – number of retries in case of failure.

Returns true on success.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_InitDiagnostics(sock, broadcastsocket=None, timeout=None, verbose=None, retry=0)

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

Parameters
  • sock – socket to send the message on.

  • broadcast – 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.

  • verbose – set verbosity level

  • retry – number of retries in case of failure.

Returns true on success.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_ReadMemoryByAddress(sock, addr, length, timeout=None, verbose=None, retry=0)

Read data from ECU memory.

Parameters
  • 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.

  • verbose – set verbosity level.

  • retry – number of retries in case of failure.

Returns the bytes read.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_RequestDownload(sock, length, timeout=None, verbose=None, retry=0)

Send RequestDownload message.

Usually used before calling TransferData.

Parameters
  • sock – socket to send the message on.

  • length – value for the message’s parameter ‘unCompressedMemorySize’.

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

  • verbose – set verbosity level.

  • retry – number of retries in case of failure.

Returns true on success.

class scapy.contrib.automotive.gm.gmlanutils.GMLAN_TesterPresentSender(sock, pkt=<GMLAN service=TesterPresent |>, interval=2)

Bases: scapy.utils.PeriodicSenderThread

scapy.contrib.automotive.gm.gmlanutils.GMLAN_TransferData(sock, addr, payload, maxmsglen=None, timeout=None, verbose=None, retry=0)

Send TransferData message.

Usually used after calling RequestDownload.

Parameters
  • 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.

  • verbose – set verbosity level.

  • retry – number of retries in case of failure.

Returns true on success.

scapy.contrib.automotive.gm.gmlanutils.GMLAN_TransferPayload(sock, addr, payload, maxmsglen=None, timeout=None, verbose=None, retry=0)

Send data by using GMLAN services.

Parameters
  • 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.

  • verbose – set verbosity level.

  • retry – number of retries in case of failure.

Returns true on success.