Skip to content

Commit 2ab7983

Browse files
Merge pull request #205 from cert-ee/bugfix/various-bugfixes
Bugfix/various bugfixes
2 parents bf74525 + 68c0d80 commit 2ab7983

File tree

19 files changed

+96
-95
lines changed

19 files changed

+96
-95
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ bower_components/
6464
.sass-cache/
6565
cuckoo/web/src/package-lock.json
6666
*.map
67+
68+
# Vagrant
69+
.vagrant

common/cuckoo/common/misp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ def find_events(self, value, type_attribute=None, limit=1, to_ids=1, publish_tim
186186
for attribute in attributes['Attribute']
187187
]
188188
except (ValueError, TypeError) as e:
189-
return []
189+
raise MispError(
190+
f"Failure while reading MISP response JSON. Error: {e}"
191+
)
190192

191193
def find_file_md5(self, md5, limit=1, to_ids=1, publish_timestamp="365d"):
192194
return self.find_events(

core/cuckoo/scripts/cleanup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def main(ctx, cwd, debug):
124124
return
125125

126126
@main.command()
127-
@click.argument("days", type=int)
127+
@click.argument("hours", type=int)
128128
@click.option("--yes", is_flag=True, help="Skip confirmation screen")
129129
@click.pass_context
130130
def remotestorage(ctx, days, yes):
@@ -147,7 +147,7 @@ def remotestorage(ctx, days, yes):
147147

148148

149149
@main.command("delete")
150-
@click.argument("state", type=string)
150+
@click.argument("state", type=str)
151151
@click.argument("hours", type=int)
152152
@click.option("--yes", is_flag=True, help="Skip confirmation screen")
153153
@click.pass_context

core/cuckoo/taskqueue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def _query_tasks(self, platform=None, os_version=None, limit=5):
178178

179179
def count_unscheduled(self):
180180
return self._ses.query(
181-
QueuedTask.id
181+
sqlalchemy.func.count(QueuedTask.id)
182182
).filter_by(scheduled=False).count()
183183

184184
def get_unscheduled_tasks(self, platform=None, os_version=None):

machineries/cuckoo/machineries/modules/proxmox.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from time import sleep
21
from dataclasses import dataclass
32

43
from cuckoo.common import machines
@@ -130,11 +129,6 @@ def state(self, machine):
130129
prox = self._create_proxmoxer_connection()
131130
current_status = prox.nodes(vm.node_name).qemu(vm.vm_id)\
132131
.status.current.get()
133-
# prevents spamming during starting and stoping VMs,
134-
# which leads to "too many redirection"-exception
135-
log.debug("Waiting for status to change...")
136-
sleep(5)
137-
138132
if current_status is None:
139133
raise errors.MachineryConnectionError(
140134
f"Error while getting status of {machine.label} "

processing/cuckoo/processing/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ def constraints(self, value):
7777
"mhr.yaml": {
7878
"enabled": config.Boolean(default_val=False),
7979
"timeout": config.Int(default_val=60, min_value=0),
80-
"url": config.HTTPUrl(default_val="https://hash.cymru.com/v2/"),
80+
"url": config.HTTPUrl(),
8181
"user": config.String(allow_empty=True),
8282
"password": config.String(allow_empty=True),
8383
"min_suspicious": config.Int(default_val=10, min_value=1),
84-
"min_malicious": config.Int(default_val=17, min_value=1),
85-
},
84+
"min_malicious": config.Int(default_val=30, min_value=1),
85+
},
8686
"misp.yaml": {
8787
"processing": {
8888
"enabled": config.Boolean(default_val=False),

processing/cuckoo/processing/pre/mhr.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _request_json(self, url, **kwargs):
5454
"""Wrapper around doing a request and parsing its JSON output."""
5555
try:
5656
r = requests.get(url, auth=HTTPBasicAuth(self.user, self.password),
57-
timeout=self.timeout, **kwargs)
57+
timeout=self.timeout, verify=False, **kwargs)
5858
return r.json() if r.status_code == 200 else {}
5959
except (requests.ConnectionError, ValueError) as e:
6060
self.ctx.log.error(
@@ -78,7 +78,6 @@ def _handle_file_target(self):
7878

7979

8080
def start(self):
81-
info = None
8281
antivirus_detection_rate = None
8382
if self.ctx.analysis.category == "file":
8483
info = self._handle_file_target()
@@ -96,7 +95,6 @@ def start(self):
9695
score = Scores.SUSPICIOUS
9796
else:
9897
return {}
99-
10098
if score:
10199
iocs = [
102100
IOC(antivirus="MHR", result=info["antivirus_detection_rate"])
@@ -108,7 +106,7 @@ def start(self):
108106
short_description="MHR sources report this target as "
109107
"malicious",
110108
description=f"{info['antivirus_detection_rate']} percentage of tested MHR antivirus engines"
111-
f" detect this target as malicious",
109+
f"detect this target as malicious",
112110
iocs=iocs
113111
)
114112

processing/cuckoo/processing/pre/static.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def start(self):
4040

4141
for ext, handler_subkey in self._EXTENSION_HANDLER.items():
4242

43-
if not target.filename.lower().endswith(ext):
43+
if not target.filename.endswith(ext):
4444
continue
4545

4646
handler, subkey = handler_subkey

processing/cuckoo/processing/reporting/disk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def report_identification(self):
3737

3838
def report_pre_analysis(self):
3939
include_result = [
40-
"virustotal", "irma", "static", "misp", "intelmq", "command"
40+
"virustotal", "irma", "mhr", "static", "misp", "intelmq", "command"
4141
]
4242

4343
# Pre might change settings such as launch args for specific chosen

processing/cuckoo/processing/reporting/elastic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ def _update_analysis(self):
204204
try:
205205
update_analysis(
206206
analysis_id=self.ctx.analysis.id,
207-
score=self.ctx.analysis.score,
208207
tags=self.ctx.tag_tracker.tags,
209208
families=self.ctx.family_tracker.families,
210209
ttps=[t.id for t in self.ctx.ttp_tracker.ttps]

0 commit comments

Comments
 (0)