From 9f334eba78a936e58dfaf843b4519d92ba067fd5 Mon Sep 17 00:00:00 2001 From: Greg Farr Date: Mon, 21 Sep 2020 11:19:45 +0200 Subject: [PATCH 1/3] cli args usage message --- pin_generator.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/pin_generator.py b/pin_generator.py index 4a2661f..85480a1 100644 --- a/pin_generator.py +++ b/pin_generator.py @@ -2,15 +2,21 @@ # By https://github.com/hacker41d4n/ import random -chars ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+}{" -length = int(input("Enter password length ")) -password="" -for i in range(length+1): - password += random.choice(chars) -print(password) +import sys + +# ---- Handle arguments ---- +if len(sys.argv) < 2: + print("Usage: " + sys.argv[0] + " ") + sys.exit(1) + +# ---- Variables ---- +length = int(sys.argv[1]) +charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+}{" +password = str() -# Sample output : -# -# -# Enter password length 8 -# l#9RX!ufa \ No newline at end of file +# ---- Work ----- +for i in range(length): + password += random.choice(charset) + +# --------- Output ------------- +print(password) From c9230be707a3d54cc02f4db33175f24eb662bd71 Mon Sep 17 00:00:00 2001 From: Greg Farr Date: Mon, 21 Sep 2020 11:23:06 +0200 Subject: [PATCH 2/3] copy generated password to clipboard --- pin_generator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pin_generator.py b/pin_generator.py index 85480a1..92d8938 100644 --- a/pin_generator.py +++ b/pin_generator.py @@ -3,6 +3,7 @@ import random import sys +import pyperclip # ---- Handle arguments ---- if len(sys.argv) < 2: @@ -19,4 +20,5 @@ password += random.choice(charset) # --------- Output ------------- -print(password) +print(str(length) + ' character password copied to clipboard.') +pyperclip.copy(password) From f049c35246542a47ad3a491958fda575582520f5 Mon Sep 17 00:00:00 2001 From: Greg Farr Date: Mon, 21 Sep 2020 11:25:37 +0200 Subject: [PATCH 3/3] updated readme --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bc5e92..a59b06b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,28 @@ # PIN_Generator -NOTE RUN THIS PROGRAM IN PYTHON3 +NOTE RUN THIS PROGRAM IN PYTHON3 matrix This password generator can go max 900,000 Characters for me it may be diffrent for you. + +## Prerequisites +This project requires the _pyperclip_ module, please install it. + +``` + +pip install pyperclip + +``` + +## Usage +python pin_generator.py + +E.g. + +``` + +python pin_generator.py 50 + +``` + +The generated password will be copied to your system's clipboard.