Last active
July 11, 2018 10:15
-
-
Save lleixat/e1631ff635b992888715f503d53adeee to your computer and use it in GitHub Desktop.
Generate left hand password for FR keyboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # | |
| # Generate left hand password for FR keyboard | |
| # Original found here : http://code.activestate.com/recipes/577930-left-handed-password-generator/ | |
| # | |
| import argparse | |
| import random | |
| parser = argparse.ArgumentParser(description='Generate a left-handed random password.') | |
| parser.add_argument('-n', action='store', dest='passNum', default=1, type=int, help='Number of passwords to generate.') | |
| parser.add_argument('-l', action='store', dest='passLen', default=8, type=int, help='Length of password') | |
| parser.add_argument('-s', action='store', dest='passStrength', default=4, type=int, help='Strength of password (1-4)') | |
| lowerChars = "azertyqsdfgwxcvb" | |
| upperChars = "AZERTYQSDFGWXCVB" | |
| lowerNum = "123456"*3 # repeated digits for 'weight' | |
| upperNum = '²&é"i\'(-'*3 | |
| results=parser.parse_args() | |
| # Generate character to select from according to passStrength (-s) | |
| if results.passStrength == 1: | |
| leftHand = lowerChars | |
| elif results.passStrength == 2: | |
| leftHand = lowerChars+upperChars | |
| elif results.passStrength == 3: | |
| leftHand = lowerChars+upperChars+lowerNum | |
| elif results.passStrength == 4: | |
| leftHand = lowerChars+upperChars+lowerNum+upperNum | |
| for i in range(results.passNum): | |
| leftPass = '' | |
| for j in range(results.passLen): | |
| leftPass = leftPass + leftHand[random.randint(0,len(leftHand)-1)] | |
| print(leftPass) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment