forked from splunk-soar-connectors/reversinglabs-a1000v2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
reversinglabs_a1000v2_views.py
186 lines (138 loc) · 7.15 KB
/
reversinglabs_a1000v2_views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File: reversinglabs_a1000v2_views.py
#
# Copyright (c) ReversingLabs, 2023
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions
# and limitations under the License.
#
def advanced_search(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
for x in result.get_data():
x["classification_color"] = color_code_classification(x.get("classification").upper())
context['data'] = result.get_data()
context['results_found'] = f"Results found: {str(len(result.get_data()))}"
context['param'] = result.get_param()
return 'views/reversinglabs_advanced_search.html'
def get_classification(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context["classification"] = context['data'].get("classification", "UNAVAILABLE").upper()
context["classification_color"] = color_code_classification(context["classification"])
return 'views/reversinglabs_get_classification.html'
def get_detailed_report(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context["classification"] = context['data'].get('results')[0].get('classification').upper()
context["classification_color"] = color_code_classification(context["classification"])
context['param'] = result.get_param()
return 'views/reversinglabs_get_detailed_report.html'
def get_summary_report(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context["classification"] = context['data'].get('results')[0].get('classification').upper()
context["classification_color"] = color_code_classification(context["classification"])
context['param'] = result.get_param()
return 'views/reversinglabs_get_summary_report.html'
def get_titaniumcore_report(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context["classification"] = get_status_from_ticore_classification(
context['data'].get("classification").get("classification")
).upper()
context["classification_color"] = color_code_classification(context["classification"])
context['param'] = result.get_param()
return 'views/reversinglabs_get_titaniumcore_report.html'
def url_reputation(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context["classification"] = context['data'].get("classification", "UNAVAILABLE").upper()
context["classification_color"] = color_code_classification(context["classification"])
return 'views/reversinglabs_url_reputation.html'
def domain_reputation(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
return 'views/reversinglabs_domain_reputation.html'
def ip_reputation(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
return 'views/reversinglabs_ip_reputation.html'
def network_ip_to_domain(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
return 'views/reversinglabs_network_ip_to_domain.html'
def network_urls_from_ip(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
return 'views/reversinglabs_network_urls_from_ip.html'
def network_files_from_ip(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
for x in context['data'].get("downloaded_files"):
x["classification_color"] = color_code_classification(x.get("classification").upper())
return 'views/reversinglabs_network_files_from_ip.html'
def check_dynamic_analysis_report_status(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context['param'] = result.get_param()
return 'views/reversinglabs_check_dynamic_analysis_report_status.html'
def check_pdf_report_status(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context['param'] = result.get_param()
return 'views/reversinglabs_check_pdf_report_status.html'
def check_submitted_url_status(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context['param'] = result.get_param()
if context['data'].get('report', {}).get('sample_summary', {}).get('classification', {}):
classification = context['data']['report']['sample_summary']['classification'].upper()
context['classification_color'] = color_code_classification(classification)
context['classification'] = classification
return 'views/reversinglabs_check_submitted_url_status.html'
def submit_url(provides, all_app_runs, context):
for summary, action_results in all_app_runs:
for result in action_results:
context['data'] = result.get_data()[0]
context['param'] = result.get_param()
return 'views/reversinglabs_submit_url.html'
def color_code_classification(classification):
color = ""
classification = classification.upper()
if classification == 'MALICIOUS':
color = "red"
elif classification == 'SUSPICIOUS':
color = "orange"
elif classification == 'KNOWN':
color = "green"
elif classification == 'GOODWARE':
color = "green"
return color
def get_status_from_ticore_classification(classification_int):
status_mapping = {
3: "malicious",
2: "suspicious",
1: "known"
}
return status_mapping.get(classification_int, 'unknown')