1
2
3
4
5 import time
6 import logging
7 from datetime import datetime
8
9 from lib.cuckoo.common.abstracts import Processing
10 from lib.cuckoo.common.constants import CUCKOO_VERSION
11
12 log = logging.getLogger(__name__)
13
14
16 """General information about analysis session."""
17
19 """Run information gathering.
20 @return: information dict.
21 """
22 self.key = "info"
23
24 try:
25 started = time.strptime(self.task["started_on"],
26 "%Y-%m-%d %H:%M:%S")
27 started = datetime.fromtimestamp(time.mktime(started))
28
29 ended = time.strptime(self.task["completed_on"],
30 "%Y-%m-%d %H:%M:%S")
31 ended = datetime.fromtimestamp(time.mktime(ended))
32 except:
33 log.critical("Failed to get start/end time from Task.")
34
35 duration = -1
36 else:
37 duration = (ended - started).seconds
38
39 info = {
40 "version": CUCKOO_VERSION,
41 "started": self.task["started_on"],
42 "ended": self.task.get("completed_on", "none"),
43 "duration": duration,
44 "id": int(self.task["id"]),
45 "category": self.task["category"],
46 "custom": self.task["custom"]
47 }
48
49 return info
50