Skip to content

Instantly share code, notes, and snippets.

@mustafaxfe
Last active November 16, 2015 07:16
Show Gist options
  • Save mustafaxfe/93c708c91bc24d09b430 to your computer and use it in GitHub Desktop.
Save mustafaxfe/93c708c91bc24d09b430 to your computer and use it in GitHub Desktop.
Hi, I have created a python script for creating strong passwords for singing a website. You can use it for creating a strong password easily. It is written by Mustafa Sarialp and its licence Public Domain.
#!/usr/bin/env python3
# ===============================================================================================================================
# Name : create_password.py
# Author : Mustafa Sarialp
# Version : 1.0.2
# Copyright : Public Domain
# Description : A python 3 script which creates strong passwords ( 12 character long) to use like singup... You can use it freely.
# ================================================================================================================================
import random
def create_password():
password = []
new_password = ''
letters = 'abcdefghijklmnopqrstuvwxyz'
characters = '!+%&/{([)]=}?*'
for i in range(12):
letter = random.choice(letters)
character = random.choice(characters)
number = random.randrange(0, 10, 1)
if i % 3 == 0:
if i / 3 > 2:
password.append(letter.capitalize())
else:
password.append(letter)
elif i % 2 == 0:
password.append(character)
else:
password.append(str(number))
random.shuffle(password)
new_password += random.choice(letters)
for j in range(12):
new_password += password.pop()
return new_password
if __name__ == '__main__':
key = ''
while key != 'q':
my_passwd = create_password()
print("You can use: ", my_passwd, " as your password.")
key = input("To create new one press 'c' or to quit press 'q': ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment