Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion Game/colox.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@

# enemy position
e_p = [width, random.randint(50, height - 50)] # nosec B311
e1_p = [random.randint(width, width + 100), random.randint(50, height - 100)] # nosec B311
e1_p = [
random.randint(width, width + 100),
random.randint(50, height - 100),
] # nosec B311


# function for game_over
Expand Down
24 changes: 18 additions & 6 deletions Game/snake_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@
snake_length = 1

# Spawn the first food
food_x = round(random.randrange(0, window_width - segment_size) / 20.0) * 20.0 # nosec B311
food_y = round(random.randrange(0, window_height - segment_size) / 20.0) * 20.0 # nosec B311
food_x = (
round(random.randrange(0, window_width - segment_size) / 20.0) * 20.0
) # nosec B311
food_y = (
round(random.randrange(0, window_height - segment_size) / 20.0) * 20.0
) # nosec B311

# Game over flag
game_over = False
Expand Down Expand Up @@ -87,8 +91,12 @@
# Play eat sound effect
eat_sound.play()
# Spawn new food
food_x = round(random.randrange(0, window_width - segment_size) / 20.0) * 20.0 # nosec B311
food_y = round(random.randrange(0, window_height - segment_size) / 20.0) * 20.0 # nosec B311
food_x = (
round(random.randrange(0, window_width - segment_size) / 20.0) * 20.0
) # nosec B311
food_y = (
round(random.randrange(0, window_height - segment_size) / 20.0) * 20.0
) # nosec B311

# Create new segment and add to snake's body
snake_segments.append((snake_head_x, snake_head_y))
Expand Down Expand Up @@ -171,11 +179,15 @@
snake_length = 1
# Spawn new food
food_x = (
round(random.randrange(0, window_width - segment_size) / 20.0) # nosec B311
round(
random.randrange(0, window_width - segment_size) / 20.0
) # nosec B311
* 20.0
)
food_y = (
round(random.randrange(0, window_height - segment_size) / 20.0) # nosec B311
round(
random.randrange(0, window_height - segment_size) / 20.0
) # nosec B311
* 20.0
)
game_over = False
Expand Down
16 changes: 9 additions & 7 deletions Utilities/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_wifi_profiles():
capture_output=True,
text=True,
shell=False, # nosec B603
check=True
check=True,
)
output = result.stdout

Expand Down Expand Up @@ -63,7 +63,7 @@ def get_wifi_password(profile):
"""
if not profile:
return None

try:
# Use full path to netsh.exe for security
# shell=False is explicit (default in subprocess.run)
Expand All @@ -72,7 +72,7 @@ def get_wifi_password(profile):
capture_output=True,
text=True,
shell=False, # nosec B603
check=True
check=True,
)
output = result.stdout

Expand All @@ -97,10 +97,10 @@ def get_wifi_password(profile):
def main():
"""Main function to display Wi-Fi profiles and passwords."""
# Check if running on Windows
if not sys.platform.startswith('win'):
if not sys.platform.startswith("win"):
print("Error: This tool only works on Windows operating systems.")
return

# Get Wi-Fi profiles
profiles = get_wifi_profiles()

Expand All @@ -116,8 +116,10 @@ def main():
password = get_wifi_password(profile)
print("{:<30} | {:<}".format(profile, password or ""))
print("=" * 50)

print("\nNote: This information is retrieved from your system's saved Wi-Fi profiles.")

print(
"\nNote: This information is retrieved from your system's saved Wi-Fi profiles."
)
print("Keep this information secure and do not share it with others.")


Expand Down
14 changes: 11 additions & 3 deletions Utilities/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
warnings.warn(
"MD5 is cryptographically broken and insecure. "
"This tool can only attempt to crack MD5 hashes for educational purposes.",
UserWarning
UserWarning,
)
try:
with open(pass_doc, "r", errors="ignore") as pass_file:
Expand All @@ -32,7 +32,11 @@
break

except FileNotFoundError:
print("Error: " + pass_doc + " is not found. Please provide the correct file path.")
print(
"Error: "
+ pass_doc
+ " is not found. Please provide the correct file path."
)
quit()

if not pass_found:
Expand All @@ -48,7 +52,11 @@
pass_found = True
break
except FileNotFoundError:
print("Error: " + pass_doc + " is not found. Please provide the correct file path.")
print(
"Error: "
+ pass_doc
+ " is not found. Please provide the correct file path."
)
quit()
except Exception as e:
print(f"Error checking password: {e}")
Expand Down
6 changes: 3 additions & 3 deletions Utilities/password_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
str2hash = input("Enter password to hash: ")

# Check if user wants MD5 (for educational purposes only)
use_md5 = input("Use MD5 (insecure)? (y/n): ").lower() == 'y'
use_md5 = input("Use MD5 (insecure)? (y/n): ").lower() == "y"

if use_md5:
warnings.warn(
"MD5 is cryptographically broken and should NOT be used for password hashing. "
"Use bcrypt instead. This is for educational purposes only.",
UserWarning
UserWarning,
)
# Using MD5 only for educational demonstration
result = hashlib.md5(str2hash.encode()) # nosec B324
Expand All @@ -36,7 +36,7 @@
print("The bcrypt hash is: ", end="")
print(hashed.decode())
print("\nThis is a secure hash. Store this in your database.")

# Demonstrate verification
print("\nTo verify a password against this hash, use:")
print("bcrypt.checkpw(password.encode(), hashed_password.encode())")
Expand Down