Question: PLEASE DO NOT SPAM THE QUESTION I WILL AUTOMATICALLY DISLIKE IT (IF YOU SOLVE IT PLEASE POST A PICTURE OF IT WORKING ON YOUR END,

PLEASE DO NOT SPAM THE QUESTION I WILL AUTOMATICALLY DISLIKE IT (IF YOU SOLVE IT PLEASE POST A PICTURE OF IT WORKING ON YOUR END, THANKS)

The following Python script needs to be FIXED. It Reads a CSV file(down below) into a list of dictionaries to map the severity and probability to the threat value, and stores the threat value, threat description, severity, and probability in a dictionary. It calculates a threat value based on the severity and probability of each threat, stores the threat information in a dictionary, and outputs a recommendation for each threat based on its threat value. The recommended actions range from minor security increases to emailing the sysadmin, infosec chief, and IT manager.z

code:

import csv

# Define a mapping of severity and probability to threat value

threat_map = {

"Emergency": {"Frequent": 16, "Probable": 14, "Unlikely": 11, "Rare": 8},

"Major": {"Frequent": 14, "Probable": 11, "Unlikely": 8, "Rare": 5},

"Moderate": {"Frequent": 11, "Probable": 8, "Unlikely": 5, "Rare": 2},

"Minor": {"Frequent": 5, "Probable": 2, "Unlikely": 1, "Rare": 0}

}

# Initialize a list to store the threats information

threats = []

# Open the CSV file and read the data into a list of dictionaries

with open("RiskResults.csv") as file:

# Use csv.DictReader to read the file into a list of dictionaries

reader = csv.DictReader(file)

for row in reader:

# Unpack the data into separate variables

ID = row["ID"]

start_time = row["Start time"]

end_time = row["Completion time"]

description = row["Provide a Description of the Risk"]

severity = row["Select its severity"]

probability = row["Select its Probability"]

# Calculate the threat value based on the mapping

if probability in threat_map[severity]:

threat_value = threat_map[severity][probability]

else:

# Add default value or handle the error in another way

threat_value = 0

# Create a dictionary to store the threat information

threat = {

"ID": ID,

"start_time": start_time,

"end_time": end_time,

"description": description,

"severity": severity,

"probability": probability,

"threat_value": threat_value

}

# Add the threat information to the list

threats.append(threat)

# Iterate over the list of threats and output a recommendation for each threat

for threat in threats:

threat_value = threat["threat_value"]

if threat_value

# Threat value should not be less than or equal to 0

print("Logging Error - check the data provided as this threat value is invalid.")

elif threat_value

print("Minor issue likely, increasing security is not recommended due to costs involved")

elif threat_value

print("Issue will require increase in security and access controls. Adding to Backlog for further planning.")

else:

print("Major bug or issue - sending email to sysadmin, infosec chief, and IT manager.")

RiskResults.csv

ID Start time Completion time Provide a Description of the Risk Select its severity Select its Probability Category 1 1/7/2023 12:03 1/7/2023 12:11 Internal employee sabotaging or leaking confidential data Major Unlikely People 2 1/12/2023 9:51 1/12/2023 9:54 Sensitive data over home network (potentially unsecured) Major Frequent Network 3 1/12/2023 10:16 1/12/2023 10:16 There is no security system protecting the house. Moderate Unlikely Physical 4 1/12/2023 10:13 1/12/2023 10:16 Natural disaster in florida Emergency Frequent Disaster 5 1/12/2023 10:16 1/12/2023 10:16 Hurricane Emergency Likely Disaster 6 1/12/2023 10:16 1/12/2023 10:16 Natural disaster Moderate Unlikely Disaster 7 1/12/2023 10:16 1/12/2023 10:16 Hurricane Emergency Unlikely Disaster 8 1/12/2023 10:16 1/12/2023 10:16 Baseball smashing through a window Minor Unlikely Physical 9 1/12/2023 10:16 1/12/2023 10:26 Building Maintenance Major Unlikely Maintenance 10 1/12/2023 10:12 1/12/2023 10:29 Flooding Emergency Probable Disaster

Error message:

PLEASE DO NOT SPAM THE QUESTION I WILL AUTOMATICALLY DISLIKE IT (IF

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!