File tree Expand file tree Collapse file tree 6 files changed +28
-0
lines changed Expand file tree Collapse file tree 6 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ # This script bridges two CAN interfaces, so that anything received on one is
2+ # sent on the other, and vice-versa.
3+
14from __future__ import print_function
25import sys
36import can
Original file line number Diff line number Diff line change 1+ # This ugly python script is designed to scan the OBD2 / UDS range looking for
2+ # things the board responds to. It includes a list of standard packets that the
3+ # board already randomly emits, so we can filter those out.
4+
15from __future__ import print_function
26import sys
37import can
Original file line number Diff line number Diff line change 1+ # This is the seed->key function that the board uses to determine if we're
2+ # allowed security access. I transcribed this in case we needed to get it right
3+ # on the first try. Turns out to have been wasted effort.
4+
15def nswap (c ):
26 return (c >> 4 ) | (c << 4 & 0xf0 )
37
Original file line number Diff line number Diff line change @@ -499,6 +499,14 @@ Examples:
499499 - possibly it tracks number of attempts and you'd need to reset if exceeded
500500
501501What we have might be a custom variant
502+ ### Online References
503+ https://hackaday.com/2013/10/29/can-hacking-protocols/
504+ - service ids
505+ - CAN frame format
506+ https://automotiveembeddedsite.wordpress.com/uds/
507+ - more details
508+ https://en.wikipedia.org/wiki/ISO_15765-2
509+ - correct framing rules
502510
503511## Can Setup
504512ip link show dev can0
Original file line number Diff line number Diff line change 1+ # This code is to dump a section of firmware, assuming we already have security
2+ # access. It's "good enough" code, I'm sure I could have refined it, but there
3+ # wasn't any need. Re-running it until I happened to get clean "uploads" was
4+ # good enough.
5+
16from __future__ import print_function
27import sys
38import can
Original file line number Diff line number Diff line change 1+ # This script enabled "Security Access" to the chosen AID. The original version
2+ # brute-forced the key space, but post-dump, I changed it to compute the
3+ # correct response on the first try.
4+
15from __future__ import print_function
26import sys
37import can
You can’t perform that action at this time.
0 commit comments