@@ -57,10 +57,10 @@ class SASeedsDumperConfig(UDSScannerConfig):
5757
5858
5959class SASeedsDumper (UDSScanner ):
60- """This scanner tries to enable ProgrammingSession and dump seeds for 12h ."""
60+ """This scanner tries to dump SecurityAccess seeds ."""
6161
6262 CONFIG_TYPE = SASeedsDumperConfig
63- SHORT_HELP = "dump security access seeds"
63+ SHORT_HELP = "dump SecurityAccess seeds"
6464
6565 attempt_reset : bool = False
6666 is_key_length_determined : bool = False
@@ -166,6 +166,18 @@ async def main(self) -> None:
166166 # Start with length 1 in automatic search
167167 self .key_length = 1
168168
169+ # When resets are only triggered on demand (self.config.reset == 0), their impact on the
170+ # time required for key length determination is usually minimal. Thus, the following
171+ # notice should only be printed if resets are explicitly forced every n-th attempt by
172+ # the user.
173+ if (self .config .reset is not None ) and (self .config .reset > 0 ):
174+ logger .notice (
175+ "You combined '--reset N' with '--send-zero-key' without providing a key "
176+ "length. Automatically determining the key size expected by the ECU in this "
177+ "setting might be very slow. Consider not forcing resets or set the key length "
178+ "explicitly if it is known."
179+ )
180+
169181 while duration <= 0 or time .time () - start_time < duration :
170182 # Print information about current dump speed every `interval` seconds.
171183 # As request/response times can jitter a few seconds, we 'arm' the print
@@ -174,10 +186,16 @@ async def main(self) -> None:
174186 i = int (time .time () - start_time ) % interval
175187 if i >= interval // 2 :
176188 print_speed = True
177- elif i < interval // 2 and print_speed is True :
189+ # Print dump speed only when actually dumping seeds, not while determining the key size,
190+ # as this will lead to confusing output.
191+ elif i < interval // 2 and print_speed is True and self .is_key_length_determined :
178192 self .log_size (seeds_file , time .time () - start_time )
179193 print_speed = False
180194
195+ if self .config .sleep is not None :
196+ logger .info (f"Sleeping for { self .config .sleep } seconds between seed requests…" )
197+ await asyncio .sleep (self .config .sleep )
198+
181199 if self .config .reset is not None :
182200 if (self .config .reset == 0 and self .attempt_reset ) or (
183201 self .config .reset > 0 and requests_since_last_reset == self .config .reset
@@ -240,10 +258,6 @@ async def main(self) -> None:
240258 logger .critical (f"Error while sending key: { g_repr (e )} " )
241259 sys .exit (1 )
242260
243- if self .config .sleep is not None :
244- logger .info (f"Sleeping for { self .config .sleep } seconds between seed requests…" )
245- await asyncio .sleep (self .config .sleep )
246-
247261 file .close ()
248262 self .log_size (seeds_file , time .time () - start_time )
249263 await self .ecu .leave_session (session , sleep = self .config .power_cycle_sleep )
0 commit comments