Skip to content

Instantly share code, notes, and snippets.

@wolfieorama
Last active October 19, 2020 15:16
Show Gist options
  • Save wolfieorama/c53e44aed4aca6e94da4e9be25898e57 to your computer and use it in GitHub Desktop.
Save wolfieorama/c53e44aed4aca6e94da4e9be25898e57 to your computer and use it in GitHub Desktop.
// this script computes the fraction of passwords guessed after a certain number of guesses
import argparse
parser = argparse.ArgumentParser(description='Computing lambda')
parser.add_argument('data', type=str,
help='data file with frequency against the password')
args = parser.parse_args()
guessing = [g.strip() for g in open(args.data, encoding='utf-8', errors='ignore')]
g_dict = {}
for g in guessing:
if " " in g: # check for valid frequency - password pairs
p = g.split(" ")
g_dict.update({p[1]: p[0]})
for i, j in g_dict.items():
print(i, " ", j)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment