diff --git a/challenges/Collaboration README.md b/challenges/Collaboration README.md new file mode 100644 index 0000000..57cc307 --- /dev/null +++ b/challenges/Collaboration README.md @@ -0,0 +1,18 @@ + + +This is collaboative work repository of group 11: + +Nada Saad + +Fatima Malik + +Kefah Albashityalshaer + +Pierre Kenley MERVIL + +Pyae Linn + +Said Ibrahim + +Anna Shumylina + diff --git a/challenges/challenge1.py b/challenges/challenge1.py index 182c032..a5d6861 100644 --- a/challenges/challenge1.py +++ b/challenges/challenge1.py @@ -26,3 +26,26 @@ Interpret what the final expression means in the context of allowing or blocking a login attempt. """ + +A=bool() +B=bool() + +def simplify_expression(A, B): + # Original expression: ¬(A ∧ (B ∨ ¬B)) + # Step 1: Simplify (B ∨ ¬B) to True + inner_expression = True # Since B ∨ ¬B is always True + # Step 2: Simplify A ∧ True to A + intermediate_expression = A and inner_expression # A ∧ True = A + # Step 3: Apply the negation + final_expression = not intermediate_expression # ¬A + return final_expression + +# Example usage: +A = True # User has correct credentials +B = True # Login attempt is from a trusted device + +result = simplify_expression(A, B) + +if result: + print ('Login incorrect. Please enter valid login') +else: print ('Login correct.') \ No newline at end of file diff --git a/challenges/challenge2.py b/challenges/challenge2.py index 504b52b..dcaa666 100644 --- a/challenges/challenge2.py +++ b/challenges/challenge2.py @@ -29,3 +29,33 @@ # -*- 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? +Access_One_type=finance_access.union(tech_access).union(admin) + +#Who has access to both financial and technical data? +Access_both_types=finance_access.intersection(tech_access).union(admin) + +#Who has exclusive access to only one type of data? +Access_one_type_only=finance_access.symmetric_difference(tech_access) +print (Access_one_type_only) + +#Which employees currently lack access (but exist in the system)? +print ("New employee has no access!", new_employee) + +#Are there unnecessary overlaps in access that could pose a security risk? +print("Access to both types is an unnecessary intersection.", Access_both_types) + +#What changes would you recommend to enhance security and minimize excessive access? +print("Security Recommendations: Restrict access according to the roles and responsibilities") + + + + diff --git a/challenges/challenge3.py b/challenges/challenge3.py index d20302e..5e46f26 100644 --- a/challenges/challenge3.py +++ b/challenges/challenge3.py @@ -20,3 +20,43 @@ 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. """ +""" +import matplotlib.pyplot as plt +from matplotlib_venn import venn2 + +finance_access = {"E0435", "E1021", "E3098", "E7642", "E8873", "E6590"} + +tech_access = {"E7642", "E8873", "E6590", "E9812", "E4520"} + +admin={"E0001"} + +new_employee={"E9999"} + +venn_values = (finance_access, tech_access, admin, new_employee) +venn_labels = ('Finance', 'Tech', 'Admin', 'New employee') + +venn=venn2(subsets=venn_values, set_labels=venn_labels) +plt.show() + +""" + +from matplotlib_venn import venn2 +import matplotlib.pyplot as plt + +finance_access = {"E0435", "E1021", "E3098", "E7642", "E8873", "E6590"} +tech_access = {"E7642", "E8873", "E6590", "E9812", "E4520"} +admin = {"E0001"} +new_employee = {"E9999"} + +#Venn diagram +venn2(subsets=(len(finance_access - tech_access), + len(tech_access - finance_access), + len(finance_access.intersection(tech_access))), + set_labels=("Finance Access", "Tech Access")) + +# For adding title and colors +plt.title("Employee Access Control Visualization") +plt.annotate("Admin: Full Access", xy=(-0.6, -0.5)) +plt.annotate("New Employee: No Access", xy=(-0.6, -0.6)) +plt.show() +