Beispiel #1
0
    def update_ports(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(command.get('banner'),
                                                       command.get('pre_run')))

        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]
            if result.get(host, None):
                result[host] += "," + str(port).strip(',')
            else:
                result[host] = port

        # store it as format can submit to summaries
        final_result = []
        for host, ports in result.items():
            item = "ip_address|{0};;ports|{1}".format(host, ports)
            final_result.append(item)

        utils.just_write(command.get('cleaned_output'),
                         "\n".join(final_result))
        summary.push_with_file(self.options, command.get('cleaned_output'))
Beispiel #2
0
    def get_scheme(self, command):
        utils.print_good('Cleaning for {0}:{1}'.format(
            command.get('banner'), command.get('post_run')))

        csv_data = utils.just_read(command.get('requirement'), get_list=True)
        if not csv_data:
            utils.print_bad('Output not found: {0}'.format(
                command.get('output_path')))
            return False
        summaries, result = [], []
        for line in csv_data[1:]:
            # print(line)
            if ',' not in line or len(line.split(',')) < 3:
                continue
            _results = line.split(',')
            host = _results[0].strip('"')
            port = _results[2].strip('"')
            service = _results[4].strip('"') + "/" + _results[5].strip('"')
            result.append("http://" + host + ":" + port)
            result.append("https://" + host + ":" + port)
            sum_line = f"domain|{host};;ip_address|{host};;ports|{port};;technologies|{service}"
            summaries.append(sum_line)
            # print(sum_line)

        scheme_path = utils.replace_argument(
            self.options, '$WORKSPACE/vulnscan/scheme-$OUTPUT.txt')
        utils.just_write(scheme_path, "\n".join(result))

        # update summaries table
        formatted_summary = utils.replace_argument(
            self.options, '$WORKSPACE/vulnscan/formatted-summary-$OUTPUT.txt')
        utils.just_write(formatted_summary, "\n".join(summaries))
        summary.push_with_file(self.options, formatted_summary)
Beispiel #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'))
Beispiel #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)
Beispiel #5
0
 def update_summaries(self, summaries):
     content = "\n".join(summaries)
     formatted = utils.replace_argument(
         self.options, '$WORKSPACE/probing/formatted-all-$OUTPUT.txt')
     utils.just_write(formatted, content)
     summary.push_with_file(self.options, formatted)