From d0f3f0ba31cecbcec34b7d3b1eea1dea4abfa90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Wed, 27 Jan 2021 11:44:08 +0100 Subject: [PATCH] Remove redundant whitespace in possible chars --- runall.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runall.py b/runall.py index 31069ca..691086b 100644 --- a/runall.py +++ b/runall.py @@ -1,7 +1,8 @@ from itertools import product -import string import subprocess +chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ' + def check_pair(script, instr, outstr): result = subprocess.run( @@ -21,12 +22,14 @@ def check_pairs(script, pairs): def find_script(pairs, max_length): candidates = [] - chars = len(string.printable) - total_options = int((chars ** (max_length + 1) - 1) / (chars - 1)) + chars_count = len(chars) + total_options = int((chars_count ** (max_length + 1) - 1) / (chars_count - 1)) current_option = 0 for length in range(max_length + 1): - for letters in product(string.printable, repeat=length): + for letters in product(chars, repeat=length): + current_option += 1 + if current_option % 1000 == 0: print(f"Progress: {current_option}/{total_options}") @@ -36,8 +39,6 @@ def find_script(pairs, max_length): print("> Found candidate:", script) candidates.append(script) - current_option += 1 - print("Candidates:", candidates)