12
12
from threading import Thread
13
13
14
14
from lib .cuckoo .common .abstracts import Auxiliary
15
+ from lib .cuckoo .common .config import Config
15
16
from lib .cuckoo .common .constants import CUCKOO_ROOT
16
17
18
+ cfg = Config ("auxiliary" ).get ("QemuScreenshots" )
19
+
17
20
log = logging .getLogger (__name__ )
18
21
19
22
try :
@@ -56,10 +59,12 @@ def __init__(self):
56
59
Thread .__init__ (self )
57
60
log .info ("QEMU screenshots module loaded" )
58
61
self .screenshot_thread = None
62
+ self .enabled = cfg .get ("enabled" )
63
+ self .do_run = self .enabled
59
64
60
65
def start (self ):
61
66
"""Start capture in a separate thread."""
62
- self .screenshot_thread = ScreenshotThread (self .task , self .machine )
67
+ self .screenshot_thread = ScreenshotThread (self .task , self .machine , self . do_run )
63
68
self .screenshot_thread .start ()
64
69
return True
65
70
@@ -72,11 +77,11 @@ def stop(self):
72
77
class ScreenshotThread (Thread ):
73
78
"""Thread responsible for taking screenshots."""
74
79
75
- def __init__ (self , task , machine ):
80
+ def __init__ (self , task , machine , do_run ):
76
81
Thread .__init__ (self )
77
82
self .task = task
78
83
self .machine = machine
79
- self .do_run = True
84
+ self .do_run = do_run
80
85
81
86
self .screenshots_path = os .path .join (CUCKOO_ROOT , "storage" , "analyses" , str (self .task .id ), "shots" )
82
87
os .makedirs (self .screenshots_path , exist_ok = True )
0 commit comments