25
25
description = "We have been compromised" ,
26
26
objective = "Espionage"
27
27
)
28
- print (incident )
29
28
object_refs .append (incident ['id' ])
30
29
# Create the associated report
31
30
report = opencti_api_client .report .create (
34
33
published = date ,
35
34
report_class = "Internal Report"
36
35
)
37
- print (report )
38
36
39
37
# Associate the TTPs to the incident
40
38
41
39
# Spearphishing Attachment
42
40
ttp1 = opencti_api_client .attack_pattern .read (filters = [{'key' : 'external_id' , 'values' : ['T1193' ]}])
43
- print (ttp1 )
44
41
ttp1_relation = opencti_api_client .stix_relation .create (
45
42
fromType = 'Incident' ,
46
43
fromId = incident ['id' ],
64
61
type = 'Email-Address' ,
65
62
observable_value = 'phishing@mail.com'
66
63
)
67
- print (observable_ttp1 )
68
64
# Get the indicator
69
65
indicator_ttp1 = observable_ttp1 ['indicators' ][0 ]
70
- print (indicator_ttp1 )
71
66
# Indicates the relation Incident => uses => TTP
72
67
indicator_ttp1_relation = opencti_api_client .stix_relation .create (
73
68
fromType = 'Indicator' ,
91
86
92
87
# Registry Run Keys / Startup Folder
93
88
ttp2 = opencti_api_client .attack_pattern .read (filters = [{'key' : 'external_id' , 'values' : ['T1060' ]}])
94
- print (ttp2 )
95
89
# Create the relation
96
90
ttp2_relation = opencti_api_client .stix_relation .create (
97
91
fromType = 'Incident' ,
116
110
type = 'Registry-Key' ,
117
111
observable_value = 'Disk security'
118
112
)
119
- print (observable_ttp2 )
120
113
# Get the indicator
121
114
indicator_ttp2 = observable_ttp2 ['indicators' ][0 ]
122
- print (indicator_ttp2 )
123
115
# Indicates the relation Incident => uses => TTP
124
116
indicator_ttp2_relation = opencti_api_client .stix_relation .create (
125
117
fromType = 'Indicator' ,
142
134
143
135
# Data Encrypted
144
136
ttp3 = opencti_api_client .attack_pattern .read (filters = [{'key' : 'external_id' , 'values' : ['T1022' ]}])
145
- print (ttp3 )
146
137
ttp3_relation = opencti_api_client .stix_relation .create (
147
138
fromType = 'Incident' ,
148
139
fromId = incident ['id' ],
166
157
for object_ref in object_refs :
167
158
opencti_api_client .report .add_stix_entity (id = report ['id' ], report = report , entity_id = object_ref )
168
159
for observable_ref in observable_refs :
169
- opencti_api_client .report .add_stix_observable (id = report ['id' ], report = report , stix_observable_id = observable_ref )
160
+ opencti_api_client .report .add_stix_observable (id = report ['id' ], report = report , stix_observable_id = observable_ref )
161
+ opencti_api_client .stix_relation .create (
162
+ fromType = 'Stix-Observable' ,
163
+ fromId = observable_ref ,
164
+ toType = 'Incident' ,
165
+ toId = incident ['id' ],
166
+ relationship_type = 'related-to' ,
167
+ description = 'This observable is related to the incident.' ,
168
+ first_seen = date ,
169
+ last_seen = date
170
+ )
0 commit comments