Package modules :: Package processing :: Module debug
[hide private]
[frames] | no frames]

Source Code for Module modules.processing.debug

 1  # Copyright (C) 2010-2014 Cuckoo Foundation. 
 2  # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org 
 3  # See the file 'docs/LICENSE' for copying permission. 
 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   
12 -class Debug(Processing):
13 """Analysis debug information.""" 14
15 - def run(self):
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