modules.auxiliary.reboot

Package modules :: Package auxiliary :: Module reboot |
[hide private]
[frames] | no frames]

# Source Code for Module modules.auxiliary.reboot

     1  # Copyright (C) 2016 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 json
     6  import logging
     7  import os.path
     8
     9  from lib.common.abstracts import Auxiliary
    10  from lib.common.registry import set_regkey_full
    11
    12  log = logging.getLogger(__name__)
    13
    14 -class Reboot(Auxiliary):
    15      """Prepares the environment to behave as if the VM has been rebooted."""
    16
    17 -    def start(self):
    18          if self.analyzer.config.package != "reboot":
    19              return
    20
    21          reboot_path = os.path.join(self.analyzer.path, "reboot.json")
    22          for line in open(reboot_path, "rb"):
    23              event = json.loads(line)
    24
    25              if not hasattr(self, "_handle_%s" % event["category"]):
    26                  log.warning(
    27                      "Unable to handle reboot event with name %s as it has "
    28                      "not yet been implemented.", event["category"]
    29                  )
    30                  continue
    31
    32              getattr(self, "_handle_%s" % event["category"])(event)
    33
    34 -    def _handle_regkey_written(self, event):
    35          regkey, type_, value = event["args"]
    36          set_regkey_full(regkey, type_, value)
    37
    38 -    def _handle_create_process(self, event):
    39          self.analyzer.reboot.append((event["category"], event["args"]))
    40