def onStart( self, event ): self.redirect_to_text_control(True) print "Trying to start the server... " html = "" print os.path.dirname(self.path) if self.path != "": os.chdir(os.path.dirname(self.path)) html = os.path.basename(self.path) print "lanzo: ", os.getcwd() simpleserver.start() self.starts.Disable() if html != "" and (html.endswith("html") or html.endswith("htm")) : simpleserver.openBrowser(html)
def main(argv): """ Main Function Loads proxies from a file and spins of a simple web server in a sub-thread. Then creates a number of daemon threads which monitor a queue for available proxies to test. Once completed, successful results are written out to a results.csv file. """ proxy_list = queue.Queue() # Hold a list of proxy ip:ports lock = threading.Lock() # locks good_proxies, bad_proxies lists good_proxies = [] # proxies that passed connectivity tests bad_proxies = [] # proxies that failed connectivity tests # configure logging logging.basicConfig(filename="tester.log", level=logging.DEBUG) # parse input parameters args = processInputParameters(argv) # load in a list of proxies from a text file loadProxyList(args, proxy_list) # start local web server simpleserver.start(args.port) # setup daemons ^._.^ for _ in range(args.threads): worker = threading.Thread( target=test_proxy, args=(args.timeout, proxy_list, lock, good_proxies, bad_proxies, args.wanip, args.port) ) worker.setDaemon(True) worker.start() start = time.time() try: # block main thread until the proxy list queue becomes empty proxy_list.join() except KeyboardInterrupt: print("Finished") saveResults(good_proxies) # some metrics print("Finished in {0:.1f}s".format(time.time() - start))
def main(argv): """ Main Function Loads proxies from a file and spins of a simple web server in a sub-thread. Then creates a number of daemon threads which monitor a queue for available proxies to test. Once completed, successful results are written out to a results.csv file. """ proxy_list = queue.Queue() # Hold a list of proxy ip:ports # lock = threading.Lock() # locks good_proxies list good_proxies = [] # proxies that passed connectivity tests # configure logging logging.basicConfig(filename="tester.log", level=logging.DEBUG) # parse input parameters args = processinputparams(argv) # load in a list of proxies from a text file loadproxylist(args, proxy_list) # start local web server simpleserver.start(args.port) # setup daemons ^._.^ for _ in range(args.threads): worker = threading.Thread(target=test_proxy, args=(args, proxy_list, good_proxies)) worker.setDaemon(True) worker.start() start = time.time() try: # block main thread until the proxy list queue becomes empty proxy_list.join() except KeyboardInterrupt: print("Finished") saveresults(good_proxies) # some metrics print("Finished in {0:.1f}s".format(time.time() - start))