def handle_exception(e): global torBadNodes error.toLog("changing the ip ...."+str(e)) if sys.argv.count("-no-check") > 0: return 0 if str(e).find("hour") != -1: error.toLog("bash -c \"echo authenticate \\\"\\\";echo signal newnym;echo quit \"|nc 127.0.0.1 9051"); ret = os.popen("bash ~/bin/get_exits.sh").readline() ret.strip() if len(torBadNodes) > 5000: torBadNodes = "" deli = "," if torBadNodes == "": deli = "" torBadNodes += (deli + ret.replace(" ", "").replace("$", "\$").replace("\n", "")) print "bash ~/bin/change_ip.sh \""+torBadNodes+"\"" os.system("bash ~/bin/change_ip.sh \""+torBadNodes+"\"") time.sleep(10)
def handle_exception(e): global torBadNodes error.toLog("changing the ip ...." + str(e)) if sys.argv.count("-no-check") > 0: return 0 if str(e).find("hour") != -1: error.toLog( "bash -c \"echo authenticate \\\"\\\";echo signal newnym;echo quit \"|nc 127.0.0.1 9051" ) ret = os.popen("bash ~/bin/get_exits.sh").readline() ret.strip() if len(torBadNodes) > 5000: torBadNodes = "" deli = "," if torBadNodes == "": deli = "" torBadNodes += ( deli + ret.replace(" ", "").replace("$", "\$").replace("\n", "")) print "bash ~/bin/change_ip.sh \"" + torBadNodes + "\"" os.system("bash ~/bin/change_ip.sh \"" + torBadNodes + "\"") time.sleep(10)
print "path2 ", path2 if fin and len(path2) < len(path): path = path2 print max_step, forward_min, backward_min if reqs >= 1000: reqs = -2 break print path profiles = len(backward) + len(forward) expands = len([i for i in forward if i["cursor"] != -1]) + len( [i for i in backward if i["cursor"] != -1]) generations = sum([len(i["friends"]) for i in forward]) + sum( [len(i["followers"]) for i in backward]) print "_" * 40 + ",".join([ username1, username2, str(len(path) - 1), str(profiles), str(expands), str(generations), str(reqs + 2) ]) sys.exit(0) except error.TweepError, e: if str(e).find("hour") == -1: print "ENDED: ", sys.argv, str(e), username1, username2 error.toLog("BAD EXCEPTION: " + str(e)) handle_exception(e) print str(e) # raise e
while has_node(backward): fin, path = go_backward() reqs +=1;print reqs if fin or reqs >= 1000: print path;break if fin: break if reqs >= 1000: reqs=-2;break fin,path = go_forward() reqs += 1 if fin: print path;break if reqs >= 1000: reqs=-2;break while has_node(forward): fin,path = go_forward() reqs += 1;print reqs if fin or reqs >= 1000: print path;break if fin: break if reqs >= 1000: reqs = -2 break profiles = len(backward)+len(forward) expands = len([i for i in forward if i["cursor"]!=-1]) + len([i for i in backward if i["cursor"]!=-1]) generations = sum([len(i["friends"]) for i in forward]) + sum([len(i["followers"]) for i in backward]) print "_"*40+",".join([sys.argv[1], sys.argv[2], str(len(path)-1), str(profiles),str(expands),str(generations), str(reqs+2)]) sys.exit(0) except error.TweepError,e: if str(e).find("hour") == -1: print "ENDED: ", str(e),sys.argv error.toLog("BAD EXCEPTION: "+str(e)) print e