Initial BSI CSAF mirror
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
from sync import parse_index, validate_document
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--root', default='.')
|
||||
args = parser.parse_args()
|
||||
root = Path(args.root)
|
||||
state = json.loads((root / 'state/sync.json').read_text())
|
||||
selected = parse_index((root / 'data/index.txt').read_bytes(), state['since_year'])
|
||||
if selected != state['entries']:
|
||||
raise ValueError('Index and state disagree')
|
||||
for item in selected:
|
||||
p = root / 'data/csaf' / item
|
||||
if not p.is_file():
|
||||
raise ValueError(f'Missing CSAF document: {item}')
|
||||
validate_document(p.read_bytes(), item)
|
||||
print(f'Validated {len(selected)} CSAF documents')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user