forked from cuckoosandbox/cuckoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
40 lines (32 loc) · 1.37 KB
/
Copy pathdebug.py
File metadata and controls
40 lines (32 loc) · 1.37 KB
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
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import codecs
from lib.cuckoo.common.abstracts import Processing
from lib.cuckoo.common.exceptions import CuckooProcessingError
from lib.cuckoo.core.database import Database
class Debug(Processing):
"""Analysis debug information."""
def run(self):
"""Run debug analysis.
@return: debug information dict.
"""
self.key = "debug"
debug = {"log": "", "errors": []}
if os.path.exists(self.log_path):
try:
debug["log"] = codecs.open(self.log_path, "rb", "utf-8").readlines()
except ValueError as e:
raise CuckooProcessingError("Error decoding %s: %s" %
(self.log_path, e))
except (IOError, OSError) as e:
raise CuckooProcessingError("Error opening %s: %s" %
(self.log_path, e))
for error in Database().view_errors(int(self.task["id"])):
debug["errors"].append(error.message)
if os.path.exists(self.mitmerr_path):
mitmerr = open(self.mitmerr_path, "rb").read()
if mitmerr:
debug["errors"].append(mitmerr)
return debug