From 97176b6a52780d21f69c864ba11fec14356cfb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 16 Oct 2019 08:49:54 +0200 Subject: [PATCH] Introduce max number of measurements --- break_script/automated_attack.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/break_script/automated_attack.py b/break_script/automated_attack.py index 6e13ed9..e940937 100755 --- a/break_script/automated_attack.py +++ b/break_script/automated_attack.py @@ -9,6 +9,7 @@ import threading from Crypto.Cipher import AES #context.log_level = "debug" +max_measurements = 20000 allowed_chars = string.ascii_letters + string.digits + string.punctuation @@ -104,7 +105,11 @@ key = [] # We keep gathering measurements until we are certain enoguh which key the correct one is while len(key) < 16: - measurements.update(gather_measurements(remotes, 1000)) + if len(measurements) < max_measurements: + measurements.update(gather_measurements(remotes, 1000)) + else: + log.failure("Unable to restore key after using the maximum configured number of measurements. This can mean one of two things: Either we just got very unlucky with the random numbers and this error will not occur again during the next run. In this case this error can be ignored. If this error keeps occuring the challange is broken.") + sys.exit(1) log.info("Total number of unique measurements gathered: {}".format(len(measurements))) # This attack allows us to test each aes key byte independently