You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
651 B
Python

#!/usr/bin/env python3
import random
def generate_pw(length):
import string
charset = string.ascii_letters + string.digits + '+-_?!.:,;';
return ''.join([random.choice(charset) for _ in range(length)])
def main():
import sys
import os
import time
import win32clipboard
if len(sys.argv) > 1:
length = int(sys.argv[1])
else:
length = 12
pw = generate_pw(length)
print(pw)
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(pw, win32clipboard.CF_UNICODETEXT)
win32clipboard.CloseClipboard()
if __name__ == '__main__':
main()