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

Finished parsing etc, attack needs to be configured though...

parent 5bc918d9
No related branches found
No related tags found
No related merge requests found
......@@ -38,14 +38,14 @@ ThreatValue = textArea1 # The threat
ThreatID = textArea2 # The id of the threat
ThreatIDValue = textArea3 # Value
ThreatSource = textArea4 # The threat source
ThreatSourceValue = textArea5 # Value
ThreatSource = textArea6 # The threat source
ThreatSourceValue = textArea7 # Value
Likelihood = textArea6 # The likelihood of the threat
LikelihoodValue = textArea7 # Value
ThreatDescription = textArea8 # The description of the threat
ThreatDescriptionValue = textArea9 # Value
ThreatDescription = textArea4 # The description of the threat
ThreatDescriptionValue = textArea5 # Value
Vulnerability = textArea10 # The vulnerability
VulnerabilityValue = textArea11 # Value
......
......@@ -108,7 +108,7 @@ def createMetrics(diagram: Diagram, frame, canvasWidth):
s.configure('Head.TLabel', background='#51D88F', foreground="#1A323B" ,font=('Helvetica', 20, 'bold'))
s.configure('Test.TLabel', background='#51D88F', foreground="#1A323B" ,font=('Helvetica', 20))
s.configure('ListFrame.TFrame', background='white', foreground="#155E53")
s.configure('ListFrame.TLabel', background='white', foreground="#155E53", font=('Helvetica', 20, 'bold'))
s.configure('ListFrame.TLabel', background='white', foreground="#1A323B", font=('Helvetica', 20, 'bold'))
metrics = diagram.metrics.values()
rowIndex = 0
......@@ -177,6 +177,7 @@ def createMetrics(diagram: Diagram, frame, canvasWidth):
ttk.Label(bowTieFrame, text="BowTie components", style="ListFrame.TLabel").grid(row=0, column=0, sticky="nw")
bowTieList = utils.createBowtieLabel(bowTieFrame, diagram.metrics[metricID], diagram)
for i in range(len(bowTieList)):
bowTieList[i].grid(row=i+1, column=0, sticky="nw")
......
......@@ -9,6 +9,9 @@ import diagramParser as parse
def createERLabel(top, metric: Metric, diagram: Diagram):
s = ttk.Style()
s.configure('ListFrame.TLabel', background='white', foreground="#1A323B", font=('Helvetica', 15, 'bold'))
nameList = []
labelList = []
for i in metric.erID:
......@@ -22,27 +25,38 @@ def createERLabel(top, metric: Metric, diagram: Diagram):
else:
pass
for k in nameList:
label = ttk.Label(top, text= f"{k}")
label = ttk.Label(top, text= f"{k}", style="ListFrame.TLabel")
labelList.append(label)
return labelList
def createBowtieLabel(top, metric: Metric, diagram: Diagram):
nameList = []
s = ttk.Style()
s.configure('ListFrame.TLabel', background='white', foreground="#1A323B", font=('Helvetica', 15, 'bold'))
labelList = []
nameList = []
for i in metric.bowtieID:
try:
if i in diagram.threats.keys():
label = ttk.Label(top, text= f"Threat component: {diagram.threats[i].description}", style="ListFrame.TLabel")
nameList.append(diagram.threats[i].description)
except KeyError:
try:
labelList.append(label)
elif i in diagram.consequences.keys():
label = ttk.Label(top, text= f"Consequence component: {diagram.consequences[i].description}", style="ListFrame.TLabel")
nameList.append(diagram.consequences[i].description)
except KeyError:
try:
labelList.append(label)
elif i in diagram.attacks.keys():
label = ttk.Label(top, text= f"Attack component: {diagram.attacks[i].description}", style="ListFrame.TLabel")
nameList.append(diagram.attacks[i].description)
except KeyError:
continue
for k in nameList:
label = ttk.Label(top, text= f"{k}")
labelList.append(label)
return labelList
......
......@@ -50,6 +50,9 @@ def parseThreats(df, threatDict):
def parseConsequences(df, consequenceDict):
for i in range(len(df)):
if df[const.ConsequenceValue][i] == const.Consequence:
print(df[const.ConsequenceDescriptionValue][i])
consequence = component.Consequence(
df[const.ConsequenceIDValue][i],
df[const.Id][i],
......@@ -64,6 +67,7 @@ def parseConsequences(df, consequenceDict):
def parseAttacks(df, attackDict):
for i in range(len(df)):
if df[const.AttackValue][i] == const.Attack:
attack = component.Attack(
df[const.Id][i],
df[const.AttackedComponentValue][i],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment