Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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