Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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