modules.packages.com

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

# Source Code for Module modules.packages.com

     1  # Copyright (C) 2010-2013 Claudio Guarnieri.
     2  # Copyright (C) 2014-2016 Cuckoo Foundation.
     3  # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
     4  # See the file 'docs/LICENSE' for copying permission.
     5
     6  import os
     7
     8  from lib.common.abstracts import Package
     9
    10 -class ComDll(Package):
    11      """COM analysis package."""
    12      PATHS = [
    13          ("System32", "regsvr32.exe"),
    14      ]
    15
    16 -    def start(self, path):
    17          regsvr32 = self.get_path("regsvr32")
    18          arguments = self.options.get("arguments", "")
    19
    20          # Check file extension.
    21          ext = os.path.splitext(path)[-1].lower()
    22
    23          # If the file doesn't have the proper .dll extension force it
    24          # and rename it. This is needed for regsvr32 to execute correctly.
    25          # See ticket #354 for details.
    26          if ext != ".dll":
    27              new_path = path + ".dll"
    28              os.rename(path, new_path)
    29              path = new_path
    30
    31          args = [path]
    32          if arguments:
    33              args.append(arguments)
    34
    35          return self.execute(regsvr32, args=args)
    36