modules.packages.wsf

Package modules :: Package packages :: Module wsf |
[hide private]
[frames] | no frames]

# Source Code for Module modules.packages.wsf

     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 logging
     6  import os
     7
     8  from lib.common.abstracts import Package
     9
    10  log = logging.getLogger(__name__)
    11
    12 -class WSF(Package):
    13      """Windows Scripting File analysis package."""
    14      PATHS = [
    15          ("System32", "wscript.exe"),
    16      ]
    17
    18 -    def start(self, path):
    19          wscript = self.get_path("WScript")
    20
    21          # Enforce the .wsf file extension as is required by wscript.
    22          if not path.endswith(".wsf"):
    23              os.rename(path, path + ".wsf")
    24              path += ".wsf"
    25              log.info("Submitted file is missing extension, added .wsf")
    26
    27          return self.execute(wscript, args=[path], trigger="file:%s" % path)
    28