Example #1
0
def process_diff_product_names(args, left_rules, right_rules):
    data = rds.walk_rules_diff(args, left_rules, right_rules,
                               rds.product_names_oval,
                               rds.product_names_remediation)
    result = rds.walk_rules_diff_stats(data)
    left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result

    if not args.right_only:
        print_specifics(args, "Product Names Objects Specifics - Left Only:",
                        left_only_data[5], '<')
        print_specifics(args,
                        "Product Names Objects Specifics - Left Changed:",
                        left_changed_data[5], '<')

    if args.show_common:
        print_specifics(args, "Product Names Objects Specifics - Common:",
                        common_data[5], '=')

    if not args.left_only:
        print_specifics(args,
                        "Product Names Objects Specifics - Right Changed:",
                        right_changed_data[5], '>')
        print_specifics(args, "Product Names Objects Specifics - Right Only:",
                        right_only_data[5], '>')

    data_indices = [0, 1, 2, 4]
    statements = [
        "Product Names Objects Summary:", "Total affected rules: %d",
        "Rules with differing products and OVAL names: %d / %d",
        "Rules with differing product and remediation names: %d / %d",
        "Rules with differing product and %s remediation names: %d / %d"
    ]

    if not args.right_only:
        statements[0] = "Product Names Objects Summary - Left Only:"
        l_d = select_indices(left_only_data, data_indices)
        print_summary(args, statements, l_d, '<')

        statements[0] = "Product Names Objects Summary - Left Changed:"
        l_d = select_indices(left_changed_data, data_indices)
        print_summary(args, statements, l_d, '<')

    if args.show_common:
        statements[0] = "Product Names Objects Summary - Common:"
        c_d = select_indices(common_data, data_indices)
        print_summary(args, statements, c_d, '=')

    if not args.left_only:
        statements[0] = "Product Names Objects Summary - Right Changed:"
        r_d = select_indices(right_changed_data, data_indices)
        print_summary(args, statements, r_d, '>')

        statements[0] = "Product Names Objects Summary - Right Only:"
        r_d = select_indices(right_only_data, data_indices)
        print_summary(args, statements, r_d, '>')
Example #2
0
def process_diff_two_plus(args, left_rules, right_rules):
    data = rds.walk_rules_diff(args, left_rules, right_rules,
                               rds.two_plus_oval, rds.two_plus_remediation)
    result = rds.walk_rules_diff_stats(data)
    left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result

    statements = [
        "Two Plus Objects Summary:", "Total affected rules: %d",
        "Rules with two or more OVALs: %d / %d",
        "Rules with two or more remediations: %d / %d",
        "Rules with two or more %s remediations: %d / %d"
    ]

    if not args.right_only:
        print_specifics(args, "Two Plus Objects Specifics - Left Only:",
                        left_only_data[5], '<')
        print_specifics(args, "Two Plus Objects Specifics - Left Changed:",
                        left_changed_data[5], '<')

    if args.show_common:
        print_specifics(args, "Two Plus Objects Specifics - Common:",
                        common_data[5], '=')

    if not args.left_only:
        print_specifics(args, "Two Plus Objects Specifics - Right Changed:",
                        right_changed_data[5], '>')
        print_specifics(args, "Two Plus Objects Specifics - Right Only:",
                        right_only_data[5], '>')

    data_indices = [0, 1, 2, 4]

    if not args.right_only:
        statements[0] = "Two Plus Objects Summary - Left Only:"
        l_d = select_indices(left_only_data, data_indices)
        print_summary(args, statements, l_d, '<')

        statements[0] = "Two Plus Objects Summary - Left Changed:"
        l_d = select_indices(left_changed_data, data_indices)
        print_summary(args, statements, l_d, '<')

    if args.show_common:
        statements[0] = "Two Plus Objects Summary - Common:"
        c_d = select_indices(common_data, data_indices)
        print_summary(args, statements, c_d, '=')

    if not args.left_only:
        statements[0] = "Two Plus Objects Summary - Right Changed:"
        r_d = select_indices(right_changed_data, data_indices)
        print_summary(args, statements, r_d, '>')

        statements[0] = "Two Plus Objects Summary - Right Only:"
        r_d = select_indices(right_only_data, data_indices)
        print_summary(args, statements, r_d, '>')
