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