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

Source Code for Module modules.packages.applet

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