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
Binary file removed MRayan.png
Binary file not shown.
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 80+ Python Projects by M.Rayan Asim
# 82 Python Projects by Muhammad Rayan Asim

<p align="center">
<a href="https://mrayanasim09.github.io/python-projects/">
<a href="https://82-python-projects.vercel.app/">
<img src="https://img.shields.io/badge/Visit-Website-blue" alt="Website">
</a>
</p>

---

Welcome to the Python Projects repository. This collection features 80+ practical Python projects across multiple categories, designed for developers of all skill levels. Whether you are a beginner or an experienced programmer, you will find projects that help you learn, build, and grow.
Welcome to the Python Projects repository. Explore 82 practical Python projects across different categories to learn, build, and improve your skills.

---

Expand Down Expand Up @@ -199,7 +199,6 @@ This project is licensed under the [MIT License](LICENSE/) for educational purpo
- [Security Policies](security.md)
- [Project Summary](SUMMARY.md)
- [System Prerequisites](prerequisites.md)
- [Full Documentation](https://mrayans.gitbook.io/python--projects/)

---

Expand All @@ -209,20 +208,6 @@ For common questions and troubleshooting, see the [FAQ](FAQ.md).

---

## Support This Project

If you find these projects valuable, consider supporting the work:

<p align="center">
<a href="https://www.buymeacoffee.com/mrayanasim" target="_blank">
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="40px">
</a>
</p>

**Crypto:** ETH address: `0xEC55fFf7a8387eeaa0Ef886305350Ab3578CE5D3`

---

<p align="center">
<img src="https://img.shields.io/github/repo-size/mrayanasim09/python-projects" alt="Repo Size">
<img src="https://img.shields.io/github/languages/top/mrayanasim09/python-projects" alt="Top Language">
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
34 changes: 26 additions & 8 deletions api/app.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from mangum import Mangum
import os

app = FastAPI()
app = FastAPI(title="Python Projects API")

app.add_middleware(
CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"],
)

@app.get("/")

@app.get("/api")
async def root():
return {"message": "Python Projects — minimal API", "routes": ["/projects"]}
return {"message": "Python Projects — API", "routes": ["/api/projects"]}


@app.get("/projects")
@app.get("/api/projects")
async def projects():
base = os.path.dirname(os.path.dirname(__file__))
items = []
for name in sorted(os.listdir(base)):
if name.startswith('.') or name in ('__pycache__', '.git'):
if name.startswith(".") or name in (
"__pycache__",
".git",
"api",
".venv",
".venv3",
"public",
"assets",
):
continue
path = os.path.join(base, name)
if os.path.isdir(path):
items.append(name)
elif os.path.isfile(path) and name.endswith('.py'):
items.append(name)
items.append({"name": name, "type": "directory"})
elif os.path.isfile(path) and name.endswith(".py"):
items.append({"name": name, "type": "file"})
return {"projects": items}


# Required for Vercel serverless — wraps ASGI app as Lambda handler
handler = Mangum(app)
15 changes: 9 additions & 6 deletions api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
app = FastAPI(title="Python Projects API")

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"],
)


Expand All @@ -23,12 +20,18 @@ async def projects():
base = os.path.dirname(os.path.dirname(__file__))
items = []
for name in sorted(os.listdir(base)):
if name.startswith('.') or name in ('__pycache__', '.git', 'api', '.venv', '.venv3'):
if name.startswith(".") or name in (
"__pycache__",
".git",
"api",
".venv",
".venv3",
):
continue
path = os.path.join(base, name)
if os.path.isdir(path):
items.append({"name": name, "type": "directory"})
elif os.path.isfile(path) and name.endswith('.py'):
elif os.path.isfile(path) and name.endswith(".py"):
items.append({"name": name, "type": "file"})
return {"projects": items}

Expand Down
Loading