Skip to content

Use qemu screenshots config #2601

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions modules/auxiliary/QemuScreenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
from threading import Thread

from lib.cuckoo.common.abstracts import Auxiliary
from lib.cuckoo.common.config import Config
from lib.cuckoo.common.constants import CUCKOO_ROOT

cfg = Config("auxiliary").get("QemuScreenshots")

log = logging.getLogger(__name__)

try:
Expand Down Expand Up @@ -56,10 +59,12 @@ def __init__(self):
Thread.__init__(self)
log.info("QEMU screenshots module loaded")
self.screenshot_thread = None
self.enabled = cfg.get("enabled")
self.do_run = self.enabled

def start(self):
"""Start capture in a separate thread."""
self.screenshot_thread = ScreenshotThread(self.task, self.machine)
self.screenshot_thread = ScreenshotThread(self.task, self.machine, self.do_run)
self.screenshot_thread.start()
return True

Expand All @@ -72,11 +77,11 @@ def stop(self):
class ScreenshotThread(Thread):
"""Thread responsible for taking screenshots."""

def __init__(self, task, machine):
def __init__(self, task, machine, do_run):
Thread.__init__(self)
self.task = task
self.machine = machine
self.do_run = True
self.do_run = do_run

self.screenshots_path = os.path.join(CUCKOO_ROOT, "storage", "analyses", str(self.task.id), "shots")
os.makedirs(self.screenshots_path, exist_ok=True)
Expand Down
Loading