Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password breaker and Generator file has been added to python section #156

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Password breaker and password generator
import random
import time
ch = "abcdefghijklmnopqurstuvwxyz1234567890!@#$%^&*()--+=AVCDEFGHIJKLMNOPQRSTUVWXYZ"
guess=''
password=""
length = int(input("Enter the length"))
lngth_half=int(length/2)
for i in range(lngth_half):
password += random.choice(ch[:4])
for i in range(0,length-lngth_half):
password += random.choice(ch)
print(password)
user_inpt=input("You want to know if your password is easily breakable? (Yes/No)\n")
def passbrk():
while True:
guess=random.choices(ch, k=len(password))
guess=''.join(guess)
print(guess)
if guess==password:
print(f"Your pass is {guess}")
break
init = time.time()
strong =time.time()-init
if user_inpt=="Yes":
a = passbrk()
print(f"Time taken in is {strong}s")
else:
print("You didn't choose your password to be broken")
if strong >= 100:
print("Your password was stronger and was tough to break")
else:
print("Your pass was easily breakable")