Skip to content

Instantly share code, notes, and snippets.

@jack126guy
Created September 1, 2018 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jack126guy/a30ab03a1481771d70ac4826960bbffd to your computer and use it in GitHub Desktop.
Save jack126guy/a30ab03a1481771d70ac4826960bbffd to your computer and use it in GitHub Desktop.
Convert EFF's 3d20 passphrase word files ( https://www.eff.org/deeplinks/2018/08/dragon-con-diceware ) to raw lists
#!/usr/bin/env python3
from argparse import ArgumentParser
import re
arg_parser = ArgumentParser(description="Convert EFF's 3d20 passphrase word files to raw lists")
arg_parser.add_argument("input_file", help="Original word file")
arg_parser.add_argument("output_file", help="Raw word list file")
args = arg_parser.parse_args()
word_line_regex = re.compile("^\d+-\d+-\d+ (.*)$")
with open(args.input_file, "r", errors="replace") as input_file:
with open(args.output_file, "w") as output_file:
for input_line in input_file:
regex_match = word_line_regex.match(input_line)
if regex_match:
output_file.write(regex_match.group(1) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment