modules.packages.applet

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

# Source Code for Module modules.packages.applet

     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 tempfile
     7
     8  from lib.common.abstracts import Package
     9
    10 -class Applet(Package):
    11      """Java Applet analysis package."""
    12      PATHS = [
    13          ("ProgramFiles", "Mozilla Firefox", "firefox.exe"),
    14          ("ProgramFiles", "Internet Explorer", "iexplore.exe"),
    15      ]
    16
    17 -    def make_html(self, path, class_name):
    18          html = """
    19          <html>
    20              <body>
    21                  <applet archive="%s" code="%s" width="1" height="1">
    22                  </applet>
    23              </body>
    24          </html>
    25          """ % (path, class_name)
    26
    27          _, file_path = tempfile.mkstemp(suffix=".html")
    28          with open(file_path, "w") as file_handle:
    29              file_handle.write(html)
    30
    31          return file_path
    32
    33 -    def start(self, path):
    34          browser = self.get_path("browser")
    35          class_name = self.options.get("class")
    36          html_path = self.make_html(path, class_name)
    37          return self.execute(
    38              browser, args=[html_path], trigger="file:%s" % html_path
    39          )
    40