[client] Malware analysis without files · curiouspython1/client-python@503122f · GitHub
Skip to content

Commit 503122f

Browse files
committed
[client] Malware analysis without files
1 parent aaa328a commit 503122f

3 files changed

Lines changed: 106 additions & 54 deletions

File tree

pycti/entities/opencti_malware.py

Lines changed: 0 additions & 26 deletions

pycti/entities/opencti_malware_analysis.py

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,104 @@ class MalwareAnalysis:
1212
def __init__(self, opencti):
1313
self.opencti = opencti
1414
self.properties = """
15+
id
16+
standard_id
17+
entity_type
18+
parent_types
19+
spec_version
20+
created_at
21+
updated_at
22+
createdBy {
23+
... on Identity {
24+
id
25+
standard_id
26+
entity_type
27+
parent_types
28+
spec_version
29+
identity_class
30+
name
31+
description
32+
roles
33+
contact_information
34+
x_opencti_aliases
35+
created
36+
modified
37+
objectLabel {
38+
edges {
39+
node {
40+
id
41+
value
42+
color
43+
}
44+
}
45+
}
46+
}
47+
... on Organization {
48+
x_opencti_organization_type
49+
x_opencti_reliability
50+
}
51+
... on Individual {
52+
x_opencti_firstname
53+
x_opencti_lastname
54+
}
55+
}
56+
objectMarking {
57+
edges {
58+
node {
59+
id
60+
standard_id
61+
entity_type
62+
definition_type
63+
definition
64+
created
65+
modified
66+
x_opencti_order
67+
x_opencti_color
68+
}
69+
}
70+
}
71+
objectLabel {
72+
edges {
73+
node {
74+
id
75+
value
76+
color
77+
}
78+
}
79+
}
80+
externalReferences {
81+
edges {
82+
node {
83+
id
84+
standard_id
85+
entity_type
86+
source_name
87+
description
88+
url
89+
hash
90+
external_id
91+
created
92+
modified
93+
}
94+
}
95+
}
96+
revoked
97+
confidence
98+
created
99+
modified
100+
product
101+
result_name
102+
result
103+
submitted
104+
analysis_started
105+
analysis_ended
106+
version
107+
configuration_version
108+
analysis_engine_version
109+
analysis_definition_version
110+
modules
111+
"""
112+
self.properties_with_files = """
15113
id
16114
standard_id
17115
entity_type
@@ -164,6 +262,7 @@ def list(self, **kwargs):
164262
custom_attributes = kwargs.get("customAttributes", None)
165263
get_all = kwargs.get("getAll", False)
166264
with_pagination = kwargs.get("withPagination", False)
265+
with_files = kwargs.get("withFiles", False)
167266
if get_all:
168267
first = 500
169268

@@ -175,7 +274,11 @@ def list(self, **kwargs):
175274
edges {
176275
node {
177276
"""
178-
+ (custom_attributes if custom_attributes is not None else self.properties)
277+
+ (
278+
custom_attributes
279+
if custom_attributes is not None
280+
else (self.properties_with_files if with_files else self.properties)
281+
)
179282
+ """
180283
}
181284
}
@@ -240,6 +343,7 @@ def read(self, **kwargs):
240343
id = kwargs.get("id", None)
241344
filters = kwargs.get("filters", None)
242345
custom_attributes = kwargs.get("customAttributes", None)
346+
with_files = kwargs.get("withFiles", False)
243347
if id is not None:
244348
LOGGER.info("Reading Malware analysis {%s}.", id)
245349
query = (
@@ -250,7 +354,7 @@ def read(self, **kwargs):
250354
+ (
251355
custom_attributes
252356
if custom_attributes is not None
253-
else self.properties
357+
else (self.properties_with_files if with_files else self.properties)
254358
)
255359
+ """
256360
}

pycti/entities/opencti_stix_cyber_observable.py

Lines changed: 0 additions & 26 deletions

0 commit comments

Comments
 (0)