-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcnssi_version_summary.py
More file actions
66 lines (54 loc) · 2.57 KB
/
Copy pathcnssi_version_summary.py
File metadata and controls
66 lines (54 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
"""
Generate a simple summary of CNSSI 1253 version changes for reporting.
"""
import json
def main():
# Load data
with open('merged_cnssi_1253.json', 'r') as f:
old_data = json.load(f)
with open('extracted_cnssi_1253_2022.json', 'r') as f:
new_data = json.load(f)
# Get selected controls
old_selected = set()
for control_id, control in old_data.items():
if control.get('selected', False):
old_selected.add(control_id)
new_selected = set()
for control_id, control in new_data.items():
if control.get('selected', False) and not control.get('withdrawn', False):
# Check if any CIA selections exist
if 'selections' in control:
for cia in ['confidentiality', 'integrity', 'availability']:
if any(control['selections'].get(cia, {}).get(level, False)
for level in ['low', 'moderate', 'high']):
new_selected.add(control_id)
break
# Calculate differences
deselected = sorted(old_selected - new_selected)
newly_selected = sorted(new_selected - old_selected)
# Write summary
with open('CNSSI_1253_version_change_summary.txt', 'w') as f:
f.write("CNSSI 1253 VERSION CHANGE SUMMARY\n")
f.write("=================================\n\n")
f.write("STATISTICS:\n")
f.write(f"- Old version (based on NIST 800-53 Rev 4): {len(old_selected)} selected controls\n")
f.write(f"- New version (based on NIST 800-53 Rev 5): {len(new_selected)} selected controls\n")
f.write(f"- Controls deselected: {len(deselected)}\n")
f.write(f"- Controls newly selected: {len(newly_selected)}\n")
f.write(f"- Net change: {len(new_selected) - len(old_selected):+d} controls\n")
f.write("\n\nCONTROLS DESELECTED IN NEW VERSION:\n")
f.write("------------------------------------\n")
for control_id in deselected:
# Check if withdrawn
if control_id in new_data and new_data[control_id].get('withdrawn', False):
f.write(f"{control_id} (withdrawn in Rev 5)\n")
else:
f.write(f"{control_id}\n")
f.write("\n\nCONTROLS NEWLY SELECTED IN NEW VERSION:\n")
f.write("----------------------------------------\n")
for control_id in newly_selected:
f.write(f"{control_id}\n")
print("Summary written to: CNSSI_1253_version_change_summary.txt")
if __name__ == "__main__":
main()