1import string
2from random import *
3characters = string.ascii_letters + string.punctuation + string.digits
4password = "".join(choice(characters) for x in range(randint(8, 16)))
5print password
6
1import random
2chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@£$%^&*().,?0123456789'
3
4number = input('Please enter a number of passwords.')
5try:
6 number = int(number)
7except:
8 print("Error, please enter a number!")
9
10length = input('Length of password?')
11try:
12 length = int(length)
13except:
14 print("Error, please enter a number!")
15
16print('\nHere are your password(s):')
17
18for pwd in range(number):
19 password = ''
20 for c in range(length):
21 password += random.choice(chars)
22 print(password)
1import random
2
3alph = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ\
4 abcdefghijklmnopqrstuvwxyz\
5 1234567890 !@#$%^&*(){}[]<>,.')
6out = ''
7for char in string:
8 out += random.choice(alph)
9
10print(out)
1from tkinter import *
2from random import randint
3
4root = Tk()
5root.title('Codemy.com - Strong Password Generator')
6root.iconbitmap('c:/gui/codemy.ico')
7root.geometry("500x300")
8
9
10# Generate Random Strong Password
11def new_rand():
12 # Clear Our Entry Box
13 pw_entry.delete(0, END)
14
15 # Get PW Length and convert to integer
16 pw_length = int(my_entry.get())
17
18 # create a variable to hold our password
19 my_password = ''
20
21 # Loop through password length
22 for x in range(pw_length):
23 my_password += chr(randint(33,126))
24
25 # Output password to the screen
26 pw_entry.insert(0, my_password)
27
28
29# Copy to clipboard
30def clipper():
31 # Clear the clipboard
32 root.clipboard_clear()
33 # Copy to clipboard
34 root.clipboard_append(pw_entry.get())
35
36# Label Frame
37lf = LabelFrame(root, text="How Many Characters?")
38lf.pack(pady=20)
39
40# Create Entry Box To Designate Number of Characters
41my_entry = Entry(lf, font=("Helvetica", 24))
42my_entry.pack(pady=20, padx=20)
43
44# Create Entry Box For Our Returned Password
45pw_entry = Entry(root, text='', font=("Helvetica", 24), bd=0, bg="systembuttonface")
46pw_entry.pack(pady=20)
47
48# Create a frame for our Buttons
49my_frame = Frame(root)
50my_frame.pack(pady=20)
51
52# Create our Buttons
53my_button = Button(my_frame, text="Generate Strong Password", command=new_rand)
54my_button.grid(row=0, column=0, padx=10)
55
56clip_button = Button(my_frame, text="Copy To Clipboad", command=clipper)
57clip_button.grid(row=0, column=1, padx=10)
58
59root.mainloop()
60
61
1import random
2
3print("Welcome to your own password Generator")
4
5cherecters_for_Genarating_password = ("1234567890qwertyuiopasdfghjklzxcvnmQWERTYUIOPASDFGHJKLZXCVNM*&%$#@!")
6try:
7
8 TO_GENERATE = int(input("How many passwords you have to create:- "))
9
10 #print(TO_GENERATE)
11
12 Length_of_password = int(input("What should be the lenth of your password:- "))
13
14 print("So these are your passwords:- ")
15 #main code
16 for passw in range(TO_GENERATE+1):
17 print(" or")
18 password = ""
19 for should_apply in range (Length_of_password):
20 password += random.choice(cherecters_for_Genarating_password)
21 print(password)
22
23 print("Are these passwords satisfing you Y/N")
24 satisfing = str(input())
25
26 if satisfing == "Y" or satisfing == "y":
27 print("Ok sir Thanks")
28 elif satisfing == "N" or satisfing == "n":
29 print("So these are your passwords Again:- ")
30 for passw in range(TO_GENERATE):
31 password = ""
32 for should_apply in range (Length_of_password):
33 password += random.choice(cherecters_for_Genarating_password)
34 print(password)
35 else:
36 print("incorrect input")
37except ValueError:
38 print("Incorrect input Sorry")