scapy icon indicating copy to clipboard operation
scapy copied to clipboard

UDS-Scanner - Add packet delay

Open Loris1123 opened this issue 2 years ago • 2 comments

Hi all,

currently, I'm investigating an ECU, which has some issues when too many packets are being sent. Maybe some buffers are running full. The ECU stops responding, a restart is required. This also happens when using UDS_Scanner.

I solved this by adding a small sleep in /scapy/contrib/automotive/scanner/enumerator.py

def execute(self, socket, state, **kwargs):
    [...]
    for req in it:
        time.sleep(0.05)
        res = self.sr1_with_retry_on_error(req, socket, state, timeout)
    [...]

I don't know if this is a widespread issue, but maybe it's useful adding a configurable packet delay to UDS_Scanner

Loris1123 avatar Mar 16 '23 13:03 Loris1123

Thanks for the feedback. Could you please submit a PR? I think a proper name for such an argument would be inter to follow the naming of Scapys sr1 function. Also, the sleep should be after the sr1 function inside the execute.

However, I'm wondering why your ECU is not slowing down the communication with the FlowControl options on ISOTP. Are your sure, the bug in your ECU is related to UDS and not to ISOTP?

polybassa avatar Mar 16 '23 19:03 polybassa

Another question,

have you tried to use the argument

:param frame_txtime: Separation time between two CAN frames during send

on your ISOTPSocket?

polydroi avatar Mar 16 '23 19:03 polydroi

Closed because of inactivity

polybassa avatar Apr 10 '24 09:04 polybassa

Actually, I will provide a pr soon

polybassa avatar Apr 10 '24 09:04 polybassa