def main(self): """ OneForAll main process :return: subdomain results :rtype: list """ self.old_table = self.domain + '_old_result' self.new_table = self.domain + '_now_result' self.origin_table = self.domain + '_origin_result' self.resolve_table = self.domain + '_resolve_result' collect = Collect(self.domain, export=False) collect.run() if self.brute: # Due to there will be a large number of dns resolution requests, # may cause other network tasks to be error brute = Brute(self.domain, word=True, export=False) brute.check_env = False brute.quite = True brute.run() # Database processing self.deal_db() # Mark the new discovered subdomain self.data = self.mark() # Export results without resolve if not self.dns: return self.export(self.domain) # Resolve subdomains self.data = resolve.run_resolve(self.domain, self.data) # Save resolve results resolve.save_data(self.resolve_table, self.data) # Export results without HTTP request if not self.req: return self.export(self.resolve_table) # HTTP request self.data = request.run_request(self.domain, self.data, self.port) # Save HTTP request result request.save_data(self.domain, self.data) # Add the final result list to the total data list self.datas.extend(self.data) # Export self.export(self.domain) # Scan subdomain takeover if self.takeover: subdomains = utils.get_subdomains(self.data) takeover = Takeover(subdomains) takeover.run() return self.data
def main(self): """ OneForAll实际运行主流程 :return: 子域结果 :rtype: list """ self.old_table = self.domain + '_old_result' self.new_table = self.domain + '_now_result' self.origin_table = self.domain + '_origin_result' self.resolve_table = self.domain + '_resolve_result' collect = Collect(self.domain, export=False) collect.run() if self.brute: # 由于爆破会有大量dns解析请求 并发爆破可能会导致其他任务中的网络请求异常 brute = Brute(self.domain, word=True, export=False) brute.check_env = False brute.run() # 有关数据库处理 self.deal_db() # 标记新发现子域 self.data = self.mark() # 不解析子域直接导出结果 if not self.dns: return self.export(self.domain) # 解析子域 self.data = resolve.run_resolve(self.domain, self.data) # 保存解析结果 resolve.save_data(self.resolve_table, self.data) # 不请求子域直接导出结果 if not self.req: return self.export(self.resolve_table) # 请求子域 self.data = request.run_request(self.domain, self.data, self.port) # 保存请求结果 request.save_data(self.domain, self.data) # 将最终结果列表添加到总的数据列表中 self.datas.extend(self.data) # 数据库导出 self.export(self.domain) # 子域接管检查 if self.takeover: subdomains = utils.get_subdomains(self.data) takeover = Takeover(subdomains) takeover.run() return self.data
def parse_enemy_type(self, line): content = line.strip() content = content.lower() if content == "brute": return Brute() elif content == "runner": return Runner() elif content == "ranger": return Ranger() else: raise CorruptedSaveError("Save file has unknown enemy types")
def main(maxDist=100): rd.seed() numCities = 0 while True: inp1 = int(input("\nEnter the number of cities:")) if inp1 <= 3: print("Number of cities has to be more than 3.") continue numCities = inp1 break cities = [[ maxDist * rd.random(), maxDist * rd.random(), maxDist * rd.random() ] for i in range(numCities)] cities = np.array(cities) algo = None prompt = "Select an Algoritm:\n" \ "0: Brute Force\n" \ "1: Genetic Algorithm\n" while True: inp2 = input(prompt) if inp2 is '0': if numCities > 10: inp3 = input( "It's going to take a while to calculate {} permutations.\n" "Are you sure you want to do Brute Force Algorithm? (y/n).\n" .format(numCities)) if inp3 is not 'y' or inp2 is not 'Y': continue print("Generating permutations, may take a while.\n") algo = Brute(cities) break elif inp2 is '1': algo = GeneticAlgo(cities, 200) break else: continue fig = plt.figure(figsize=(8, 6)) ax = p3.Axes3D(fig) ani = animation.FuncAnimation(fig, update, fargs=(ax, cities, algo), interval=1) plt.show()
def setUp(self): self.n = random.randint(1, 100) a = [] for i in range(self.n): a.append(random.randint(1, 100000)) self.brute = Brute(a) self.dp = Dp(a) self.block = Block(a) self.st = St(a) self.combine1 = Combine1(a) self.combine2 = Combine2(a) self.combine3 = Combine3(a)
def main(self): """ OneForAll main process :return: subdomain results :rtype: list """ utils.init_table(self.domain) if not self.access_internet: logger.log('ALERT', 'Because it cannot access the Internet, ' 'OneForAll will not execute the subdomain collection module!') if self.access_internet: self.enable_wildcard = wildcard.detect_wildcard(self.domain) collect = Collect(self.domain) collect.run() srv = BruteSRV(self.domain) srv.run() if self.brute: # Due to there will be a large number of dns resolution requests, # may cause other network tasks to be error brute = Brute(self.domain, word=True, export=False) brute.enable_wildcard = self.enable_wildcard brute.in_china = self.in_china brute.quite = True brute.run() utils.deal_data(self.domain) # Export results without resolve if not self.dns: return self.export_data() self.data = utils.get_data(self.domain) # Resolve subdomains utils.clear_data(self.domain) self.data = resolve.run_resolve(self.domain, self.data) # Save resolve results resolve.save_db(self.domain, self.data) # Export results without HTTP request if not self.req: return self.export_data() if self.enable_wildcard: # deal wildcard self.data = wildcard.deal_wildcard(self.data) # HTTP request utils.clear_data(self.domain) request.run_request(self.domain, self.data, self.port) # Finder module if settings.enable_finder_module: finder = Finder() finder.run(self.domain, self.data, self.port) # altdns module if settings.enable_altdns_module: altdns = Altdns(self.domain) altdns.run(self.data, self.port) # Information enrichment module if settings.enable_enrich_module: enrich = Enrich(self.domain) enrich.run() # Export self.datas.extend(self.export_data()) # Scan subdomain takeover if self.takeover: subdomains = utils.get_subdomains(self.data) takeover = Takeover(targets=subdomains) takeover.run() return self.data
from board import Board from brute import Brute from gui import Gui from cli import Cli import crook import time board = Board() ans = input("Select mode (cli/gui/compare): ") if ans == "cli" or ans == "gui": brute = Brute(board) while (1): file_name = input( "What board would you like? (easy/medium/hard/insane): ") if file_name not in ["easy", "medium", "hard", "insane"]: print("Invalid puzzle") else: break board.parse_board("boards/" + file_name + ".txt") if ans == "cli": cli = Cli(board, brute) cli.start() else: gui = Gui(board, brute) gui.start() elif ans == "compare": board = Board()