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 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
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() except ValueError as self.vr: pprintError("Value error:" + str(self.vr.args)) exit() except: printWait("Unknown exception: exit...") exit() else: printResult(self.smode+": " + self.line.ljust(56,' ') + "[OK]".ljust(30,' ')) try: self.logging_file.writelog(self.smode+": " + self.line.ljust(50,' ') + "[OK]\n") except: pass # class Loading(threading.Thread): # def __init__(self,maxloading): # self.maxloading = maxloading # print self.maxloading # threading.Thread.__init__(self) # self.percent = 0 # def run(self): # while queue.qsize()>0 and self.percent < 100: # self.percent = 100 * (self.maxloading - queue.qsize()) / self.maxloading # if self.percent > 100:
self.smode = smode self.logging_file = logging_file 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=5) except urllib2.HTTPError as self.hr: if self.hr.code == 404: print self.smode+": " + self.line.ljust(50,' ') + "[Not found]", sys.stdout.write("\r") except urllib2.URLError as self.ur: printError("URL error:" + self.line.ljust(50,' ') + str(self.ur.args)) exit() except ValueError as self.vr: pprintError("Value error:" + str(self.vr.args)) exit() except: printWait("Unknown exception: exit...") exit() else: printResult(self.smode+": " + self.line.ljust(57,' ') + "[OK]") try: self.logging_file.writelog(self.smode+": " + self.line.ljust(50,' ') + "[OK]\n") except: pass
except urllib2.URLError as self.ur: printError("URL error:" + self.line.ljust(50, ' ') + str(self.ur.args[0]).ljust(20, ' ')) exit() except ValueError as self.vr: pprintError("Value error:" + str(self.vr.args)) exit() except: printWait("Unknown exception: exit...") exit() else: if len(self.line.split(".")) == 1: if self.Npath: dpath.append(self.Npath + "/" + self.line.strip("/")) printResult(self.smode + ": " + self.Npath + "/" + self.line.ljust(56 - len(self.Npath) - 1, ' ') + "[OK]".ljust(30, ' ')) else: dpath.append(self.line) printResult(self.smode + ": " + self.line.ljust(56, ' ') + "[OK]".ljust(30, ' ')) else: printResult(self.smode + ": " + self.line.ljust(56, ' ') + "[OK]".ljust(30, ' ')) try: self.logging_file.writelog(self.smode + ": " + self.line.ljust(50, ' ') + "[OK]\n") except: pass
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() except ValueError as self.vr: pprintError("Value error:" + str(self.vr.args)) exit() except: printWait("Unknown exception: exit...") exit() else: if len(self.line.split(".")) == 1: if self.Npath: dpath.append ( self.Npath + "/" + self.line.strip("/") ) printResult(self.smode+": " + self.Npath + "/" + self.line.ljust(56-len(self.Npath)-1,' ') + "[OK]".ljust(30,' ')) else: dpath.append ( self.line ) printResult(self.smode+": " + self.line.ljust(56,' ') + "[OK]".ljust(30,' ')) else: printResult(self.smode+": " + self.line.ljust(56,' ') + "[OK]".ljust(30,' ')) try: self.logging_file.writelog(self.smode+": " + self.line.ljust(50,' ') + "[OK]\n") except: pass