|
@@ 195-240 (lines=46) @@
|
| 192 |
|
print_summary(args, statements, r_d, '>') |
| 193 |
|
|
| 194 |
|
|
| 195 |
|
def process_diff_prodtypes(args, left_rules, right_rules): |
| 196 |
|
data = rds.walk_rules_diff(args, left_rules, right_rules, rds.prodtypes_oval, rds.prodtypes_remediation) |
| 197 |
|
result = rds.walk_rules_diff_stats(data) |
| 198 |
|
left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result |
| 199 |
|
|
| 200 |
|
statements = ["Prodtypes Objects Summary", |
| 201 |
|
"Total affected rules: %d", |
| 202 |
|
"Rules with differing prodtypes between YAML and OVALs: %d / %d", |
| 203 |
|
"Rules with differing prodtypes between YAML and remediations: %d / %d", |
| 204 |
|
"Rules with differing prodtypes between YAML and %s remediations: %d / %d"] |
| 205 |
|
|
| 206 |
|
if not args.right_only: |
| 207 |
|
print_specifics(args, "Prodtypes Objects Specifics - Left Only:", left_only_data[5], '<') |
| 208 |
|
print_specifics(args, "Prodtypes Objects Specifics - Left Changed:", left_changed_data[5], '<') |
| 209 |
|
|
| 210 |
|
if args.show_common: |
| 211 |
|
print_specifics(args, "Prodtypes Objects Specifics - Common:", common_data[5], '=') |
| 212 |
|
|
| 213 |
|
if not args.left_only: |
| 214 |
|
print_specifics(args, "Prodtypes Objects Specifics - Right Changed:", right_changed_data[5], '>') |
| 215 |
|
print_specifics(args, "Prodtypes Objects Specifics - Right Only:", right_only_data[5], '>') |
| 216 |
|
|
| 217 |
|
data_indices = [0, 1, 2, 4] |
| 218 |
|
|
| 219 |
|
if not args.right_only: |
| 220 |
|
statements[0] = "Prodtypes Objects Summary - Left Only:" |
| 221 |
|
l_d = select_indices(left_only_data, data_indices) |
| 222 |
|
print_summary(args, statements, l_d, '<') |
| 223 |
|
|
| 224 |
|
statements[0] = "Prodtypes Objects Summary - Left Changed:" |
| 225 |
|
l_d = select_indices(left_changed_data, data_indices) |
| 226 |
|
print_summary(args, statements, l_d, '<') |
| 227 |
|
|
| 228 |
|
if args.show_common: |
| 229 |
|
statements[0] = "Prodtypes Objects Summary - Common:" |
| 230 |
|
c_d = select_indices(common_data, data_indices) |
| 231 |
|
print_summary(args, statements, c_d, '=') |
| 232 |
|
|
| 233 |
|
if not args.left_only: |
| 234 |
|
statements[0] = "Prodtypes Objects Summary - Right Changed:" |
| 235 |
|
r_d = select_indices(right_changed_data, data_indices) |
| 236 |
|
print_summary(args, statements, r_d, '>') |
| 237 |
|
|
| 238 |
|
statements[0] = "Prodtypes Objects Summary - Right Only:" |
| 239 |
|
r_d = select_indices(right_only_data, data_indices) |
| 240 |
|
print_summary(args, statements, r_d, '>') |
| 241 |
|
|
| 242 |
|
|
| 243 |
|
def process_diff_product_names(args, left_rules, right_rules): |
|
@@ 147-192 (lines=46) @@
|
| 144 |
|
print_summary(args, statements, r_d, '>') |
| 145 |
|
|
| 146 |
|
|
| 147 |
|
def process_diff_two_plus(args, left_rules, right_rules): |
| 148 |
|
data = rds.walk_rules_diff(args, left_rules, right_rules, rds.two_plus_oval, rds.two_plus_remediation) |
| 149 |
|
result = rds.walk_rules_diff_stats(data) |
| 150 |
|
left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result |
| 151 |
|
|
| 152 |
|
statements = ["Two Plus Objects Summary:", |
| 153 |
|
"Total affected rules: %d", |
| 154 |
|
"Rules with two or more OVALs: %d / %d", |
| 155 |
|
"Rules with two or more remediations: %d / %d", |
| 156 |
|
"Rules with two or more %s remediations: %d / %d"] |
| 157 |
|
|
| 158 |
|
if not args.right_only: |
| 159 |
|
print_specifics(args, "Two Plus Objects Specifics - Left Only:", left_only_data[5], '<') |
| 160 |
|
print_specifics(args, "Two Plus Objects Specifics - Left Changed:", left_changed_data[5], '<') |
| 161 |
|
|
| 162 |
|
if args.show_common: |
| 163 |
|
print_specifics(args, "Two Plus Objects Specifics - Common:", common_data[5], '=') |
| 164 |
|
|
| 165 |
|
if not args.left_only: |
| 166 |
|
print_specifics(args, "Two Plus Objects Specifics - Right Changed:", right_changed_data[5], '>') |
| 167 |
|
print_specifics(args, "Two Plus Objects Specifics - Right Only:", right_only_data[5], '>') |
| 168 |
|
|
| 169 |
|
data_indices = [0, 1, 2, 4] |
| 170 |
|
|
| 171 |
|
if not args.right_only: |
| 172 |
|
statements[0] = "Two Plus Objects Summary - Left Only:" |
| 173 |
|
l_d = select_indices(left_only_data, data_indices) |
| 174 |
|
print_summary(args, statements, l_d, '<') |
| 175 |
|
|
| 176 |
|
statements[0] = "Two Plus Objects Summary - Left Changed:" |
| 177 |
|
l_d = select_indices(left_changed_data, data_indices) |
| 178 |
|
print_summary(args, statements, l_d, '<') |
| 179 |
|
|
| 180 |
|
if args.show_common: |
| 181 |
|
statements[0] = "Two Plus Objects Summary - Common:" |
| 182 |
|
c_d = select_indices(common_data, data_indices) |
| 183 |
|
print_summary(args, statements, c_d, '=') |
| 184 |
|
|
| 185 |
|
if not args.left_only: |
| 186 |
|
statements[0] = "Two Plus Objects Summary - Right Changed:" |
| 187 |
|
r_d = select_indices(right_changed_data, data_indices) |
| 188 |
|
print_summary(args, statements, r_d, '>') |
| 189 |
|
|
| 190 |
|
statements[0] = "Two Plus Objects Summary - Right Only:" |
| 191 |
|
r_d = select_indices(right_only_data, data_indices) |
| 192 |
|
print_summary(args, statements, r_d, '>') |
| 193 |
|
|
| 194 |
|
|
| 195 |
|
def process_diff_prodtypes(args, left_rules, right_rules): |
|
@@ 99-144 (lines=46) @@
|
| 96 |
|
return [data[index] for index in indices] |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
def process_diff_missing(args, left_rules, right_rules): |
| 100 |
|
data = rds.walk_rules_diff(args, left_rules, right_rules, rds.missing_oval, rds.missing_remediation) |
| 101 |
|
result = rds.walk_rules_diff_stats(data) |
| 102 |
|
left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result |
| 103 |
|
|
| 104 |
|
statements = ["Missing Objects Summary", |
| 105 |
|
"Total affected rules: %d", |
| 106 |
|
"Rules with no OVALs: %d / %d", |
| 107 |
|
"Rules without any remediations: %d / %d", |
| 108 |
|
"Rules with no %s remediations: %d / %d"] |
| 109 |
|
|
| 110 |
|
if not args.right_only: |
| 111 |
|
print_specifics(args, "Missing Objects Specifics - Left Only:", left_only_data[5], '<') |
| 112 |
|
print_specifics(args, "Missing Objects Specifics - Left Changed:", left_changed_data[5], '<') |
| 113 |
|
|
| 114 |
|
if args.show_common: |
| 115 |
|
print_specifics(args, "Missing Objects Specifics - Common:", common_data[5], '=') |
| 116 |
|
|
| 117 |
|
if not args.left_only: |
| 118 |
|
print_specifics(args, "Missing Objects Specifics - Right Changed:", right_changed_data[5], '>') |
| 119 |
|
print_specifics(args, "Missing Objects Specifics - Right Only:", right_only_data[5], '>') |
| 120 |
|
|
| 121 |
|
data_indices = [0, 1, 3, 4] |
| 122 |
|
|
| 123 |
|
if not args.right_only: |
| 124 |
|
statements[0] = "Missing Objects Summary - Left Only:" |
| 125 |
|
l_d = select_indices(left_only_data, data_indices) |
| 126 |
|
print_summary(args, statements, l_d, '<') |
| 127 |
|
|
| 128 |
|
statements[0] = "Missing Objects Summary - Left Changed:" |
| 129 |
|
l_d = select_indices(left_changed_data, data_indices) |
| 130 |
|
print_summary(args, statements, l_d, '<') |
| 131 |
|
|
| 132 |
|
if args.show_common: |
| 133 |
|
statements[0] = "Missing Objects Summary - Common:" |
| 134 |
|
c_d = select_indices(common_data, data_indices) |
| 135 |
|
print_summary(args, statements, c_d, '=') |
| 136 |
|
|
| 137 |
|
if not args.left_only: |
| 138 |
|
statements[0] = "Missing Objects Summary - Right Changed:" |
| 139 |
|
r_d = select_indices(right_changed_data, data_indices) |
| 140 |
|
print_summary(args, statements, r_d, '>') |
| 141 |
|
|
| 142 |
|
statements[0] = "Missing Objects Summary - Right Only:" |
| 143 |
|
r_d = select_indices(right_only_data, data_indices) |
| 144 |
|
print_summary(args, statements, r_d, '>') |
| 145 |
|
|
| 146 |
|
|
| 147 |
|
def process_diff_two_plus(args, left_rules, right_rules): |
|
@@ 243-287 (lines=45) @@
|
| 240 |
|
print_summary(args, statements, r_d, '>') |
| 241 |
|
|
| 242 |
|
|
| 243 |
|
def process_diff_product_names(args, left_rules, right_rules): |
| 244 |
|
data = rds.walk_rules_diff(args, left_rules, right_rules, rds.product_names_oval, rds.product_names_remediation) |
| 245 |
|
result = rds.walk_rules_diff_stats(data) |
| 246 |
|
left_only_data, right_only_data, left_changed_data, right_changed_data, common_data = result |
| 247 |
|
|
| 248 |
|
if not args.right_only: |
| 249 |
|
print_specifics(args, "Product Names Objects Specifics - Left Only:", left_only_data[5], '<') |
| 250 |
|
print_specifics(args, "Product Names Objects Specifics - Left Changed:", left_changed_data[5], '<') |
| 251 |
|
|
| 252 |
|
if args.show_common: |
| 253 |
|
print_specifics(args, "Product Names Objects Specifics - Common:", common_data[5], '=') |
| 254 |
|
|
| 255 |
|
if not args.left_only: |
| 256 |
|
print_specifics(args, "Product Names Objects Specifics - Right Changed:", right_changed_data[5], '>') |
| 257 |
|
print_specifics(args, "Product Names Objects Specifics - Right Only:", right_only_data[5], '>') |
| 258 |
|
|
| 259 |
|
data_indices = [0, 1, 2, 4] |
| 260 |
|
statements = ["Product Names Objects Summary:", |
| 261 |
|
"Total affected rules: %d", |
| 262 |
|
"Rules with differing products and OVAL names: %d / %d", |
| 263 |
|
"Rules with differing product and remediation names: %d / %d", |
| 264 |
|
"Rules with differing product and %s remediation names: %d / %d"] |
| 265 |
|
|
| 266 |
|
if not args.right_only: |
| 267 |
|
statements[0] = "Product Names Objects Summary - Left Only:" |
| 268 |
|
l_d = select_indices(left_only_data, data_indices) |
| 269 |
|
print_summary(args, statements, l_d, '<') |
| 270 |
|
|
| 271 |
|
statements[0] = "Product Names Objects Summary - Left Changed:" |
| 272 |
|
l_d = select_indices(left_changed_data, data_indices) |
| 273 |
|
print_summary(args, statements, l_d, '<') |
| 274 |
|
|
| 275 |
|
if args.show_common: |
| 276 |
|
statements[0] = "Product Names Objects Summary - Common:" |
| 277 |
|
c_d = select_indices(common_data, data_indices) |
| 278 |
|
print_summary(args, statements, c_d, '=') |
| 279 |
|
|
| 280 |
|
if not args.left_only: |
| 281 |
|
statements[0] = "Product Names Objects Summary - Right Changed:" |
| 282 |
|
r_d = select_indices(right_changed_data, data_indices) |
| 283 |
|
print_summary(args, statements, r_d, '>') |
| 284 |
|
|
| 285 |
|
statements[0] = "Product Names Objects Summary - Right Only:" |
| 286 |
|
r_d = select_indices(right_only_data, data_indices) |
| 287 |
|
print_summary(args, statements, r_d, '>') |
| 288 |
|
|
| 289 |
|
|
| 290 |
|
def main(): |