Restructure reloads for python3 compliance

This commit is contained in:
TrustedSec 2016-01-23 18:56:37 -05:00
parent a73bea73dc
commit 4867a01859
11 changed files with 45 additions and 43 deletions

View file

@ -10,6 +10,8 @@ version 7.0
* added more words to mssql wordlist
* major refactoring of python codebase to support both python2 and python3
* restructured HTA attack vector and improved codebase to redirect after 3 seconds to the legitimate website while still launching the HTA file, this makes it very easy to coax victim into beleiving the HTA they are running is from a legitimate link
* rewrote alphanumeric shellcode injector to be python3 compliant and optimized
* added module_rewrite function instead of reload() for python3
~~~~~~~~~~~~~~~~
version 6.5.9

View file

@ -312,39 +312,39 @@ try:
# ms08067
if range == "1":
try:
reload(src.fasttrack.exploits.ms08067)
module_reload(src.fasttrack.exploits.ms08067)
except:
import src.fasttrack.exploits.ms08067
# firefox 3.6.16
if range == "2":
try:
reload(src.fasttrack.exploits.firefox_3_6_16)
module_reload(src.fasttrack.exploits.firefox_3_6_16)
except:
import src.fasttrack.exploits.firefox_3_6_16
# solarwinds
if range == "3":
try:
reload(src.fasttrack.exploits.solarwinds)
module_reload(src.fasttrack.exploits.solarwinds)
except:
import src.fasttrack.exploits.solarwinds
# rdp DoS
if range == "4":
try:
reload(src.fasttrack.exploits.rdpdos)
module_reload(src.fasttrack.exploits.rdpdos)
except:
import src.fasttrack.exploits.rdpdos
if range == "5":
try:
reload(src.fasttrack.exploits.mysql_bypass)
module_reload(src.fasttrack.exploits.mysql_bypass)
except:
import src.fasttrack.exploits.mysql_bypass
if range == "6":
try:
reload(src.fasttrack.exploits.f5)
module_reload(src.fasttrack.exploits.f5)
except:
import src.fasttrack.exploits.f5
@ -356,7 +356,7 @@ try:
if attack_vector == "3":
# load sccm attack
try:
reload(src.fasttrack.sccm.sccm_main)
module_reload(src.fasttrack.sccm.sccm_main)
except:
import src.fasttrack.sccm.sccm_main
@ -445,7 +445,7 @@ try:
if attack_vector == "6":
print("\nPSEXEC Powershell Injection Attack:\n\nThis attack will inject a meterpreter backdoor through powershell memory injection. This will circumvent\nAnti-Virus since we will never touch disk. Will require Powershell to be installed on the remote victim\nmachine. You can use either straight passwords or hash values.\n")
try:
reload(src.fasttrack.psexec)
module_reload(src.fasttrack.psexec)
except:
import src.fasttrack.psexec

View file

@ -236,7 +236,7 @@ if exploit_counter == 0:
sys.path.append("src/phishing/smtp/client/")
debug_msg(me, "importing 'src.phishing.smtp.client.smtp_client'", 1)
try:
reload(smtp_client)
module_reload(smtp_client)
except:
import smtp_client
@ -262,7 +262,7 @@ if exploit == "unc_embed":
sys.path.append("src/phishing/smtp/client/")
debug_msg(me, "importing 'src.phishing.smtp.client.smtp_client'", 1)
try:
reload(smtp_client)
module_reload(smtp_client)
except:
import smtp_client
@ -271,14 +271,14 @@ if exploit == "dll_hijacking":
sys.path.append("src/core/payloadgen")
debug_msg(me, "importing 'src.core.payloadgen.create_payloads'", 1)
try:
reload(create_payloads)
module_reload(create_payloads)
except:
import create_payloads
sys.path.append("src/webattack/dll_hijacking")
debug_msg(me, "importing 'src.webattack.dll_hijacking.hijacking'", 1)
try:
reload(hijacking)
module_reload(hijacking)
except:
import hijacking
@ -320,7 +320,7 @@ if exploit == "dll_hijacking":
sys.path.append("src/phishing/smtp/client/")
debug_msg(me, "importing 'src.phishing.smtp.client.smtp_client'", 1)
try:
reload(smtp_client)
module_reload(smtp_client)
except:
import smtp_client
try:

View file

@ -9,7 +9,7 @@ me = mod_name()
sys.path.append("src/core")
debug_msg(me, "re-importing 'src.core.setcore'", 1)
try:
reload(setcore)
module_reload(setcore)
except:
import setcore
print("[---] Updating the Social Engineer Toolkit FileFormat Exploit List [---]")

View file

@ -567,7 +567,7 @@ def site_cloner(website, exportpath, *args):
# if we are using menu mode we reload just in case
try:
debug_msg("setcore", "importing 'src.webattack.web_clone.cloner'", 1)
reload(cloner)
module_reload(cloner)
except:
debug_msg("setcore", "importing 'src.webattack.web_clone.cloner'", 1)
@ -608,7 +608,7 @@ def meterpreter_reverse_tcp_exe(port):
sys.path.append("src/core/payloadgen")
try:
debug_msg("setcore", "importing 'src.core.payloadgen.create_payloads'", 1)
reload(create_payloads)
module_reload(create_payloads)
except:
debug_msg("setcore", "importing 'src.core.payloadgen.create_payloads'", 1)
@ -1887,7 +1887,7 @@ Select which option you want:
try:
import src.html.unsigned.self_sign
except:
reload(src.html.unsigned.self_sign)
module_reload(src.html.unsigned.self_sign)
# if we need to use the built in applet
if choice1 == "2":
@ -1899,7 +1899,7 @@ Select which option you want:
try:
import src.html.unsigned.verified_sign
except:
reload(src.html.unsigned.verified_sign)
module_reload(src.html.unsigned.verified_sign)
# reload module function for python 2 and python 3
def module_reload(module):
@ -1907,7 +1907,7 @@ def module_reload(module):
import importlib
importlib.reload(module)
else:
reload(module)
module_reload(module)
def input(string):
return raw_input(string)

View file

@ -139,7 +139,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
# if we don't have powershell
if option == "2":
try:
reload(src.core.payloadgen.create_payloads)
module_reload(src.core.payloadgen.create_payloads)
except:
import src.core.payloadgen.create_payloads
print_status("Connection established with SQL Server...")
@ -175,7 +175,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
if not os.path.isfile(setdir + "/set.payload"):
if operating_system == "posix":
try:
reload(pexpect)
module_reload(pexpect)
except:
import pexpect
print_status("Starting the Metasploit listener...")
@ -211,7 +211,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
filewrite.write("windows/meterpreter/reverse_tcp" + " " + port + ",")
filewrite.close()
try:
reload(src.payloads.powershell.prep)
module_reload(src.payloads.powershell.prep)
except:
import src.payloads.powershell.prep
# create the directory if it does not exist
@ -240,7 +240,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
msf_path = meta_path()
if operating_system == "posix":
try:
reload(pexpect)
module_reload(pexpect)
except:
import pexpect
print_status("Starting the Metasploit listener...")
@ -332,7 +332,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
# thread is needed here due to the connect not always terminating thread,
# it hangs if thread isnt specified
try:
reload(thread)
module_reload(thread)
except:
import thread

View file

@ -69,7 +69,7 @@ try:
print_status(
"Prepping the payload for delivery and injecting alphanumeric shellcode...")
try:
reload(src.payloads.powershell.prep)
module_reload(src.payloads.powershell.prep)
except:
import src.payloads.powershell.prep
# create the directory if it does not exist

View file

@ -570,7 +570,7 @@ try:
automatic_listener = check_config("AUTOMATIC_LISTENER=").lower()
if automatic_listener != "off":
try:
reload(pexpect)
module_reload(pexpect)
except:
import pexpect
# specify if we are using the multi pyinjector
@ -586,7 +586,7 @@ try:
webattack_email = check_config("WEBATTACK_EMAIL=").lower()
if webattack_email == "on" or track_email == "on":
try:
reload(src.phishing.smtp.client.smtp_web)
module_reload(src.phishing.smtp.client.smtp_web)
except:
import src.phishing.smtp.client.smtp_web
@ -606,14 +606,14 @@ try:
print("\n")
print_info("Launching the SET Interactive Shell...")
try:
reload(src.payloads.set_payloads.listener)
module_reload(src.payloads.set_payloads.listener)
except:
import src.payloads.set_payloads.listener
if set_payload == "SETSHELL_HTTP":
print("\n")
print_info("Launching the SET HTTP Reverse Shell Listener...")
try:
reload(src.payloads.set_payloads.set_http_server)
module_reload(src.payloads.set_payloads.set_http_server)
except:
import src.payloads.set_payloads.set_http_server
@ -696,7 +696,7 @@ if apache == 0:
try:
import src.core.webserver as webserver
except:
reload(src.core.webserver)
module_reload(src.core.webserver)
webserver.stop_server(web_port)
# call the cleanup routine

View file

@ -1,11 +1,11 @@
#!/usr/bin/env python
# This is just a simple import for web_start
import sys
import setcore
me = setcore.mod_name()
setcore.debug_msg(me, "importing 'src.html.spawn'", 1)
from src.core.setcore import *
me = mod_name()
debug_msg(me, "importing 'src.html.spawn'", 1)
sys.path.append("src/html")
try:
reload(spawn)
moduel_reload(spawn)
except:
pass

View file

@ -71,7 +71,7 @@ homepath = os.getcwd()
# pull scraper
try:
reload(src.webattack.harvester.scraper)
module_reload(src.webattack.harvester.scraper)
except:
import src.webattack.harvester.scraper
@ -389,7 +389,7 @@ def run():
pass
if attack_vector != 'multiattack':
try:
reload(src.webattack.harvester.report_generator)
module_reload(src.webattack.harvester.report_generator)
except:
import src.webattack.harvester.report_generator
if attack_vector != 'multiattack':
@ -584,7 +584,7 @@ if webattack_email == True:
try:
import src.phishing.smtp.client.smtp_web
except Exception as e:
reload(src.phishing.smtp.client.smtp_web)
module_reload(src.phishing.smtp.client.smtp_web)
# see if we're tabnabbing or multiattack
fileopen = open(setdir + "/attack_vector", "r")

View file

@ -317,7 +317,7 @@ if java_applet == "on" or meta_attack == "on" or harvester == "on" or tabnabbing
sys.path.append("src/webattack/web_clone")
debug_msg(me, "importing 'src.webattack.web_clone.cloner'", 1)
try:
reload(cloner)
module_reload(cloner)
except:
import cloner
@ -327,7 +327,7 @@ if java_applet == "on" or meta_attack == "on" or harvester == "on" or tabnabbing
sys.path.append("src/core/arp_cache")
debug_msg(me, "importing 'src.core.arp_cache.arp'", 1)
try:
reload(arp)
module_reload(arp)
except:
import arp
@ -336,7 +336,7 @@ if java_applet == "on":
sys.path.append("src/core/payloadgen/")
debug_msg(me, "importing 'src.core.payloadgen.create_payloads'", 1)
try:
reload(create_payloads)
module_reload(create_payloads)
except:
import create_payloads
payloadgen = 1
@ -362,7 +362,7 @@ if harvester == "on" or tabnabbing == "on" or webjacking == "on":
sys.path.append("src/webattack/tabnabbing")
debug_msg(me, "importing 'src.webattack.tabnabbing.tabnabbing'", 1)
try:
reload(tabnabbing)
module_reload(tabnabbing)
except:
import tabnabbing
# if the harvester is on set the multi_harvester flag
@ -380,7 +380,7 @@ if mlitm == "on":
else:
debug_msg(me, "importing 'src.mlitm.mlitm'", 1)
try:
reload(mlitm)
module_reload(mlitm)
except:
import mlitm
@ -389,7 +389,7 @@ if java_applet == "on" or meta_attack == "on":
sys.path.append("src/html/")
debug_msg(me, "importing 'src.html.spawn'", 1)
try:
reload(spawn)
module_reload(spawn)
except:
import spawn