Exemple #1
0
                            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_list = comment_checker.get_bad_comment(
                                target_log)
Exemple #2
0
                        # Analyze gathered logs.
                        for target_item in target_logs:
                            target_id = target_item[0]
                            for log_idx2, target_log in enumerate(target_item[1]):
                                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)