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
a2920baf
Commit
a2920baf
authored
1 year ago
by
martiivGylden
Browse files
Options
Downloads
Patches
Plain Diff
Printer fixed for dynamic components
parent
92bdca3e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
diagramParser.py
+6
-3
6 additions, 3 deletions
diagramParser.py
dynamics.py
+12
-8
12 additions, 8 deletions
dynamics.py
with
18 additions
and
11 deletions
diagramParser.py
+
6
−
3
View file @
a2920baf
...
@@ -86,6 +86,7 @@ def parseDynamic(df, metricList):
...
@@ -86,6 +86,7 @@ def parseDynamic(df, metricList):
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
threatDynamic
.
associateBowtie
(
df
,
threatDynamic
.
type
)
# Associate the dynamic with the correct components
threatDynamic
.
associateBowtie
(
df
,
threatDynamic
.
type
)
# Associate the dynamic with the correct components
print
(
threatDynamic
,
"
\n
"
)
elif
df
[
const
.
textArea3
][
i
]
==
const
.
ConsequenceDynamic
:
elif
df
[
const
.
textArea3
][
i
]
==
const
.
ConsequenceDynamic
:
consequenceDynamic
=
dynamic
.
BowtieDynamic
(
consequenceDynamic
=
dynamic
.
BowtieDynamic
(
...
@@ -94,7 +95,8 @@ def parseDynamic(df, metricList):
...
@@ -94,7 +95,8 @@ def parseDynamic(df, metricList):
)
)
consequenceDynamic
.
metrics
=
extractMetrics
(
df
,
i
,
4
)
# Extracts metrics from the dynamic component
consequenceDynamic
.
metrics
=
extractMetrics
(
df
,
i
,
4
)
# Extracts metrics from the dynamic component
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
consequenceDynamic
.
associateBowtie
(
df
,
consequenceDynamic
.
type
)
# Associate the dynamic with the correct components
consequenceDynamic
.
associateBowtie
(
df
,
consequenceDynamic
.
type
)
print
(
consequenceDynamic
,
"
\n
"
)
# Associate the dynamic with the correct components
elif
df
[
const
.
textArea3
][
i
]
==
const
.
AttackDynamic
:
elif
df
[
const
.
textArea3
][
i
]
==
const
.
AttackDynamic
:
...
@@ -105,7 +107,7 @@ def parseDynamic(df, metricList):
...
@@ -105,7 +107,7 @@ def parseDynamic(df, metricList):
attackDynamic
.
metrics
=
extractMetrics
(
df
,
i
,
4
)
attackDynamic
.
metrics
=
extractMetrics
(
df
,
i
,
4
)
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
attackDynamic
.
associateBowtie
(
df
,
attackDynamic
.
type
)
# Associate the dynamic with the correct components
attackDynamic
.
associateBowtie
(
df
,
attackDynamic
.
type
)
# Associate the dynamic with the correct components
print
(
attackDynamic
,
"
\n
"
)
elif
df
[
const
.
textArea3
][
i
]
==
const
.
ERDynamic
:
elif
df
[
const
.
textArea3
][
i
]
==
const
.
ERDynamic
:
erDynamic
=
dynamic
.
ERDynamic
(
erDynamic
=
dynamic
.
ERDynamic
(
...
@@ -115,7 +117,8 @@ def parseDynamic(df, metricList):
...
@@ -115,7 +117,8 @@ def parseDynamic(df, metricList):
)
)
erDynamic
.
metrics
=
extractMetrics
(
df
,
i
,
8
)
erDynamic
.
metrics
=
extractMetrics
(
df
,
i
,
8
)
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
joinMetrcs
(
threatDynamic
.
metrics
,
metricList
)
# Adds the metrics to the global metric list
#erDynamic.associatedERComponents(df)
erDynamic
.
associatER
(
df
)
print
(
erDynamic
,
"
\n
"
)
def
extractMetrics
(
df
,
index
,
startRange
):
def
extractMetrics
(
df
,
index
,
startRange
):
...
...
This diff is collapsed.
Click to expand it.
dynamics.py
+
12
−
8
View file @
a2920baf
...
@@ -39,6 +39,16 @@ class BowtieDynamic(DynamicComponent):
...
@@ -39,6 +39,16 @@ class BowtieDynamic(DynamicComponent):
self
.
associatedAttack
=
None
# Attack associated with the dynamic
self
.
associatedAttack
=
None
# Attack associated with the dynamic
self
.
associatedConsequence
=
None
# Consequence associated with the dynamic
self
.
associatedConsequence
=
None
# Consequence associated with the dynamic
def
__str__
(
self
)
->
str
:
if
self
.
type
==
const
.
ThreatDynamic
:
return
super
().
__str__
()
+
f
"
Associated threat ID:
{
self
.
associatedThreat
[
const
.
Id
].
item
()
}
Associated attack ID
{
(
self
.
associatedAttack
[
const
.
Id
].
item
())
}
"
elif
self
.
type
==
const
.
ConsequenceDynamic
:
return
super
().
__str__
()
+
f
"
Associated consequence ID:
{
self
.
associatedConsequence
[
const
.
Id
].
item
()
}
Assocaited attack ID:
{
(
self
.
associatedAttack
[
const
.
Id
].
item
())
}
"
elif
self
.
type
==
const
.
AttackDynamic
:
return
super
().
__str__
()
+
f
"
Associated attack ID:
{
self
.
associatedAttack
[
const
.
Id
].
item
()
}
"
"""
_summary_
"""
_summary_
Handles the associated dynamics for the bowtie model as they are different from the ER model
Handles the associated dynamics for the bowtie model as they are different from the ER model
ER model has one type of dynamic component with metrics however, the bowtie model has three dynamic types and needs more parsing
ER model has one type of dynamic component with metrics however, the bowtie model has three dynamic types and needs more parsing
...
@@ -93,14 +103,6 @@ class BowtieDynamic(DynamicComponent):
...
@@ -93,14 +103,6 @@ class BowtieDynamic(DynamicComponent):
self
.
associatedAttack
=
sourceComponent
self
.
associatedAttack
=
sourceComponent
class
ERDynamic
(
DynamicComponent
):
class
ERDynamic
(
DynamicComponent
):
def
__init__
(
self
,
componentID
,
type
,
description
)
->
None
:
def
__init__
(
self
,
componentID
,
type
,
description
)
->
None
:
super
().
__init__
(
componentID
)
super
().
__init__
(
componentID
)
...
@@ -109,6 +111,8 @@ class ERDynamic(DynamicComponent):
...
@@ -109,6 +111,8 @@ class ERDynamic(DynamicComponent):
self
.
associatedERComponents
=
[]
# Associated ER component
self
.
associatedERComponents
=
[]
# Associated ER component
self
.
type
=
type
self
.
type
=
type
def
__str__
(
self
)
->
str
:
return
super
().
__str__
()
+
f
"
ER Dynamic:
{
self
.
type
}
,
{
self
.
description
}
, Amount of associated components
{
len
(
self
.
associatedERComponents
)
}
"
"""
_summary_
"""
_summary_
Function will use the dynamic component ID to find linked threats, ER components, attacks and consequences
Function will use the dynamic component ID to find linked threats, ER components, attacks and consequences
...
...
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