T06 · System Persistence
- Location
scripts/audit_wizard.py:122- Finding
Persistent Agent Cron Job Is Registered by Default
- Content
View full analysis
str: """注册 48h 健康检查 Cron Job,返回 Job ID""" if not CRON_JOBS.exists(): print(f' ⚠️ Cron Job 文件不存在:{CRON_JOBS},跳过注册') return '' with open(CRON_JOBS) as f: jobs_data = json.load(f) is_list = isinstance(jobs_data, list) jobs = jobs_data if is_list else jobs_data.get('jobs', list(jobs_data.values())) for job in jobs: if 'health' in job.get('name', '').lower() and 'monitor' in job.get('name', '').lower(): return job.get('id', '') job_id = str(uuid.uuid4()) skill_dir = str(SKILL_DIR) new_job = { "id": job_id, "name": "48h-health-monitor", "schedule": "0 2 */2 * *", "sessionKey": None, "status": "active", "payload": { "kind": "agentTurn", "model": model, "timeoutSeconds": 120, "prompt": ( f"执行系统健康检查:python3 {skill_dir}/scripts/health_monitor.py --report\n\n" "将输出结果通过 Telegram 发送给用户。若有问题,等待用户回复后按指令执行修复。\n" "修复命令格式:python3 {skill_dir}/scripts/health_monitor.py --fix <编号或 all>" ).replace('{skill_dir}', skill_dir) } } if is_list: jobs_data.append(new_job) else: jobs_data[job_id] = new_job with open(CRON_JOBS, 'w') as f: json.dump(jobs_data, f, indent=2, ensure_ascii=False) return job_id ``` ```python if ask_yn('\n是否注册 48h 定期健康检查 Cron Job', default=True): model = ask(' 使用模型', DEFAULT_CHEAP_MODEL) register_cron_job(model) ``` ### Technical Analysis The installation wizard directly modifies `~/.openclaw/cron/jobs.json` to add an active `agentTu ...[truncated 1368 chars]- Remediation
View remediation
