0% found this document useful (0 votes)
12 views2 pages

? Why Encrypt Files

The document discusses the importance of file encryption to prevent unauthorized access to sensitive data, providing a code snippet for encrypting files using Python's cryptography library. It also explains phishing, highlighting how fake emails and websites can deceive users, and includes a code snippet for detecting suspicious links. The notes emphasize the storage of encryption keys and the use of heuristics for identifying potential phishing links.

Uploaded by

poorvibhat2k5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

? Why Encrypt Files

The document discusses the importance of file encryption to prevent unauthorized access to sensitive data, providing a code snippet for encrypting files using Python's cryptography library. It also explains phishing, highlighting how fake emails and websites can deceive users, and includes a code snippet for detecting suspicious links. The notes emphasize the storage of encryption keys and the use of heuristics for identifying potential phishing links.

Uploaded by

poorvibhat2k5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🔐 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.

You might also like