from pathlib import Path from datetime import datetime,timezone from hashlib import sha256 import socket,json OUT=Path(__file__).resolve().parent;ROOT=OUT.parents[1] qa=ROOT/'storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742' conf=(qa/'antivirus-qa/clamd.conf').read_text(encoding='utf-8-sig') assert 'TCPSocket 13310'in conf and 'TCPAddr 127.0.0.1'in conf and 'portal-stability-source-20261011_083742/antivirus-qa/database'in conf def command(port,cmd): with socket.create_connection(('127.0.0.1',port),timeout=10)as s: s.sendall(('z'+cmd+'\0').encode());return s.recv(4096).decode().strip('\x00\r\n') before=command(13310,'VERSION');assert 'ClamAV 1.5.4/28150/'in before reply=command(13310,'RELOAD');assert reply=='RELOADING' proof={'at':datetime.now(timezone.utc).isoformat(),'QA_endpoint':'127.0.0.1:13310','version_before':before, 'reply':reply,'QA_config_sha256':sha256((qa/'antivirus-qa/clamd.conf').read_bytes()).hexdigest(), 'database_updated_only_under_QA':True,'active_services_changed':False,'active_writes':0} p=OUT/'option-B3-scanner-reload.json';assert not p.exists();p.write_text(json.dumps(proof,indent=2)+'\n',encoding='utf-8');print(json.dumps(proof))