Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d833043
Implement J1939 Soft Socket for SAE J1939 Transport Protocol in Python
Jun 11, 2026
e0626fe
Add debug logging for J1939SoftSocket operations and packet handling
Jun 12, 2026
90570fe
Add debug logging for J1939SoftSocket operations and packet handling
Jun 12, 2026
e59199f
Fix Unit-Tests
Jun 12, 2026
3414c3b
Fix Codacy
Jun 12, 2026
9e2556b
j1939: fix the transport protocol against oversized, concurrent and h…
Aug 13, 2026
19212ea
j1939: tighten the transport-protocol fixes after review
Aug 13, 2026
8965e37
j1939: replace the silent except/pass blocks and cover the paths they…
Aug 13, 2026
626eae0
j1939: fix CAN-send, EOM ACK and TP.CM addressing correctness
Sep 2, 2026
fafddb9
j1939: port ISO-TP adapter drains and harden soft-socket lifecycle
Sep 2, 2026
7a0ee7e
j1939: align soft-socket PGN filter with NativeJ1939Socket
Sep 2, 2026
cfec25e
Import SuperSocket from scapy.supersocket
polybassa Sep 2, 2026
60cfb11
j1939: restore TP timing overrides with try/finally in soft-socket tests
Sep 8, 2026
0b2d6ef
j1939: fail fast on missing CAN socket and close interop FDs
Sep 8, 2026
d3c482a
Merge branch 'master' into j1939_soft_sockets
polybassa Sep 9, 2026
8347e30
automotive: J1939 Diagnostic Messages (J1939-73) and DM scanner
BenGardiner Sep 2, 2026
c2063fa
automotive: J1939 Controller Application (CA) enumeration scanner
BenGardiner Sep 2, 2026
9917b2c
automotive: J1939 package __init__ integration with scapy.contrib.j1939
BenGardiner Sep 2, 2026
93ffd77
automotive: J1939 64-bit NAME decoder and protocol support (J1939-81)
BenGardiner Sep 9, 2026
fbcb5a9
Merge branch 'master' into j1939-soft-sockets-again
BenGardiner Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions scapy/contrib/automotive/j1939/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# SPDX-License-Identifier: GPL-2.0-only
# This file is part of Scapy
# See https://scapy.net/ for more information
# Copyright (C) National Motor Freight Traffic Association Inc.
# <ben.l.gardiner@gmail.com>

# scapy.contrib.description = SAE J1939 (SAE J1939-21) Transport Layer Socket & Diagnostics
# scapy.contrib.status = loads

from scapy.consts import LINUX
from scapy.config import conf

from scapy.contrib.j1939 import (
J1939,
J1939_CAN,
J1939SoftSocket,
NativeJ1939Socket,
J1939TPImplementation,
J1939_BROADCAST_ADDR,
J1939_PGN_TP_CM,
J1939_PGN_TP_DT,
J1939_TP_CTRL_RTS,
J1939_TP_CTRL_CTS,
J1939_TP_CTRL_ACK,
J1939_TP_CTRL_BAM,
J1939_TP_CTRL_ABORT,
can_id_to_j1939,
j1939_to_can_id,
pgn_from_fields,
dst_from_fields,
pgn_is_pdu1,
log_j1939,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

)

J1939_GLOBAL_ADDRESS = J1939_BROADCAST_ADDR
J1939_NULL_ADDRESS = 0xFE
PGN_ADDRESS_CLAIMED = 0xEE00
PGN_REQUEST = 0xEA00
J1939_PF_ADDRESS_CLAIMED = 0xEE
J1939_PF_REQUEST = 0xEA
TP_CM_RTS = J1939_TP_CTRL_RTS
TP_CM_CTS = J1939_TP_CTRL_CTS
TP_CM_EndOfMsgACK = J1939_TP_CTRL_ACK
TP_CM_BAM = J1939_TP_CTRL_BAM
TP_Conn_Abort = J1939_TP_CTRL_ABORT

from scapy.contrib.automotive.j1939.j1939_dm import (
J1939_DTC,
J1939_DM1,
J1939_DM13,
J1939_DM14,
PGN_DM1,
PGN_DM13,
PGN_DM14,
sniff_dm1,
send_dm14_request,
)

from scapy.contrib.automotive.j1939.j1939_scanner import (
_j1939_can_id,
_j1939_decode_can_id,
J1939_TP_CM_PF,
j1939_scan,
j1939_scan_passive,
j1939_scan_addr_claim,
j1939_scan_ecu_id,
j1939_scan_unicast,
j1939_scan_rts_probe,
j1939_scan_uds,
j1939_scan_xcp,
J1939_DIAGADAPTERS_ADDRESSES,
J1939_XCP_SRC_ADDRS,
PGN_ECU_ID,
PGN_DIAG_A,
J1939_PF_DIAG_A,
PGN_DIAG_B,
J1939_PF_DIAG_B,
J1939_PF_XCP,
SCAN_METHODS,
)

from scapy.contrib.automotive.j1939.j1939_dm_scanner import (
DmScanResult,
J1939_DM_PGNS,
J1939_PF_ACK,
PGN_ACK,
j1939_scan_dm,
j1939_scan_dm_pgn,
)


from scapy.contrib.automotive.j1939.j1939_name import (
INDUSTRY_GROUPS,
PRE_ASSIGNED_FUNCTIONS,
INDUSTRY_SPECIFIC_FUNCTIONS,
INDUSTRY_SPECIFIC_VEHICLE_SYSTEMS,
MANUFACTURERS,
J1939NameDecoder,
J1939_NAME,
decode_j1939_name,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you unify this to j1939_decode_name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to comply. But I don't think I grok what the change requested is.

You want me to rename decode_j1939_name -> j1939_decode_name ?

simulate_arbitration,
j1939_request_name,
j1939_request_names,
)

J1939Socket = J1939SoftSocket

__all__ = [
'INDUSTRY_GROUPS',
'PRE_ASSIGNED_FUNCTIONS',
'INDUSTRY_SPECIFIC_FUNCTIONS',
'INDUSTRY_SPECIFIC_VEHICLE_SYSTEMS',
'MANUFACTURERS',
'J1939NameDecoder',
'J1939_NAME',
'decode_j1939_name',
'simulate_arbitration',
'j1939_request_name',
'j1939_request_names',
'J1939',
'J1939_CAN',
'J1939SoftSocket',
'NativeJ1939Socket',
'J1939TPImplementation',
'J1939Socket',
'J1939_BROADCAST_ADDR',
'J1939_GLOBAL_ADDRESS',
'J1939_NULL_ADDRESS',
'log_j1939',
'J1939_DTC',
'J1939_DM1',
'J1939_DM13',
'J1939_DM14',
'PGN_DM1',
'PGN_DM13',
'PGN_DM14',
'sniff_dm1',
'send_dm14_request',
'j1939_scan',
'j1939_scan_passive',
'j1939_scan_addr_claim',
'j1939_scan_ecu_id',
'j1939_scan_unicast',
'j1939_scan_rts_probe',
'j1939_scan_uds',
'j1939_scan_xcp',
'J1939_DIAGADAPTERS_ADDRESSES',
'J1939_XCP_SRC_ADDRS',
'PGN_ECU_ID',
'PGN_DIAG_A',
'J1939_PF_DIAG_A',
'PGN_DIAG_B',
'J1939_PF_DIAG_B',
'J1939_PF_XCP',
'SCAN_METHODS',
'DmScanResult',
'J1939_DM_PGNS',
'J1939_PF_ACK',
'PGN_ACK',
'j1939_scan_dm',
'j1939_scan_dm_pgn',
]
Loading
Loading