Skip to content

Big Idea 5: Safe Computing #17

Description

@Im2008

Safe Computing Hacks & Homework Hacks

Popcorn Hack 1: Cookies

  1. Open Developer Tools using fn + F12 or Ctrl + Shift + I.
  2. Navigate to the Application tab.
  3. Click on Cookies under the "Storage" section.
  4. Select a website from the list to see its cookies.
  5. Identify the following details for a cookie:
    • Name: (E.g., session_id)
    • Value: (Random string assigned by the website)
    • Expiration Date: (E.g., 2025-12-31T23:59:59.000Z)
    • Category:
      • If it disappears after closing the browser → Session Cookie
      • If it stays beyond closing the browser → Persistent Cookie
      • If from the same website you're visiting → First-Party Cookie
      • If from another domain (advertising, tracking) → Third-Party Cookie

Popcorn Hack 2: CAPTCHA

To test CAPTCHA:

  1. Visit a website that uses CAPTCHA (Google reCAPTCHA demo).
  2. Observe how it prevents bots from entering the website.
  3. Try refreshing the page to see different CAPTCHA challenges.

Homework Hack 1: MCQ

1. Which of the following is an example of PII (Personally Identifiable Information)?

  • a) A username like "Gamer_123"
  • b) An IP address
  • c) A Social Security Number
  • d) A device’s battery percentage

Answer: c) A Social Security Number

2. Which type of cookie remains stored even after closing the browser?

  • a) Session Cookie
  • b) Persistent Cookie
  • c) First-Party Cookie
  • d) Third-Party Cookie

Answer: b) Persistent Cookie

3. What is the key difference between symmetric and asymmetric encryption?

  • a) Symmetric encryption uses different keys for encryption and decryption
  • b) Asymmetric encryption uses the same key for encryption and decryption
  • c) Symmetric encryption uses the same key, while asymmetric encryption uses a public-private key pair
  • d) None of the above

Answer: c) Symmetric encryption uses the same key, while asymmetric encryption uses a public-private key pair

4. How can you identify a phishing email?

  • a) It comes from an unknown sender and has suspicious links
  • b) The email asks for personal details like passwords
  • c) It contains urgent messages or threats
  • d) All of the above

Answer: d) All of the above


Homework Hack 2: Modified Caesar Cipher Code

Here’s the modified Python code that allows for a random shift value:

import random

def caesar_cipher(text, shift, mode):
    if shift == "random":  # If user inputs "random", pick a random number
        shift = random.randint(1, 25)
        print(f"Random shift value used: {shift}")  # Inform the user of the shift

    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  # Keeps spaces and non-alphabet characters unchanged
    return result

# Getting user input
mode = input("Do you want to encrypt or decrypt? ").strip().lower()
message = input("Enter your message: ")
shift_input = input("Enter shift value (number between 1 and 25, or type 'random'): ")

# Convert shift input to integer if it's not "random"
shift_value = shift_input if shift_input.lower() == "random" else int(shift_input)

# Perform encryption/decryption
output = caesar_cipher(message, shift_value, mode)
print(f"Result: {output}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions