|
19 | 19 | observable_refs = []
|
20 | 20 |
|
21 | 21 | # Create the incident
|
22 |
| -incident = opencti_api_client.incident.create( |
| 22 | +incident = opencti_api_client.x_opencti_incident.create( |
23 | 23 | name="My new incident",
|
24 | 24 | description="We have been compromised",
|
25 | 25 | objective="Espionage",
|
|
39 | 39 | ttp1 = opencti_api_client.attack_pattern.read(
|
40 | 40 | filters=[{"key": "external_id", "values": ["T1193"]}]
|
41 | 41 | )
|
42 |
| -ttp1_relation = opencti_api_client.stix_relation.create( |
| 42 | +ttp1_relation = opencti_api_client.stix_domain_object.create( |
43 | 43 | fromType="Incident",
|
44 | 44 | fromId=incident["id"],
|
45 | 45 | toType="Attack-Pattern",
|
|
51 | 51 | )
|
52 | 52 | # Add kill chain phases to the relation
|
53 | 53 | for kill_chain_phase_id in ttp1["killChainPhasesIds"]:
|
54 |
| - opencti_api_client.stix_relation.add_kill_chain_phase( |
| 54 | + opencti_api_client.stix_core_relationship.add_kill_chain_phase( |
55 | 55 | id=ttp1_relation["id"], kill_chain_phase_id=kill_chain_phase_id
|
56 | 56 | )
|
57 | 57 |
|
|
63 | 63 | # Get the indicator
|
64 | 64 | indicator_ttp1 = observable_ttp1["indicators"][0]
|
65 | 65 | # Indicates the relation Incident => uses => TTP
|
66 |
| -indicator_ttp1_relation = opencti_api_client.stix_relation.create( |
| 66 | +indicator_ttp1_relation = opencti_api_client.stix_core_relationship.create( |
67 | 67 | fromType="Indicator",
|
68 | 68 | fromId=indicator_ttp1["id"],
|
69 | 69 | toType="stix_relation",
|
|
90 | 90 | filters=[{"key": "external_id", "values": ["T1060"]}]
|
91 | 91 | )
|
92 | 92 | # Create the relation
|
93 |
| -ttp2_relation = opencti_api_client.stix_relation.create( |
| 93 | +ttp2_relation = opencti_api_client.stix_core_relationship.create( |
94 | 94 | fromType="Incident",
|
95 | 95 | fromId=incident["id"],
|
96 | 96 | toType="Attack-Pattern",
|
|
102 | 102 | )
|
103 | 103 | # Add kill chain phases to the relation
|
104 | 104 | for kill_chain_phase_id in ttp2["killChainPhasesIds"]:
|
105 |
| - opencti_api_client.stix_relation.add_kill_chain_phase( |
| 105 | + opencti_api_client.stix_core_relationship.add_kill_chain_phase( |
106 | 106 | id=ttp2_relation["id"], kill_chain_phase_id=kill_chain_phase_id
|
107 | 107 | )
|
108 | 108 |
|
|
114 | 114 | # Get the indicator
|
115 | 115 | indicator_ttp2 = observable_ttp2["indicators"][0]
|
116 | 116 | # Indicates the relation Incident => uses => TTP
|
117 |
| -indicator_ttp2_relation = opencti_api_client.stix_relation.create( |
| 117 | +indicator_ttp2_relation = opencti_api_client.stix_core_relationship.create( |
118 | 118 | fromType="Indicator",
|
119 | 119 | fromId=indicator_ttp2["id"],
|
120 | 120 | toType="stix_relation",
|
|
139 | 139 | ttp3 = opencti_api_client.attack_pattern.read(
|
140 | 140 | filters=[{"key": "external_id", "values": ["T1022"]}]
|
141 | 141 | )
|
142 |
| -ttp3_relation = opencti_api_client.stix_relation.create( |
| 142 | +ttp3_relation = opencti_api_client.stix_core_relationship.create( |
143 | 143 | fromType="Incident",
|
144 | 144 | fromId=incident["id"],
|
145 | 145 | toType="Attack-Pattern",
|
|
151 | 151 | )
|
152 | 152 | # Add kill chain phases to the relation
|
153 | 153 | for kill_chain_phase_id in ttp3["killChainPhasesIds"]:
|
154 |
| - opencti_api_client.stix_relation.add_kill_chain_phase( |
| 154 | + opencti_api_client.stix_core_relationship.add_kill_chain_phase( |
155 | 155 | id=ttp3_relation["id"], kill_chain_phase_id=kill_chain_phase_id
|
156 | 156 | )
|
157 | 157 | # Elements for the report
|
|
166 | 166 | opencti_api_client.report.add_stix_observable(
|
167 | 167 | id=report["id"], report=report, stix_observable_id=observable_ref
|
168 | 168 | )
|
169 |
| - opencti_api_client.stix_relation.create( |
| 169 | + opencti_api_client.stix_core_relationship.create( |
170 | 170 | fromType="Stix-Observable",
|
171 | 171 | fromId=observable_ref,
|
172 | 172 | toType="Incident",
|
|
0 commit comments