Index

dotfiles / bf0b61e

My personal dotfiles for Debian/Ubuntu.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1002 Jul 2020 11:34023f8b7Revamp passwdgen.pyJosh Stockin13310G

Blob @ dotfiles / utils / passwdgen.py

application/x-python1055 bytesdownload raw
1#!/usr/bin/env python3
2
3import random
4import sys
5import requests
6
7WORDLIST = requests.get("https://www.mit.edu/~ecprice/wordlist.10000").text.split("\n")
8random.seed()
9random.shuffle(WORDLIST)
10
11def password():
12 random_words = []
13 for x in range(0,4):
14 while True:
15 random.seed()
16 random_word = WORDLIST[random.randint(0, len(WORDLIST))]
17 if len(random_word) > 6:
18 random_words.append(random_word)
19 break
20 return " ".join(random_words)
21
22if __name__ == "__main__":
23 count = 1
24 if len(sys.argv) > 1:
25 if any(
26 help_arg in sys.argv[1:]
27 for help_arg in ["--help", "-help", "-h", "-?", "help", "h", "?"]
28 ):
29 print("Usage: ./passwdgen.py [count=1]")
30 sys.exit(0)
31 try:
32 count = int(sys.argv[1])
33 except ValueError:
34 print("Supplied argument must be int [count]")
35 sys.exit(1)
36 print("Wordlist passwords:")
37 for i in range(count):
38 print(password())
39