From c188ae6f333250654f66ae998c9da90eb22484de Mon Sep 17 00:00:00 2001 From: Freezed Date: Mon, 9 Mar 2020 22:54:05 +0100 Subject: [PATCH 1/2] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 83a6c2b..652965a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *__pycache__* .scores */.* +*.pyc From dc5e4d720b2110cb95a651a29cbc33b7e2b8a64f Mon Sep 17 00:00:00 2001 From: Freezed Date: Mon, 9 Mar 2020 23:06:14 +0100 Subject: [PATCH 2/2] Add password generator --- xkcd-password.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 xkcd-password.py diff --git a/xkcd-password.py b/xkcd-password.py new file mode 100644 index 0000000..a6df50f --- /dev/null +++ b/xkcd-password.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# coding: utf8 + +""" +Author: freezed 2020-01-16 +Licence: `GNU GPL v3` GNU GPL v3: http://www.gnu.org/licenses/ +Inspiration: + - https://docs.python.org/3/library/secrets.html#recipes-and-best-practices + - https://xkcd.com/936/ +""" +import secrets + +with open("/usr/share/dict/words") as f: + words = [word.strip() for word in f if len(word) == 7] + for i in range(10): + password = "-".join(secrets.choice(words) for i in range(5)) + + print(password)