diff --git a/README.md b/README.md index 8342964..5d61f29 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ This repository contains starter code and resources for Social Coding workshops covering 1-off fun subjects like generative art, coding competitions, code reading sessions or pseudocoding. +## **Authors** + +- Gennadii Ershov +- Jola-Moses +- Omer Awadalkareem +- Reem Osama +- Thilakan Jegatheeswaran + ## Running Python Files in this Repository - **Running a plain Python script**: diff --git a/challenges/challenge1.py b/challenges/challenge1.py index 182c032..786b3da 100644 --- a/challenges/challenge1.py +++ b/challenges/challenge1.py @@ -26,3 +26,20 @@ Interpret what the final expression means in the context of allowing or blocking a login attempt. """ + +def simplify_boolean(A: bool, B: bool) -> bool: + """ + Simpidies ¬(A∧(B∨¬B)) to ¬A + + Args: + A (bool): The user has provided the correct login credentials + B (bool): The login attempt is from a trusted device + + Returns: + bool: True if the login should be blocked; False otherwise. + """ + + # B ∨¬B - is always True - Complement Law + # A ∧ True = A - Identity Law + # ¬A = not A - Simplification + return not A diff --git a/challenges/challenge2.py b/challenges/challenge2.py index 504b52b..2a9ca04 100644 --- a/challenges/challenge2.py +++ b/challenges/challenge2.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- """ Created on Thu Jan 30 15:30:30 2025 - @author: somai Challenge 2: Digital Access Control Objective @@ -27,5 +26,18 @@ Are there unnecessary overlaps in access that could pose a security risk? What changes would you recommend to enhance security and minimize excessive access? # -*- coding: utf-8 -*- - """ +finance_access = {"E0435", "E1021", "E3098", "E7642", "E8873", "E6590"} +tech_access = {"E7642", "E8873", "E6590", "E9812", "E4520"} +admin = {"E0001"} +new_employee = {"E9999"} +# Who has access to at least one type of data? +print("Who has access to at least one type of data? ", finance_access | tech_access | admin) +# Who has access to both financial and technical data? +print("Who has access to both financial and technical data? ", (finance_access & tech_access) | admin) +# Who has exclusive access to only one type of data? +print("Who has exclusive access to only one type of data? ", finance_access ^ tech_access) +# Which employees currently lack access (but exist in the system)? +print("Which employees currently lack access (but exist in the system)? ", new_employee) +# Are there unnecessary overlaps in access that could pose a security risk? +print("Are there unnecessary overlaps in access that could pose a security risk? No") diff --git a/challenges/challenge3.py b/challenges/challenge3.py index d20302e..15c01ba 100644 --- a/challenges/challenge3.py +++ b/challenges/challenge3.py @@ -7,7 +7,7 @@ Objective Develop a visual representation of the company's access control system to identify patterns, overlaps, and security risks. Scenario -The company’s security team is struggling to interpret raw access data. They need a clear way to see: +The company's security team is struggling to interpret raw access data. They need a clear way to see: Employees who have access to financial records, technical documents, or both. Employees with no access, who may need onboarding. Any overlap that could indicate excessive privileges or security risks. @@ -20,3 +20,12 @@ Are there risks? Indicate employees who might be exposed to unnecessary data. Your output should visually highlight these relationships without explicitly listing them in a simple table or list. Think beyond just printing data—use a format that helps detect patterns at a glance. """ +from matplotlib_venn import venn2 +import matplotlib.pylot as plt + +finance_access = {"E0435", "E1021", "E3098", "E7642", "E8873", "E6590"} +tech_access = {"E7642", "E8873", "E6590", "E9812", "E4520"} +admin = {"E0001"} +new_employee = {"E9999"} + +venn2([finance_access, tech_access, admin, new_employee], set_labels=("finance_access", "tech_access", "admin", "new_employee"))