Skip to content
Snippets Groups Projects
Commit 9de8fa43 authored by martiivGylden's avatar martiivGylden
Browse files

Mapped values to constants

parent 6280ac35
No related branches found
No related tags found
No related merge requests found
#File contains constants from the CSV export format of the entity relationship tool
#Generic fields for all entities
#Generic fields for all rows in the CSV file
componentID = "Id" # LucidChart ID
Id = "Id" # The id of the entity
Description = "Description" # The description of the entity
textArea1 = "Text Area 1"
textArea2 = "Text Area 2"
......@@ -23,17 +21,49 @@ textArea14 = "Text Area 14"
textArea15 = "Text Area 15"
textArea16 = "Text Area 16"
#Threats
Threat = "Threat" # The threat -> Text area 1
ThreatSource = "Threat source" # The threat source -> Text area 4
Likelihood = "Likelihood" # The likelihood of the threat -> Text area 6
Vulnerability = "Vulnerability" # The vulnerability -> Text area 7
#Mapped fields for Threat component
Threat = textArea1 # The threat
#Attack
Type = "Type" # The type of the consequence -> Text area 2
Component = "Component" # The component related to the attack -> Text area 4
ThreatID = textArea2 # The id of the threat
ThreatIDValue = textArea3 # Value
ThreatSource = textArea4 # The threat source
ThreatSource = textArea5 # Value
Likelihood = textArea6 # The likelihood of the threat
LikelihoodValue = textArea7 # Value
ThreatDescription = textArea8 # The description of the threat
ThreatDescriptionValue = textArea9 # Value
Vulnerability = textArea10 # The vulnerability
VulnerabilityValue = textArea11 # Value
#Consequence
Consequence = "Consequence" # The consequence score of the area -> Text area 6
AffectedComponents = "Affected components" # The affected components -> Text area 7
Consequence = textArea1 # The consequence score of the area -> Text area 6
ConsequenceID = textArea2 # The id of the consequence
ConsequenceIDValue = textArea3 # Value
ConsequenceDescription = textArea4 # The description of the consequence
ConsequenceDescriptionValue = textArea5 # Value
ConsequenceScore = textArea6 # The consequence score of the area
ConsequenceScoreValue = textArea7 # Value
AffectedComponent = textArea8 # The affected component
AffectedComponentValue = textArea9 # Value
#Attack
Attack = textArea1 # The attack
AttackType = textArea2 # The type of attack
AttackTypeValue = textArea3 # Value
AttackedComponent = textArea4 # The attacked component
AttackedComponentValue = textArea5 # Value
AttackDescription = textArea6 # The description of the attack
AttackDescriptionValue = textArea7 # Value
import pandas as pd
import ERFormatConstants as const
import components as component
import dynamics as dynamic
# Function will parse a csv file and extract the necessary information, this is step 1 of the parse
def parseDiagramFile(csvFile):
......@@ -24,9 +26,14 @@ def parseDiagramFile(csvFile):
def parseThreats(df):
for i in range(len(df)):
if df[const.textArea1][i] == const.Threat:
threat = component.Threat(
df[const.Id][i], # The id of the entity
df[const.componentID][i], # The component ID field provided by LucidChart
df[const.textArea4][i],
df[const.Description][i],
df[const.textArea6][i],
df[const.textArea7][i])
threats.append(df["Name"][i])
print(threats)
def parseConsequences(df):
for i in range(len(df)):
......
......@@ -4,8 +4,8 @@ from enum import Enum
#Dynamics class parent class for all dynamic components in the diagram
class Dynamics:
def __init__(self, id) -> None:
self.id = id
def __init__(self, componentID) -> None:
self.componentID = componentID
self.metrics = [Metric] #List of metrics for the dynamic
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment