Coding · Python

Random password generator in Python with custom keyboard shortcut

I use different, randomly generated passwords for all my accounts. I have used a website to generate those before, but today I wrote a small script to handle this job. The main idea is based on this StackOverflow question, which I adapted and extended to suit my needs. It’s probably not completely cryptographically safe as pointed out by some reactions in the thread linked above, but it is for sure good enough for my application.

This script can be executed as a command line script and if executed with -v it will print a password from letters and characters, and a second one also including symbols. Optionally the length can be changed using -l.

More useful, I set a custom keyboard shortcut to execute this script, and the call to pyperclip.copy() will load the generated password in my clipboard, so I can conveniently paste it, wherever I need it.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s