13 lines
1000 B
Python
13 lines
1000 B
Python
import json,socket,pathlib,datetime
|
|
out=pathlib.Path('outputs/investmoz-audit-current-20261012')
|
|
x={'at':datetime.datetime.now(datetime.timezone.utc).isoformat(),'cua_getState_result':{'apps':[],'browsers':[]},'visual_control_available':False,'previous_native_pipe_failure':'os error 2','API_HTTP_testing_available':True}
|
|
(out/'browser-availability.json').write_text(json.dumps(x,indent=2),encoding='utf-8')
|
|
p={'at':x['at'],'operation':'read_only scanner protocol','active_scans_or_jobs_consumed':0,'endpoint':'127.0.0.1:3310'}
|
|
try:
|
|
for name,command in [('ping',b'nPING\n'),('version',b'nVERSION\n')]:
|
|
with socket.create_connection(('127.0.0.1',3310),timeout=5) as s:
|
|
s.sendall(command);p[name]=s.recv(1024).decode('ascii').strip('\x00\r\n')
|
|
p['result']='passed' if p['ping']=='PONG' else 'unexpected'
|
|
except Exception as e:p.update(result='stopped',error_type=type(e).__name__)
|
|
(out/'scanner-current-readonly.json').write_text(json.dumps(p,indent=2),encoding='utf-8');print(json.dumps(p))
|