def RetryUnSolvedList(): global UnSolvedList print(u"[+]第%d次建立新的线程尝试未完成的工作.当前未完成数为%d,请稍候.\r" % (RetryTime,len(UnSolvedList))) CurrentUnSolveList = UnSolvedList[:] UnSolvedList = [] UnSolvedListWm = WorkerManager(Threads) for ip in CurrentUnSolveList: RetryList[ip] = 0 UnSolvedListWm.add_job(IpToMap,ip,) UnSolvedListWm.wait_for_complete() UnSolvedList=list(set(UnSolvedList))
def main(): """ """ global UnSolvedList,RetryTime print "[+]Starting at:",time.ctime() print u"总数为:%d" % len(TargetIps) MainWorker = WorkerManager(Threads) for ip in TargetIps: MainWorker.add_job(IpToMap,ip,) MainWorker.wait_for_complete() UnSolvedList=list(set(UnSolvedList)) while UnSolvedList and RetryTime < MaxRetryTime: RetryTime +=1 RetryUnSolvedList() if UnSolvedList and RetryTime >=MaxRetryTime: print u"[-]超出最大重试次数.剩余ip请手工检测.总数为%d" % len(UnSolvedList) print UnSolvedList print "[+]All done at:",time.ctime()