#8 Promenjen unos i snimanje kontrola
This commit is contained in:
24
fix-controls.py
Normal file
24
fix-controls.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import csv
|
||||
|
||||
input_file = 'controls.csv'
|
||||
output_file = 'controls-fix.csv'
|
||||
|
||||
with open(input_file, mode='r', newline='', encoding='utf-8') as infile:
|
||||
reader = csv.DictReader(infile)
|
||||
|
||||
safeguards = set()
|
||||
|
||||
for row in reader:
|
||||
safeguard = row['CIS v8.1 Safeguards (Sub-Controls)']
|
||||
safeguards.add(safeguard)
|
||||
|
||||
with open(output_file, mode='w', newline='', encoding='utf-8') as outfile:
|
||||
fieldnames = ['name']
|
||||
writer = csv.DictWriter(outfile, fieldnames=fieldnames)
|
||||
|
||||
writer.writeheader()
|
||||
|
||||
for safeguard in safeguards:
|
||||
writer.writerow({'name': safeguard})
|
||||
|
||||
print(f"Conversion completed. The new CSV file is saved as '{output_file}'.")
|
||||
Reference in New Issue
Block a user