Skip to content

hsfz: incorrect_tester_address packets have addressing. #4771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions scapy/contrib/automotive/bmw/hsfz.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ class HSFZ(Packet):

def _hasaddrs(self):
# type: () -> bool
# Address present in diagnostic_req_res, acknowledge_transfer and
# two byte length alive_check frames.
# Address present in diagnostic_req_res, acknowledge_transfer,
# two byte length alive_check and incorrect_tester_address frames.
return self.control == 0x01 or \
self.control == 0x02 or \
(self.control == 0x12 and self.length == 2)
(self.control == 0x12 and self.length == 2) or \
self.control == 0x40

def _hasidstring(self):
# type: () -> bool
Expand Down
8 changes: 8 additions & 0 deletions test/contrib/automotive/bmw/hsfz.uts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ assert pkt.source == 0x00
assert pkt.target == 0xf4


= Dissect incorrect tester address
pkt = HSFZ(bytes.fromhex("000000020040fff4"))
assert pkt.length == 2
assert pkt.control == 0x40
assert pkt.source == 0xff
assert pkt.target == 0xf4


= Test HSFZSocket

server_up = threading.Event()
Expand Down