if max_target_byte != 0 and (max_target_byte < len(target_log)): utility.print_message( WARNING, 'Cutting response byte {} to {}.'.format( len(target_log), max_target_byte)) target_log = target_log[:max_target_byte] # 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',
date[:-3], '%Y%m%d%H%M%S')) msg = '{}/{}-{}/{} Checking : Log: {}'.format( log_idx + 1, len(log_list), log_idx2 + 1, len(target_logs), 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',
date = utility.get_current_date('%Y%m%d%H%M%S%f')[:-3] print_date = utility.transform_date_string( utility.transform_date_object(date[:-3], '%Y%m%d%H%M%S')) msg = '{}/{}-{}/{} Checking : Log: {}'.format(log_idx + 1, len(log_list), log_idx2 + 1, len(target_logs), 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')
msg = '{}/{} Checking : Log: {}'.format(log_idx + 1, len(log_list), path) utility.print_message(OK, msg) utility.write_log(20, msg) # Cutting response byte. if max_target_byte != 0 and (max_target_byte < len(target_log)): utility.print_message(WARNING, 'Cutting response byte {} to {}.' .format(len(target_log), max_target_byte)) target_log = target_log[:max_target_byte] # 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_checker.get_bad_comment(target_log) # Check unnecessary error messages. errors = error_checker.get_error_message(target_log) # Create report. report.create_report_body('-', fqdn_list[idx], port_list[idx], cloud_type,