Skip to content

Create Password_guess.py #11949

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

Closed
Closed
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
31 changes: 31 additions & 0 deletions other/Password_guess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import random

Check failure on line 1 in other/Password_guess.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (N999)

other/Password_guess.py:1:1: N999 Invalid module name: 'Password_guess'
import os

# Define the list of possible characters

Check failure on line 4 in other/Password_guess.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

other/Password_guess.py:1:1: I001 Import block is un-sorted or un-formatted
pwd = ['a', 'b', 'c', 'd', 'e', 'f', '1', '2', '3', '4', '5', '6',

Check failure on line 5 in other/Password_guess.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W291)

other/Password_guess.py:5:67: W291 Trailing whitespace
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',

Check failure on line 6 in other/Password_guess.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W291)

other/Password_guess.py:6:67: W291 Trailing whitespace
's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

# Input from the user
u_pwd = input("Enter a password: ")

# Initialize an empty string to store the guessed password
pw = ""

while pw != u_pwd:
# Reset the guessed password to an empty string
pw = ""

Check failure on line 18 in other/Password_guess.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W293)

other/Password_guess.py:18:1: W293 Blank line contains whitespace
# Generate a guess by selecting random characters from the pwd list
for _ in range(len(u_pwd)):
guess_pwd = random.choice(pwd)
pw += guess_pwd

# Print progress information
print(f"Attempting to crack password: {pw}")

# Clear the console for the next attempt
os.system("cls" if os.name == 'nt' else "clear")

Check failure on line 28 in other/Password_guess.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (S605)

other/Password_guess.py:28:5: S605 Starting a process with a shell, possible injection detected

# Output the result once the password is found
print(f"Your password is: {pw}")
Loading