Skip to content

Instantly share code, notes, and snippets.

@muayyad-alsadi
Created December 29, 2022 12:13
Show Gist options
  • Save muayyad-alsadi/64c1f2c10c8e5fd25ab21ae06040720e to your computer and use it in GitHub Desktop.
Save muayyad-alsadi/64c1f2c10c8e5fd25ab21ae06040720e to your computer and use it in GitHub Desktop.
priority cracker
import random
import itertools
ord_a = ord('a')
ord_z = ord('z')
ord_A = ord('A')
ord_Z = ord('Z')
alpha = [chr(i) for i in range(ord_a, ord_z)]
ALPHA = [chr(i) for i in range(ord_A, ord_Z)]
alphanum = alpha+ALPHA+list('0123456789')
def sample_pass_alpha(max_len=32):
l = random.randint(1, max_len)
return ''.join([chr(random.randint(ord_a, ord_z)) for i in range(l)])
def sample_pass_ALPHA(max_len=32):
l = random.randint(1, max_len)
return ''.join([chr(random.randint(ord_A, ord_Z)) for i in range(l)])
def sample_pass_alphanum(max_len=32):
l = random.randint(1, max_len)
return ''.join([random.choice(alphanum) for i in range(l)])
def sample_pass_all(max_len=32):
l = random.randint(1, max_len)
return ''.join([chr(random.randint(32, 128)) for i in range(l)])
def guess_iter(max_len=32):
while(True):
yield sample_pass_alpha(max_len)
yield sample_pass_ALPHA(max_len)
yield sample_pass_alphanum(max_len)
yield sample_pass_all(max_len)
def test():
it = guess_iter()
for i in itertools.islice(it, 1000):
print(i)
if __name__ == '__main__':
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment