From 7579251216ede52090f7a96d2705a85e1fe91668 Mon Sep 17 00:00:00 2001 From: asagulenko Date: Tue, 4 Feb 2025 14:10:46 -0500 Subject: [PATCH 1/3] Adding solutions 1,2 and colaboration README --- challenges/Collaboration README.md | 12 +++++++++++ challenges/challenge1.py | 34 ++++++++++++++++++++++++++++++ challenges/challenge2.py | 30 ++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 challenges/Collaboration README.md diff --git a/challenges/Collaboration README.md b/challenges/Collaboration README.md new file mode 100644 index 0000000..13149f5 --- /dev/null +++ b/challenges/Collaboration README.md @@ -0,0 +1,12 @@ + + +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..7841c33 100644 --- a/challenges/challenge1.py +++ b/challenges/challenge1.py @@ -26,3 +26,37 @@ Interpret what the final expression means in the context of allowing or blocking a login attempt. """ + +A=bool() +B=bool() +SecurityCheck=bool() + +# Simplifying +# not(A and(B or not(B)))= not(A and 1)=not(A) + +SecurityCheck = not(A) + +if SecurityCheck: + print ('Login incorrect. Please enter valid login') +else: print ('Login correct.') + + +#Interpretation: User hasn't provided correct login credentials + + +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) +print(f"The simplified expression evaluates to: {result}") \ 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") + + + + From 0df431f33c371b4316e555f145fdd05b629a164c Mon Sep 17 00:00:00 2001 From: asagulenko Date: Tue, 4 Feb 2025 14:18:05 -0500 Subject: [PATCH 2/3] Edit Challenge 1, Added Challenge 3 --- challenges/challenge1.py | 19 ++++--------------- challenges/challenge3.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/challenges/challenge1.py b/challenges/challenge1.py index 7841c33..a5d6861 100644 --- a/challenges/challenge1.py +++ b/challenges/challenge1.py @@ -29,20 +29,6 @@ A=bool() B=bool() -SecurityCheck=bool() - -# Simplifying -# not(A and(B or not(B)))= not(A and 1)=not(A) - -SecurityCheck = not(A) - -if SecurityCheck: - print ('Login incorrect. Please enter valid login') -else: print ('Login correct.') - - -#Interpretation: User hasn't provided correct login credentials - def simplify_expression(A, B): # Original expression: ¬(A ∧ (B ∨ ¬B)) @@ -59,4 +45,7 @@ def simplify_expression(A, B): B = True # Login attempt is from a trusted device result = simplify_expression(A, B) -print(f"The simplified expression evaluates to: {result}") \ No newline at end of file + +if result: + print ('Login incorrect. Please enter valid login') +else: print ('Login correct.') \ No newline at end of file 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() + From 10d4553bdb035bb34b16a53396cfdbed83e12833 Mon Sep 17 00:00:00 2001 From: Anna Shumylina Date: Tue, 4 Feb 2025 14:19:06 -0500 Subject: [PATCH 3/3] Update Collaboration README.md --- challenges/Collaboration README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/challenges/Collaboration README.md b/challenges/Collaboration README.md index 13149f5..57cc307 100644 --- a/challenges/Collaboration README.md +++ b/challenges/Collaboration README.md @@ -3,10 +3,16 @@ This is collaboative work repository of group 11: Nada Saad + Fatima Malik + Kefah Albashityalshaer + Pierre Kenley MERVIL + Pyae Linn + Said Ibrahim + Anna Shumylina