Password Gen
Password Gen
PASSWORD GENERATOR
Submitted by
Geeth S MY.SC.I5MCA21046
Under the guidance of
Suresha R
Department of Computer Science,
School of Computing,
Amrita Vishwa Vidyapeetham,
Mysuru, Karnataka, India
2023 - 2024
PASSWORD GENERATOR
Abstract
PyPassGen is a Python-based password generator designed to create strong and secure
passwords for various applications. This project aims to provide users with a reliable tool for
generating unique passwords with customizable parameters such as length, character sets,
and complexity levels. The generator employs cryptographic strength random number
generation to ensure the randomness and unpredictability of generated passwords,
enhancing their resistance to brute-force and dictionary attacks. PyPassGen offers a simple
and intuitive command-line interface, making it accessible to both novice and experienced
users. With its emphasis on security and flexibility, PyPassGen serves as an essential utility
for safeguarding sensitive information in today's digital age.
1. Program
from tkinter import *
from tkinter.ttk import Progressbar
import tkinter
import tkinter.messagebox
import pyperclip
import random, string
no_of_options = 0
length_value = 7
def get_slider_value(value):
global length_value
length_value = int(value)
progress_status()
def progress_status():
global no_of_options, length_value
no_of_options = upper_case.get() * 5 + small_case.get() * 5 +
special_Chars.get() * 5 + num.get() * 5 + length_value * 5
length_progress['value'] = no_of_options
def generate_pass():
global no_of_options, length_value
password = ""
switchCode =
str(upper_case.get())+str(small_case.get())+str(special_Chars.get(
))+str(num.get())
switcher = {
'1100': generate1,
'1101': generate2,
'0001': generate3,
'1111': generate4,
'0100': generate5,
'1000': generate6,
'0010': generate7,
'1001': generate8,
'0101': generate9,
'1010': generate10,
'0110': generate11,
'1110': generate12,
'0011': generate13,
'0111': generate14
}
password_entry.delete(0, END)
password_entry.insert(0, password)
def generate1():
"Upper Smaller"
try:
n = int(length_value)
password = ""
up_sm = string.ascii_uppercase + string.ascii_lowercase
password = password.join(random.sample(up_sm, n))
return password
except:
return "Invalid length_value"
def generate2():
"Upper smaller number"
try:
n = int(length_value)
password = ""
up_sm_num = string.ascii_uppercase + string.ascii_lowercase +
string.digits
password = password.join(random.sample(up_sm_num, n))
return password
except:
return "Invalid length_value"
def generate3():
"Number"
try:
n = int(length_value)
password = ""
num = string.digits
password = password.join(random.sample(num, n))
return password
except:
return "Invalid length_value"
def generate4():
"Upper smaller number special"
try:
n = int(length_value)
password = ""
up_sm_num_spc = string.ascii_uppercase +
string.ascii_lowercase + string.digits + string.punctuation
password = password.join(random.sample(up_sm_num_spc, n))
return password
except:
return "Invalid length_value"
def generate5():
"Smaller"
try:
n = int(length_value)
password = ""
sm = string.ascii_lowercase
password = password.join(random.sample(sm, n))
return password
except:
return "Invalid length_value"
def generate6():
"Upper"
try:
n = int(length_value)
password = ""
up = string.ascii_uppercase
password = password.join(random.sample(up, n))
return password
except:
return "Invalid length_value"
def generate7():
"Special"
try:
n = int(length_value)
password = ""
spc = string.punctuation
password = password.join(random.sample(spc, n))
return password
except:
return "Invalid length_value"
def generate8():
"Upper number"
try:
n = int(length_value)
password = ""
up_num = string.ascii_uppercase + string.digits
password = password.join(random.sample(up_num, n))
return password
except:
return "Invalid length_value"
def generate9():
"Smaller Number"
try:
n = int(length_value)
password = ""
sm_num = string.digits + string.ascii_lowercase
password = password.join(random.sample(sm_num, n))
return password
except:
return "Invalid length_value"
def generate10():
"Upper Special"
try:
n = int(length_value)
password = ""
up_spc = string.ascii_uppercase + string.punctuation
password = password.join(random.sample(up_spc, n))
return password
except:
return "Invalid length_value"
def generate11():
"Smaller Special"
try:
n = int(length_value)
password = ""
sm_spc = string.punctuation + string.ascii_lowercase
password = password.join(random.sample(sm_spc, n))
return password
except:
return "Invalid length_value"
def generate12():
"Smaller Upper Special"
try:
n = int(length_value)
password = ""
sm_up_spc = string.ascii_uppercase + string.ascii_lowercase +
string.punctuation
password = password.join(random.sample(sm_up_spc, n))
return password
except:
return "Invalid length_value"
def generate13():
"Number Spceial"
try:
n = int(length_value)
password = ""
num_spc = string.digits + string.punctuation
password = password.join(random.sample(num_spc, n))
return password
except:
return "Invalid length_value"
def generate14():
"Smaller Number Special"
try:
n = int(length_value)
password = ""
sm_num_spc = string.digits + string.ascii_lowercase +
string.punctuation
password = password.join(random.sample(sm_num_spc, n))
return password
except:
return "Invalid length_value"
def copyclip():
passwordcopy = password_entry["text"]
pyperclip.copy(passwordcopy)
root = Tk()
root.title("Complete Password Generator")
root.geometry("700x300")
num = IntVar()
small_case = IntVar()
upper_case = IntVar()
special_Chars = IntVar()
length = IntVar()
password_str = StringVar()
# Checkboxes
C1 = Checkbutton(root, text="A-Z", variable=upper_case, onvalue=1,
offvalue=0, command=progress_status)
C1.place(x=100, y=40)
C2 = Checkbutton(root, text="a-z", variable=small_case, onvalue=1,
offvalue=0, command=progress_status)
C2.place(x=180, y=40)
C3 = Checkbutton(root, text="0-9", variable=num, onvalue=1,
offvalue=0, command=progress_status)
C3.place(x=250, y=40)
C4 = Checkbutton(root, text="Special Characters",
variable=special_Chars, onvalue=1, offvalue=0,
command=progress_status)
C4.place(x=320, y=40)
# Length scale
s1 = Scale(root, variable=length,
from_=7, to=16,
orient=HORIZONTAL, command=get_slider_value
)
s1.place(x=550, y=40)
scale_lable = Label(root, text="Length",
font=("Arial", 11)).place(x=500, y=40)
root.mainloop()
2. Result
3. Conclusion