def process_diff_missing(args, left_rules, right_rules):
    data = rds.walk_rules_diff(args, left_rules, right_rules, rds.missing_oval, rds.missing_remediation)
    result = rds.walk_rules_diff_stats(data)
    left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result

    statements = ["Missing Objects Summary",
                  "Total affected rules: %d",
                  "Rules with no OVALs: %d / %d",
                  "Rules without any remediations: %d / %d",
                  "Rules with no %s remediations: %d / %d"]

    if not args.right_only:
        print_specifics(args, "Missing Objects Specifics - Left Only:", left_only_data[5], '<')
        print_specifics(args, "Missing Objects Specifics - Left Changed:", left_changed_data[5], '<')

    if args.show_common:
        print_specifics(args, "Missing Objects Specifics - Common:", common_data[5], '=')

    if not args.left_only:
        print_specifics(args, "Missing Objects Specifics - Right Changed:", right_changed_data[5], '>')
        print_specifics(args, "Missing Objects Specifics - Right Only:", right_only_data[5], '>')

    data_indices = [0, 1, 3, 4]

    if not args.right_only:
        statements[0] = "Missing Objects Summary - Left Only:"
        l_d = select_indices(left_only_data, data_indices)
        print_summary(args, statements, l_d, '<')

        statements[0] = "Missing Objects Summary - Left Changed:"
        l_d = select_indices(left_changed_data, data_indices)
        print_summary(args, statements, l_d, '<')

    if args.show_common:
        statements[0] = "Missing Objects Summary - Common:"
        c_d = select_indices(common_data, data_indices)
        print_summary(args, statements, c_d, '=')

    if not args.left_only:
        statements[0] = "Missing Objects Summary - Right Changed:"
        r_d = select_indices(right_changed_data, data_indices)
        print_summary(args, statements, r_d, '>')

        statements[0] = "Missing Objects Summary - Right Only:"
        r_d = select_indices(right_only_data, data_indices)
        print_summary(args, statements, r_d, '>')
def process_diff_product_names(args, left_rules, right_rules):
    data = rds.walk_rules_diff(args, left_rules, right_rules, rds.product_names_oval, rds.product_names_remediation)
    result = rds.walk_rules_diff_stats(data)
    left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result

    if not args.right_only:
        print_specifics(args, "Product Names Objects Specifics - Left Only:", left_only_data[5], '<')
        print_specifics(args, "Product Names Objects Specifics - Left Changed:", left_changed_data[5], '<')

    if args.show_common:
        print_specifics(args, "Product Names Objects Specifics - Common:", common_data[5], '=')

    if not args.left_only:
        print_specifics(args, "Product Names Objects Specifics - Right Changed:", right_changed_data[5], '>')
        print_specifics(args, "Product Names Objects Specifics - Right Only:", right_only_data[5], '>')

    data_indices = [0, 1, 2, 4]
    statements = ["Product Names Objects Summary:",
                  "Total affected rules: %d",
                  "Rules with differing products and OVAL names: %d / %d",
                  "Rules with differing product and remediation names: %d / %d",
                  "Rules with differing product and %s remediation names: %d / %d"]

    if not args.right_only:
        statements[0] = "Product Names Objects Summary - Left Only:"
        l_d = select_indices(left_only_data, data_indices)
        print_summary(args, statements, l_d, '<')

        statements[0] = "Product Names Objects Summary - Left Changed:"
        l_d = select_indices(left_changed_data, data_indices)
        print_summary(args, statements, l_d, '<')

    if args.show_common:
        statements[0] = "Product Names Objects Summary - Common:"
        c_d = select_indices(common_data, data_indices)
        print_summary(args, statements, c_d, '=')

    if not args.left_only:
        statements[0] = "Product Names Objects Summary - Right Changed:"
        r_d = select_indices(right_changed_data, data_indices)
        print_summary(args, statements, r_d, '>')

        statements[0] = "Product Names Objects Summary - Right Only:"
        r_d = select_indices(right_only_data, data_indices)
        print_summary(args, statements, r_d, '>')