Example #1
0
    def clean_massdns(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))

        output = utils.just_read(command.get('output_path'), get_list=True)
        if not output:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False

        only_A_record, summaries, resolved = [], [], []
        for line in output:
            if '. A ' in line:
                only_A_record.append(line.split('. A ')[1].strip())
                resolved.append(line.split('. A ')[0])
                summary = "domain|{0};;ip_address|{1}".format(
                    line.split('. A ')[0],
                    line.split('. A ')[1])
                summaries.append(summary)
            elif '. CNAME ' in line:
                resolved.append(line.split('. CNAME ')[0])

        cleaned_output = utils.just_write(command.get('cleaned_output'),
                                          "\n".join(only_A_record))

        resolved_path = utils.replace_argument(
            self.options, '$WORKSPACE/probing/resolved-$OUTPUT.txt')
        resolved_output = utils.just_write(resolved_path, "\n".join(resolved))

        if cleaned_output:
            utils.check_output(command.get('cleaned_output'))

        if resolved_output:
            utils.check_output(resolved_path)
        self.update_summaries(summaries)
Example #2
0
    def clean_gowitness(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))

        real_cmd = utils.resolve_command(
            self.options, {
                "banner":
                "gowitness gen report",
                "cmd":
                "$GO_PATH/gowitness report generate -n $WORKSPACE/portscan/screenshot/$OUTPUT-raw-gowitness.html --destination $WORKSPACE/portscan/screenshot/raw-gowitness/ --db $WORKSPACE/portscan/screenshot/gowitness.db",
                "output_path":
                "$WORKSPACE/portscan/screenshot/$OUTPUT-raw-gowitness.html",
            })

        execute.send_cmd(self.options, real_cmd)
        raw_html = utils.just_read(real_cmd.get('output_path'))
        if not raw_html:
            utils.print_bad('Requirement not found: {0}'.format(
                real_cmd.get('output_path')))
            return False

        local_path = utils.replace_argument(self.options,
                                            '$WORKSPACE/portscan/')
        real_html = raw_html.replace(local_path, '')
        utils.just_write(command.get('cleaned_output'), real_html)
        utils.check_output(command.get('cleaned_output'))
Example #3
0
    def update_tech(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))

        output = utils.just_read(command.get('output_path'), get_list=True)
        if not output:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False

        tech_summaries = []
        for line in output:
            try:
                jsonl = utils.get_json(line)
                if jsonl.get('matches'):
                    domain = utils.get_domain(jsonl.get('hostname'))
                    techs = [x.get('app_name') for x in jsonl.get('matches')]
                    item = "domain|{0};;technologies|{1}".format(
                        domain, ",".join(techs))
                    tech_summaries.append(item)
            except:
                pass

        cleaned_output = utils.just_write(command.get('cleaned_output'),
                                          "\n".join(tech_summaries))
        if cleaned_output:
            utils.check_output(command.get('cleaned_output'))
        # update technologies to db
        summary.push_with_file(self.options, command.get('cleaned_output'))
Example #4
0
 def conclude(self):
     outputs = utils.get_output_path(self.commands)
     # print(outputs)
     final_output = utils.replace_argument(
         self.options, "$WORKSPACE/subdomain/final-$OUTPUT.txt")
     # print(final_output)
     outputs = utils.join_files(outputs, final_output)
     utils.check_output(final_output)
     summary.push_with_file(self.options, final_output)
Example #5
0
    def clean_gobuster(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))
        output = utils.just_read(command.get('output_path'))
        if not output:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False

        cleaned_output = utils.just_write(command.get('cleaned_output'),
                                          output.replace('Found: ', ''))
        if cleaned_output:
            utils.check_output(command.get('cleaned_output'))
Example #6
0
    def get_domain(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))

        output = utils.just_read(command.get('output_path'))
        if not output:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False
        no_scheme = output.replace('https://', '').replace('http://', '')

        utils.just_write(command.get('cleaned_output'), no_scheme)
        if command.get('cleaned_output'):
            utils.check_output(command.get('cleaned_output'))
Example #7
0
    def clean_massdns(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(command.get('banner'), command.get('post_run')))
        output = utils.just_read(command.get('output_path'), get_list=True)
        if not output:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False

        # only get A record 
        only_A_record = "\n".join([x.split('. A ')[0] for x in output if '. A ' in x])

        cleaned_output = utils.just_write(command.get(
            'cleaned_output'), only_A_record)
        if cleaned_output:
            utils.check_output(command.get('cleaned_output'))
Example #8
0
    def clean_vhosts_gobuster(self, command):
        final_output = utils.replace_argument(
            self.options, "$WORKSPACE/vhosts/vhosts-$OUTPUT.txt")
        raw_outputs = utils.replace_argument(
            self.options, "$WORKSPACE/vhosts/raw-summary-$OUTPUT.txt")

        content = utils.just_read(raw_outputs)
        if not content:
            return

        result = utils.regex_strip("\\s\\(Status.*", content)
        cleaned_output = utils.just_write(
            final_output, result.replace('Found: ', ''))
        if cleaned_output:
            utils.check_output(command.get(
                'cleaned_output'))
Example #9
0
    def clean_multi_gobuster(self, command):
        final_output = utils.replace_argument(
            self.options, "$WORKSPACE/vhosts/vhost-$OUTPUT.txt")
        # simple hack here
        raw_outputs = utils.list_files(final_output + '/../raw/',
                                       '-gobuster.txt')
        utils.join_files(raw_outputs, final_output)
        # content = final_output
        content = utils.just_read(final_output)
        if content:
            result = utils.regex_strip("\\s\\(Status.*", content)

        cleaned_output = utils.just_write(final_output,
                                          result.replace('Found: ', ''))
        if cleaned_output:
            utils.check_output(command.get('cleaned_output'))
Example #10
0
    def get_subdomains(self, command):
        utils.print_info("Joining all previous subdomain")
        final_path = command.get('requirement')
        if utils.not_empty_file(final_path):
            return
        subdomain_modules = [
            'SubdomainScanning', 'PermutationScan', 'VhostScan'
        ]
        needed_reports = []
        # get reports
        reports = report.get_report_path(self.options, module=False)
        for rep in reports:
            if rep.get('module') in subdomain_modules and 'final' in rep.get(
                    'note'):
                if utils.not_empty_file(rep.get('report_path')):
                    needed_reports.append(rep.get('report_path'))

        utils.join_files(needed_reports, final_path)
        if utils.not_empty_file(final_path):
            utils.check_output(final_path)
Example #11
0
    def clean_findomain(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))
        output = utils.just_read(command.get('output_path'), get_list=True)
        if not output:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False

        result = []
        for line in output:
            if '>>' in line.strip():
                domain = line.strip().strip('>> ').split(' => ')[0]
                ip = line.strip().strip('>> ').split(' => ')[0]
                result.append(domain)

        cleaned_output = utils.just_write(command.get('cleaned_output'),
                                          "\n".join(result))
        if cleaned_output:
            utils.check_output(command.get('cleaned_output'))
Example #12
0
    def get_scheme(self, command):
        utils.print_good('Preparing for {0}:{1}'.format(
            command.get('banner'), command.get('pre_run')))

        scheme_path = utils.replace_argument(
            self.options, '$WORKSPACE/portscan/scheme-$OUTPUT.txt')

        csv_data = utils.just_read(command.get('requirement'), get_list=True)

        if not csv_data:
            utils.print_bad('Requirement not found: {0}'.format(
                command.get('requirement')))
            return False
        result = []
        for line in csv_data[1:]:
            host = line.split(',')[0]
            port = line.split(',')[3]
            result.append("http://" + host + ":" + port)
            result.append("https://" + host + ":" + port)

        utils.just_write(scheme_path, "\n".join(result))
        utils.check_output(scheme_path)
    def clean_massdns(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))

        output = utils.just_read(command.get('output_path'), get_list=True)
        if output:
            only_A_record, resolved, ips = [], [], []
            for line in output:
                if '. A ' in line:
                    ip = line.split('. A ')[1].strip()
                    domain = line.split('. A ')[0]
                    only_A_record.append(domain)
                    ips.append(ip)
                    resolved.append(line.split('. A ')[0])

            cleaned_output = utils.just_write(command.get(
                'cleaned_output'), "\n".join(ips))

            if cleaned_output:
                utils.check_output(command.get('cleaned_output'))

        self.join_ip(command)
Example #14
0
 def conclude(self):
     outputs = report.get_output_path(self.commands)
     final_output = report.get_report_path(self.options, get_final=True)
     outputs = utils.join_files(outputs, final_output)
     utils.check_output(final_output)
 def clean_linkfinder(self, command):
     final_output = command.get('cleaned_output')
     # simple hack here
     raw_outputs = utils.list_files(final_output + '/../raw/', '.txt')
     utils.join_files(raw_outputs, final_output)
     utils.check_output(final_output)