🔐 Why Encrypt Files?
Prevents unauthorized access to sensitive data.
Encryption scrambles the content using a key.
⚙️Libraries Used:
python
CopyEdit
from [Link] import Fernet
Install: pip install cryptography
🧪 Code Snippet:
python
CopyEdit
from [Link] import Fernet
# Generate key
key = Fernet.generate_key()
with open("[Link]", "wb") as k:
[Link](key)
# Encrypt file
f = Fernet(key)
with open("[Link]", "rb") as file:
original = [Link]()
encrypted = [Link](original)
with open("[Link]", "wb") as encrypted_file:
encrypted_file.write(encrypted)
📌 Notes:
[Link] stores the encryption key.
Encrypts the content of [Link].
🐍 Python for Cybersecurity – Notes
Topic: 3. Email Phishing Link Detector
Subject: Python Programming
Semester: 4
🧠 What’s Phishing?
Phishing uses fake emails/websites to trick users into revealing data.
Suspicious links are a common giveaway.
🧪 Code Snippet:
python
CopyEdit
def is_phishing_link(link):
if "@" in link or [Link]('.') > 3 or "http" not in link:
return "Suspicious ⚠️"
elif "[Link]" in link or "tinyurl" in link:
return "Potential Phishing ⚠️"
else:
return "Safe ✅"
# Example
link = input("Paste URL: ")
print(is_phishing_link(link))
📌 Notes:
Simple heuristics to catch fishy URLs.
Use case: first step toward automated phishing email scanners.