CaringCaribou / caringcaribou

A friendly car security exploration tool for the CAN bus
GNU General Public License v3.0
738 stars 193 forks source link

Inconsistent use of padding in xcp module. #77

Closed LukasMarckmiller closed 1 year ago

LukasMarckmiller commented 1 year ago

Is there a reason why the padding is omitted for xcp connect in line: https://github.com/CaringCaribou/caringcaribou/blob/b664536f28f34afec1bdefc8bbf60d01f64f3649/tool/modules/xcp.py#L471

but not for other xcp subfunctions like the command discovery: https://github.com/CaringCaribou/caringcaribou/blob/b664536f28f34afec1bdefc8bbf60d01f64f3649/tool/modules/xcp.py#L241-L246

Without padding the ECU receives frames that are not consistently 8 bytes which leads to problems parsing the frame.

Suggested fix: Consistent use of padding and change https://github.com/CaringCaribou/caringcaribou/blob/b664536f28f34afec1bdefc8bbf60d01f64f3649/tool/modules/xcp.py#L471

to

can_wrap.send_single_message_with_callback([0xff, 0, 0, 0, 0, 0, 0, 0], handle_connect_reply)
LukasMarckmiller commented 1 year ago

I'll wait for feedback before submitting a PR. :)

kasperkarlsson commented 1 year ago

Great catch, a PR would be most welcome 👍