1
2
3
4
5 import os
6 import codecs
7
8 from lib.cuckoo.common.abstracts import Processing
9 from lib.cuckoo.common.exceptions import CuckooProcessingError
10 from lib.cuckoo.core.database import Database
11
13 """Analysis debug information."""
14
16 """Run debug analysis.
17 @return: debug information dict.
18 """
19 self.key = "debug"
20 debug = {"log": "", "errors": []}
21
22 if os.path.exists(self.log_path):
23 try:
24 debug["log"] = codecs.open(self.log_path, "rb", "utf-8").read()
25 except ValueError as e:
26 raise CuckooProcessingError("Error decoding %s: %s" %
27 (self.log_path, e))
28 except (IOError, OSError) as e:
29 raise CuckooProcessingError("Error opening %s: %s" %
30 (self.log_path, e))
31
32 for error in Database().view_errors(int(self.task["id"])):
33 debug["errors"].append(error.message)
34
35 return debug
36