Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DynamicRiskManagementforSSC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Iversen
DynamicRiskManagementforSSC
Commits
bd3e254d
Commit
bd3e254d
authored
1 year ago
by
martiivGylden
Browse files
Options
Downloads
Patches
Plain Diff
Finished parsing etc, attack needs to be configured though...
parent
5bc918d9
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ERFormatConstants.py
+4
-4
4 additions, 4 deletions
ERFormatConstants.py
dashBoard.py
+2
-1
2 additions, 1 deletion
dashBoard.py
dashboardUtils.py
+29
-15
29 additions, 15 deletions
dashboardUtils.py
diagramParser.py
+5
-1
5 additions, 1 deletion
diagramParser.py
with
40 additions
and
21 deletions
ERFormatConstants.py
+
4
−
4
View file @
bd3e254d
...
@@ -38,14 +38,14 @@ ThreatValue = textArea1 # The threat
...
@@ -38,14 +38,14 @@ ThreatValue = textArea1 # The threat
ThreatID
=
textArea2
# The id of the threat
ThreatID
=
textArea2
# The id of the threat
ThreatIDValue
=
textArea3
# Value
ThreatIDValue
=
textArea3
# Value
ThreatSource
=
textArea
4
# The threat source
ThreatSource
=
textArea
6
# The threat source
ThreatSourceValue
=
textArea
5
# Value
ThreatSourceValue
=
textArea
7
# Value
Likelihood
=
textArea6
# The likelihood of the threat
Likelihood
=
textArea6
# The likelihood of the threat
LikelihoodValue
=
textArea7
# Value
LikelihoodValue
=
textArea7
# Value
ThreatDescription
=
textArea
8
# The description of the threat
ThreatDescription
=
textArea
4
# The description of the threat
ThreatDescriptionValue
=
textArea
9
# Value
ThreatDescriptionValue
=
textArea
5
# Value
Vulnerability
=
textArea10
# The vulnerability
Vulnerability
=
textArea10
# The vulnerability
VulnerabilityValue
=
textArea11
# Value
VulnerabilityValue
=
textArea11
# Value
...
...
This diff is collapsed.
Click to expand it.
dashBoard.py
+
2
−
1
View file @
bd3e254d
...
@@ -108,7 +108,7 @@ def createMetrics(diagram: Diagram, frame, canvasWidth):
...
@@ -108,7 +108,7 @@ def createMetrics(diagram: Diagram, frame, canvasWidth):
s
.
configure
(
'
Head.TLabel
'
,
background
=
'
#51D88F
'
,
foreground
=
"
#1A323B
"
,
font
=
(
'
Helvetica
'
,
20
,
'
bold
'
))
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
(
'
Test.TLabel
'
,
background
=
'
#51D88F
'
,
foreground
=
"
#1A323B
"
,
font
=
(
'
Helvetica
'
,
20
))
s
.
configure
(
'
ListFrame.TFrame
'
,
background
=
'
white
'
,
foreground
=
"
#155E53
"
)
s
.
configure
(
'
ListFrame.TFrame
'
,
background
=
'
white
'
,
foreground
=
"
#155E53
"
)
s
.
configure
(
'
ListFrame.TLabel
'
,
background
=
'
white
'
,
foreground
=
"
#1
55E53
"
,
font
=
(
'
Helvetica
'
,
20
,
'
bold
'
))
s
.
configure
(
'
ListFrame.TLabel
'
,
background
=
'
white
'
,
foreground
=
"
#1
A323B
"
,
font
=
(
'
Helvetica
'
,
20
,
'
bold
'
))
metrics
=
diagram
.
metrics
.
values
()
metrics
=
diagram
.
metrics
.
values
()
rowIndex
=
0
rowIndex
=
0
...
@@ -177,6 +177,7 @@ def createMetrics(diagram: Diagram, frame, canvasWidth):
...
@@ -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
"
)
ttk
.
Label
(
bowTieFrame
,
text
=
"
BowTie components
"
,
style
=
"
ListFrame.TLabel
"
).
grid
(
row
=
0
,
column
=
0
,
sticky
=
"
nw
"
)
bowTieList
=
utils
.
createBowtieLabel
(
bowTieFrame
,
diagram
.
metrics
[
metricID
],
diagram
)
bowTieList
=
utils
.
createBowtieLabel
(
bowTieFrame
,
diagram
.
metrics
[
metricID
],
diagram
)
for
i
in
range
(
len
(
bowTieList
)):
for
i
in
range
(
len
(
bowTieList
)):
bowTieList
[
i
].
grid
(
row
=
i
+
1
,
column
=
0
,
sticky
=
"
nw
"
)
bowTieList
[
i
].
grid
(
row
=
i
+
1
,
column
=
0
,
sticky
=
"
nw
"
)
...
...
This diff is collapsed.
Click to expand it.
dashboardUtils.py
+
29
−
15
View file @
bd3e254d
...
@@ -9,6 +9,9 @@ import diagramParser as parse
...
@@ -9,6 +9,9 @@ import diagramParser as parse
def
createERLabel
(
top
,
metric
:
Metric
,
diagram
:
Diagram
):
def
createERLabel
(
top
,
metric
:
Metric
,
diagram
:
Diagram
):
s
=
ttk
.
Style
()
s
.
configure
(
'
ListFrame.TLabel
'
,
background
=
'
white
'
,
foreground
=
"
#1A323B
"
,
font
=
(
'
Helvetica
'
,
15
,
'
bold
'
))
nameList
=
[]
nameList
=
[]
labelList
=
[]
labelList
=
[]
for
i
in
metric
.
erID
:
for
i
in
metric
.
erID
:
...
@@ -22,27 +25,38 @@ def createERLabel(top, metric: Metric, diagram: Diagram):
...
@@ -22,27 +25,38 @@ def createERLabel(top, metric: Metric, diagram: Diagram):
else
:
else
:
pass
pass
for
k
in
nameList
:
for
k
in
nameList
:
label
=
ttk
.
Label
(
top
,
text
=
f
"
{
k
}
"
)
label
=
ttk
.
Label
(
top
,
text
=
f
"
{
k
}
"
,
style
=
"
ListFrame.TLabel
"
)
labelList
.
append
(
label
)
labelList
.
append
(
label
)
return
labelList
return
labelList
def
createBowtieLabel
(
top
,
metric
:
Metric
,
diagram
:
Diagram
):
def
createBowtieLabel
(
top
,
metric
:
Metric
,
diagram
:
Diagram
):
nameList
=
[]
s
=
ttk
.
Style
()
s
.
configure
(
'
ListFrame.TLabel
'
,
background
=
'
white
'
,
foreground
=
"
#1A323B
"
,
font
=
(
'
Helvetica
'
,
15
,
'
bold
'
))
labelList
=
[]
labelList
=
[]
nameList
=
[]
for
i
in
metric
.
bowtieID
:
for
i
in
metric
.
bowtieID
:
try
:
if
i
in
diagram
.
threats
.
keys
():
nameList
.
append
(
diagram
.
threats
[
i
].
description
)
label
=
ttk
.
Label
(
top
,
text
=
f
"
Threat component:
{
diagram
.
threats
[
i
].
description
}
"
,
style
=
"
ListFrame.TLabel
"
)
except
KeyError
:
try
:
nameList
.
append
(
diagram
.
threats
[
i
].
description
)
nameList
.
append
(
diagram
.
consequences
[
i
].
description
)
except
KeyError
:
labelList
.
append
(
label
)
try
:
nameList
.
append
(
diagram
.
attacks
[
i
].
description
)
elif
i
in
diagram
.
consequences
.
keys
():
except
KeyError
:
label
=
ttk
.
Label
(
top
,
text
=
f
"
Consequence component:
{
diagram
.
consequences
[
i
].
description
}
"
,
style
=
"
ListFrame.TLabel
"
)
continue
nameList
.
append
(
diagram
.
consequences
[
i
].
description
)
for
k
in
nameList
:
label
=
ttk
.
Label
(
top
,
text
=
f
"
{
k
}
"
)
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
)
labelList
.
append
(
label
)
labelList
.
append
(
label
)
return
labelList
return
labelList
...
...
This diff is collapsed.
Click to expand it.
diagramParser.py
+
5
−
1
View file @
bd3e254d
...
@@ -33,7 +33,7 @@ def parseDiagramFile(csvFile) -> component.Diagram:
...
@@ -33,7 +33,7 @@ def parseDiagramFile(csvFile) -> component.Diagram:
def
parseThreats
(
df
,
threatDict
):
def
parseThreats
(
df
,
threatDict
):
for
i
in
range
(
len
(
df
)):
for
i
in
range
(
len
(
df
)):
if
df
[
const
.
ThreatValue
][
i
]
==
const
.
Threat
:
#Creates threat object
if
df
[
const
.
ThreatValue
][
i
]
==
const
.
Threat
:
#Creates threat object
threat
=
component
.
Threat
(
threat
=
component
.
Threat
(
df
[
const
.
ThreatIDValue
][
i
],
# ID from ER
df
[
const
.
ThreatIDValue
][
i
],
# ID from ER
df
[
const
.
Id
][
i
],
# LucidChart ID
df
[
const
.
Id
][
i
],
# LucidChart ID
...
@@ -50,6 +50,9 @@ def parseThreats(df, threatDict):
...
@@ -50,6 +50,9 @@ def parseThreats(df, threatDict):
def
parseConsequences
(
df
,
consequenceDict
):
def
parseConsequences
(
df
,
consequenceDict
):
for
i
in
range
(
len
(
df
)):
for
i
in
range
(
len
(
df
)):
if
df
[
const
.
ConsequenceValue
][
i
]
==
const
.
Consequence
:
if
df
[
const
.
ConsequenceValue
][
i
]
==
const
.
Consequence
:
print
(
df
[
const
.
ConsequenceDescriptionValue
][
i
])
consequence
=
component
.
Consequence
(
consequence
=
component
.
Consequence
(
df
[
const
.
ConsequenceIDValue
][
i
],
df
[
const
.
ConsequenceIDValue
][
i
],
df
[
const
.
Id
][
i
],
df
[
const
.
Id
][
i
],
...
@@ -64,6 +67,7 @@ def parseConsequences(df, consequenceDict):
...
@@ -64,6 +67,7 @@ def parseConsequences(df, consequenceDict):
def
parseAttacks
(
df
,
attackDict
):
def
parseAttacks
(
df
,
attackDict
):
for
i
in
range
(
len
(
df
)):
for
i
in
range
(
len
(
df
)):
if
df
[
const
.
AttackValue
][
i
]
==
const
.
Attack
:
if
df
[
const
.
AttackValue
][
i
]
==
const
.
Attack
:
attack
=
component
.
Attack
(
attack
=
component
.
Attack
(
df
[
const
.
Id
][
i
],
df
[
const
.
Id
][
i
],
df
[
const
.
AttackedComponentValue
][
i
],
df
[
const
.
AttackedComponentValue
][
i
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment