def run(self): while 1: try: self.line = str(queue.popleft()) except: break if self.Npath: self.Npath = self.Npath self.req = urllib2.Request(self.site + "/" + self.Npath + "/" + self.line) else: self.req = urllib2.Request(self.site + "/" + self.line) try: urllib2.urlopen(self.req, timeout=10) except urllib2.HTTPError as self.hr: if self.hr.code == 404: if self.Npath: print self.smode + ": " + self.Npath + "/" + self.line.ljust( 70 - len(self.Npath) - 1, ' '), else: print self.smode + ": " + self.line.ljust(70, ' '), sys.stdout.write("\r") except urllib2.URLError as self.ur: printError("URL error:" + self.line.ljust(50, ' ') + str(self.ur.args[0]).ljust(20, ' ')) exit()
def f4ckDir(site,sdir,smode,sproxy = None, sscript = None): if sproxy: connet_proxy = myproxy(sproxy) if not connet_proxy: printError("proxy Error!!") sys.exit(1) try: filename = site.replace ("http://","").replace ("/","") ldir = "/".join(sdir.split("/")[0:-2]) logging_file=logging(ldir+"/log/"+filename+".txt") except Exception,e: print e pass
def run(self): while 1: if queue.empty()== True: break self.line = str(queue.get()) self.req = urllib2.Request(self.site + "/" + self.line) try: urllib2.urlopen(self.req,timeout=10) except urllib2.HTTPError as self.hr: if self.hr.code == 404: print self.smode+": " + self.line.ljust(70,' '), sys.stdout.write("\r") except urllib2.URLError as self.ur: printError("URL error:" + self.line.ljust(50,' ') + str(self.ur.args[0]).ljust(20,' ')) exit()
def urlcheck(site): if site[:4] != "http": site = "http://" + site if site.endswith("--"): site = site.rstrip('--') if site.endswith("/*"): site = site.rstrip('/*') try: printProcess("[!] Checking website " + site + "...") req = urllib2.Request(site) urllib2.urlopen(site, timeout=10) printResult("[+] " + site + " appears to be Online.\n") except: printError("[-] Server offline or invalid URL") return None return site
def urlcheck(site): if site[:4] != "http": site = "http://"+site if site.endswith("--"): site = site.rstrip('--') if site.endswith("/*"): site = site.rstrip('/*') try: printProcess("[!] Checking website " + site + "...") req = urllib2.Request(site) urllib2.urlopen(site) printResult("[+] " + site +" appears to be Online.\n") except: printError("[-] Server offline or invalid URL") return None return site
def chooseDic(smode): path = sys.path[0] path = path.replace("\\","/") if smode == "shell": wordlist=path+"/dic/shell.txt" elif smode == "backup": wordlist=path+"/dic/backups.txt" elif smode == "admin": wordlist=path+"/dic/admins.txt" elif smode == "dir": wordlist=path+"/dic/dir.txt" elif smode == "files": wordlist=path+"/dic/files.txt" elif smode == "all": wordlist=path+"/dir/" else: printError("[-] Mode not specified") os._exit(1) if smode != "all" and not os.access(wordlist, os.F_OK): printError ("[-] File " + wordlist + " does not exist or " + "you are not permitted to access to the file" ) os._exit(1) return wordlist
def chooseDic(smode): path = sys.path[0] path = path.replace("\\","/") if smode == "shell": wordlist=path+"/dic/shell.txt" elif smode == "backup": wordlist=path+"/dic/backups.txt" elif smode == "admin": wordlist=path+"/dic/admins.txt" elif smode == "dir": wordlist=path+"/dic/dir.txt" elif smode == "files": wordlist=path+"/dic/files.txt" elif smode == "all": wordlist=path+"/dic/" else: printError("[-]warning!!!: Mode not specified") wordlist=path+"/dic/"+smode+".txt" if smode != "all" and not os.access(wordlist, os.F_OK): printError ("[-] File " + wordlist + " does not exist or " + "you are not permitted to access to the file" ) os._exit(1) return wordlist
def run(self): while 1: try: self.line = str(queue.popleft()) except: break if self.Npath: self.Npath = self.Npath self.req = urllib2.Request(self.site + "/" + self.Npath + "/" + self.line) else: self.req = urllib2.Request(self.site + "/" + self.line) try: urllib2.urlopen(self.req,timeout=10) except urllib2.HTTPError as self.hr: if self.hr.code == 404: if self.Npath: print self.smode+": " + self.Npath + "/" + self.line.ljust(70-len(self.Npath)-1,' '), else: print self.smode+": " + self.line.ljust(70,' '), sys.stdout.write("\r") except urllib2.URLError as self.ur: printError("URL error:" + self.line.ljust(50,' ') + str(self.ur.args[0]).ljust(20,' ')) exit()
def proxycheck(myhttpproxy, myproxy): try: if myproxy: printWait("[+] Testing Proxy...") h2 = httplib.HTTPConnection(myhttpproxy) h2.connect() printResult("[+] Proxy:" + myhttpproxy + "\n") return 1 except (socket.timeout): printError("[-] Proxy Timed Out") return None except (NameError): printError("[-] Proxy Not Given") return None except: printError("[-] Proxy Failed") return None
def proxycheck(myhttpproxy,myproxy): try: if myproxy: printWait("[+] Testing Proxy...") h2 = httplib.HTTPConnection(myhttpproxy) h2.connect() printResult("[+] Proxy:"+myhttpproxy+"\n") return 1 except(socket.timeout): printError("[-] Proxy Timed Out") return None except(NameError): printError("[-] Proxy Not Given") return None except: printError("[-] Proxy Failed") return None
try: opts, args = getopt.getopt (sys.argv[2:], "m:p:") except: printSyntax() sys.exit(1) ################################################### # Load input parameters sproxy = None smode = None for opt, arg in opts: if opt == '-m': smode = arg elif opt == '-p': sproxy = arg else: printError("Unknown options!!") printSyntax() sys.exit(1) site = sys.argv[1] site = urlcheck(site) if site == None: sys.exit(1) sdir = chooseDic(smode) f4ckDir(site,sdir,smode)
# Load input parameters sproxy = None smode = None sscript = None DG = None for opt, arg in opts: if opt == '-m': smode = arg elif opt == '-p': sproxy = arg elif opt == '-t': sscript = arg elif opt == '-d': DG = 1 else: printError("Unknown options!!") printSyntax() sys.exit(1) site = sys.argv[1] site = urlcheck(site) if site == None: sys.exit(1) sdir = chooseDic(smode) if sproxy: is_sproxy = proxycheck(sproxy,1) if not is_sproxy: go_on = raw_input("GO ON to check the website? (N/y): ") if go_on != "y": sys.exit(1) if sscript: