Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tinydb import TinyDB
- db = TinyDB('./db.json')
- import random
- import string
- import time
- print("Password Generator\n*NOTE - in Pass Gen v2, if you decide to make multiple passwords at once, it only saves the last one\n\n\tMade by Kxffie\n")
- time.sleep(1)
- profileName = input("What profile would you want to save this to? (i.e. Minecraft Password): ")
- passLimit = int(input("How long do you want your password(s) to be: "))
- passAmount = int(input("How many passwords do you want: "))
- options = int(input("Options:\n"+"\t1. Just Letters \t2. Letters & Numbers \t3. Letters, Numbers & Punctiation: "))
- def insert():
- if(options == 1):
- for i in range(passAmount):
- randomChar = ''.join(random.sample(string.ascii_letters, k=passLimit))
- print(randomChar)
- elif(options == 2):
- for i in range(passAmount):
- randomChar = ''.join(random.sample(string.ascii_letters + string.digits + string.octdigits, k=passLimit))
- print(randomChar)
- elif(options == 3):
- for i in range(passAmount):
- randomChar = ''.join(random.sample(string.ascii_letters + string.punctuation + string.hexdigits + string.octdigits + string.digits, k=passLimit))
- print(randomChar)
- db.insert({'profile': profileName, 'password': ''.join(randomChar)})
- insert()
- time.sleep(1)
- input("\nPress Enter to exit...")
Advertisement
Add Comment
Please, Sign In to add comment