Yash Parikh - Lesson Day 6 - Safe Computing
Popcorn Hack 1
Here is how I found the cookie with the name SSID in my browser:
- I opened the developer tools in my browser (Fn+F12)
- I clicked on the “Application” tab
- I clicked on “Cookies” in the left sidebar
- I clicked on the URL of the website I was on
- I searched for the cookie with the name “SSID” in the list of cookies
Popcorn Hack 2
I identified the squares that have traffic lights in them.
Homework Hack 1
Homework Hack 2
import random
def caesar_cipher(text, shift, mode):
result = ""
for char in text:
if char.isalpha():
shift_amount = shift if mode == "encrypt" else -shift
new_char = chr(((ord(char.lower()) - 97 + shift_amount) % 26) + 97)
result += new_char.upper() if char.isupper() else new_char
else:
result += char
return result
mode = input("Do you want to encrypt or decrypt? ").strip().lower()
message = input("Enter your message: ")
shift_input = input("Enter shift value (number of places to shift or 'random'): ").strip().lower()
if shift_input == "random":
shift = random.randint(1, 25)
print(f"Randomly chosen shift value: {shift}")
else:
try:
shift = int(shift_input)
except ValueError:
print("Invalid shift value entered. Defaulting to shift value of 0.")
shift = 0
output = caesar_cipher(message, shift, mode)
print(f"Result: {output}")