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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Iversen
DynamicRiskManagementforSSC
Commits
9de8fa43
Commit
9de8fa43
authored
1 year ago
by
martiivGylden
Browse files
Options
Downloads
Patches
Plain Diff
Mapped values to constants
parent
6280ac35
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ERFormatConstants.py
+43
-13
43 additions, 13 deletions
ERFormatConstants.py
diagramParser.py
+10
-3
10 additions, 3 deletions
diagramParser.py
dynamics.py
+2
-2
2 additions, 2 deletions
dynamics.py
with
55 additions
and
18 deletions
ERFormatConstants.py
+
43
−
13
View file @
9de8fa43
#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
This diff is collapsed.
Click to expand it.
diagramParser.py
+
10
−
3
View file @
9de8fa43
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
)):
...
...
This diff is collapsed.
Click to expand it.
dynamics.py
+
2
−
2
View file @
9de8fa43
...
...
@@ -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
...
...
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