Skip to content

Instantly share code, notes, and snippets.

@Ra1d7
Last active March 29, 2022 15:32
Show Gist options
  • Save Ra1d7/9deed2904ec38754eb9373b24b37f0ad to your computer and use it in GitHub Desktop.
Save Ra1d7/9deed2904ec38754eb9373b24b37f0ad to your computer and use it in GitHub Desktop.
import random
long = input('Please enter how long you want your password to be :')
withsym = input('Do you want symbols in your password?(Y/N): ')
passwd = []
passe=''
def dorand():
global passwd
if withsym.lower() == 'y':
type = random.randint(0, 3)
elif withsym.lower() =='n':
type = random.randint(0, 2)
if type == 0:
passwd.append(chr(random.randint(97,122)))
elif type == 1:
passwd.append(chr(random.randint(65,90)))
elif type ==3:
passwd.append(chr(random.randint(35,38)))
elif type ==2:
passwd.append(chr(random.randint(48,57)))
for x in range(0,int(long)):
dorand()
for cher in passwd:
passe=passe+str(cher)
print('\033[32m{}\033[0m'.format(passe))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment