Exemple #1
0
                                                                              path)
                                utility.print_message(OK, msg)
                                utility.write_log(20, msg)

                                # Check product name/version using signature.
                                product_list = version_checker.get_product_name(target_log)

                                # Check product name/version using Machine Learning.
                                if opt_ml:
                                    product_list.extend(version_checker_ml.get_product_name(target_log))

                                # Get CVE for products.
                                product_list = cve_explorer.cve_explorer(product_list)

                                # Check unnecessary comments.
                                comments, comment_list = comment_checker.get_bad_comment(target_log)

                                # Save all gotten comments to the local file.
                                boundary = '-' * 5 + '[' + path + ']' + '-' * 5 + '\n' + date + '\n'
                                comment_log_name = 'all_comments.log'
                                comment_log_path = os.path.join(opt_log_path, comment_log_name)
                                with codecs.open(comment_log_path, 'a', 'utf-8') as fout:
                                    fout.write(boundary)
                                    for comment in comment_list:
                                        fout.write(comment + '\n')

                                # Check unnecessary error messages.
                                errors = error_checker.get_error_message(target_log)

                                # Create report.
                                report.create_report_body(target_id,
Exemple #2
0
                            # Check product name/version using signature.
                            product_list = version_checker.get_product_name(
                                target_log)

                            # Check product name/version using Machine Learning.
                            if opt_ml:
                                product_list.extend(
                                    version_checker_ml.get_product_name(
                                        target_log))

                            # Get CVE for products.
                            product_list = cve_explorer.cve_explorer(
                                product_list)

                            # Check unnecessary comments.
                            comments, comment_list = comment_checker.get_bad_comment(
                                target_log)

                            # Save all gotten comments to the local file.
                            boundary = '-' * 5 + '[' + path + ']' + '-' * 5 + '\n' + date + '\n'
                            comment_log_name = 'all_comments.log'
                            comment_log_path = os.path.join(
                                opt_log_path, comment_log_name)
                            with codecs.open(comment_log_path, 'a',
                                             'utf-8') as fout:
                                fout.write(boundary)
                                for comment in comment_list:
                                    fout.write(comment + '\n')

                            # Check unnecessary error messages.
                            errors = error_checker.get_error_message(
                                target_log)
Exemple #3
0
                # Write log.
                log_name = protocol_list[idx] + '_' + fqdn_list[
                    idx] + '_' + str(port_list[idx]) + '_' + date + '.log'
                log_file = os.path.join(log_path, log_name)
                with codecs.open(log_file, 'w', 'utf-8') as fout:
                    fout.write(res_header + res_body)

                # Check product name/version.
                product_list = version_checker.get_product_name(res_header +
                                                                res_body)

                # Get CVE for products.
                product_list = cve_explorer.cve_explorer(product_list)

                # Check unnecessary comments.
                comments = comment_checker.get_bad_comment(res_body)

                # Check unnecessary error messages.
                errors = error_checker.get_error_message(res_body)

                # Check login page.
                page_type = page_checker.judge_page_type(target_url, res_body)

                # Create report.
                report.create_report_body(target_url, fqdn_list[idx],
                                          port_list[idx], cloud_type,
                                          method_crawl, product_list,
                                          page_type, comments, errors,
                                          server_header, log_file, print_date)

        # Check CMS using Google Hack and Explore contents.