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

Source Code for Module modules.processing.targetinfo

 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.path 
 6   
 7  from lib.cuckoo.common.abstracts import Processing 
 8  from lib.cuckoo.common.objects import File 
 9   
10 -class TargetInfo(Processing):
11 """General information about a file.""" 12
13 - def run(self):
14 """Run file information gathering. 15 @return: information dict. 16 """ 17 self.key = "target" 18 19 target_info = {"category": self.task["category"]} 20 21 if self.task["category"] == "file": 22 target_info["file"] = {} 23 24 # let's try to get as much information as possible, i.e., the 25 # filename if the file is not available anymore 26 if os.path.exists(self.file_path): 27 target_info["file"] = File(self.file_path).get_all() 28 29 target_info["file"]["name"] = File(self.task["target"]).get_name() 30 elif self.task["category"] == "url": 31 target_info["url"] = self.task["target"] 32 33 return target_info
34