Advertisement
Guest User

PassGen

a guest
Sep 19th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import random
  2. from colorama import init,Style,Fore,Back
  3. init()
  4.  
  5. def generate():
  6.     chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO\
  7.    PQRSTUVWXYZ0123456789`~!@#$%^&*()_+=-|\\}]{[:;\"\'?/.>,<"
  8.    
  9.     print(Style.BRIGHT + Fore.GREEN + 'Password length: \n>>> ',end='')
  10.     pw_length = int(input(''))
  11.     print('Number of passwords: \n>>> ',end='')
  12.     num_of_pw = int(input(''))
  13.    
  14.    
  15.     pw = ''
  16.     pw_list = ''
  17.  
  18.     for i in range(num_of_pw):
  19.         for i in range(pw_length):
  20.             next_index = random.randrange(len(chars))
  21.             pw = pw + chars[next_index]
  22.            
  23.         pw_list = pw + '\n'
  24.        
  25.     print(Style.RESET_ALL + Fore.RESET, end='')
  26.     print(pw_list)
  27.    
  28.     #return pw_list
  29.    
  30. generate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement