def run(self): """ OneForAll running entrance :return: All subdomain results :rtype: list """ print(oneforall_banner) dt = datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(f'[*] Starting OneForAll @ {dt}\n') utils.check_env() if settings.enable_check_version: utils.check_version(version) logger.log('DEBUG', 'Python ' + utils.python_version()) logger.log('DEBUG', 'OneForAll ' + version) logger.log('INFOR', 'Start running OneForAll') self.config_param() self.check_param() self.domains = utils.get_domains(self.target, self.targets) if self.domains: for domain in self.domains: self.domain = utils.get_main_domain(domain) self.main() utils.export_all(self.alive, self.format, self.path, self.datas) else: logger.log('FATAL', 'Failed to obtain domain') logger.log('INFOR', 'Finished OneForAll')
def gen_brute_dict(self, domain): logger.log('INFOR', f'Generating dictionary for {domain}') dict_set = set() # 如果domain不是self.subdomain 而是self.domain的子域则生成递归爆破字典 if self.place is None: self.place = '*.' + domain wordlist = self.wordlist main_domain = utils.get_main_domain(domain) if domain != main_domain: wordlist = self.recursive_nextlist if self.word: word_subdomains = gen_word_subdomains(self.place, wordlist) # set可以合并list dict_set = dict_set.union(word_subdomains) if self.fuzz: fuzz_subdomains = gen_fuzz_subdomains(self.place, self.rule) dict_set = dict_set.union(fuzz_subdomains) # logger.log('INFOR', f'正在去重爆破字典') # dict_set = utils.uniq_dict_list(dict_set) count = len(dict_set) logger.log('INFOR', f'Dictionary size: {count}') if count > 10000000: logger.log( 'ALERT', f'The generated dictionary is ' f'too large {count} > 10000000') return dict_set
def run(self): """ OneForAll running entrance :return: All subdomain results :rtype: list """ print(oneforall_banner) dt = datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(f'[*] Starting OneForAll @ {dt}\n') logger.log('DEBUG', 'Python ' + utils.python_version()) logger.log('DEBUG', 'OneForAll ' + version) utils.check_dep() self.access_internet, self.in_china = utils.get_net_env() if self.access_internet and settings.enable_check_version: utils.check_version(version) logger.log('INFOR', 'Start running OneForAll') self.config_param() self.check_param() self.domains = utils.get_domains(self.target, self.targets) count = len(self.domains) logger.log('INFOR', f'Got {count} domains') if not count: logger.log('FATAL', 'Failed to obtain domain') exit(1) for domain in self.domains: self.domain = utils.get_main_domain(domain) self.main() if count > 1: utils.export_all(self.alive, self.fmt, self.path, self.datas) logger.log('INFOR', 'Finished OneForAll')
def __init__(self, domain, export=True): self.domain = utils.get_main_domain(domain) self.elapse = 0.0 self.modules = [] self.collect_funcs = [] self.path = None self.export = export self.format = 'csv'
def worker(self, subdomain): cname = get_cname(subdomain) if cname is None: return main_domain = utils.get_main_domain(cname) for fingerprint in self.fingerprints: cnames = fingerprint.get('cname') if main_domain not in cnames: continue responses = fingerprint.get('response') self.compare(subdomain, cname, responses)
def query_domain_ns(domain): logger.log('INFOR', f'Querying NS records of {domain}') domain = utils.get_main_domain(domain) resolver = utils.dns_resolver() try: answer = resolver.query(domain, 'NS') except Exception as e: logger.log('ERROR', e.args) logger.log('ERROR', f'Querying NS records of {domain} error') return list() ns = [item.to_text() for item in answer] logger.log('INFOR', f'{domain}\'s authoritative name server is {ns}') return ns
def gen_brute_dict(self, domain): logger.log('INFOR', f'Generating dictionary for {domain}') dict_set = set() # If domain is not self.subdomain but a subdomain of self.domain, a recursive blasting dictionary is generated if self.word: self.place = '' if not self.place: self.place = '*.' + domain wordlist = self.wordlist main_domain = utils.get_main_domain(domain) if domain != main_domain: wordlist = self.recursive_nextlist if self.word: word_subdomains = gen_word_subdomains(self.place, wordlist) dict_set.update(word_subdomains) if self.fuzz: fuzz_subdomains = gen_fuzz_subdomains(self.place, self.rule, self.fuzzlist) dict_set.update(fuzz_subdomains) count = len(dict_set) logger.log('INFOR', f'Dictionary size: {count}') if count > 10000000: logger.log('ALERT', f'The generated dictionary is ' f'too large {count} > 10000000') return dict_set