T06 · System Persistence
- Location
scripts/install.mjs:92- Finding
Automatic Installation of Persistent OS-Level Scheduled Tasks
- Content
View full analysis
/dev/null || echo ""`, { encoding: 'utf-8', }); let nextCrontab = currentCrontab.trim(); let modified = false; if (!nextCrontab.includes(BACKUP_SCRIPT)) { nextCrontab += `\n# 双保险提醒系统 - 备用检查\n${backupCronLine}\n`; modified = true; } if (!nextCrontab.includes(DAILY_BRIEF_SCRIPT)) { nextCrontab += `\n# 双保险提醒系统 - 每日早报\n${dailyCronLine}\n`; modified = true; } if (!modified) { console.log('ℹ️ Linux crontab 已配置'); return; } execSync(`printf %s ${shellQuote(nextCrontab)} | ${crontabBin} -`, { stdio: 'ignore' }); console.log('✅ Linux crontab 已更新'); ``` On macOS, the generated backup LaunchAgent is configured to run at login and every 60 seconds: ```xml RunAtLoad StartInterval 60 ``` The installer then loads and enables both the backup worker and daily-briefing LaunchAgents: ```js try { execSync(`launchctl bootstrap gui/${uid} ${shellQuote(plistPath)}`, { stdio: 'ignore' }); execSync(`launchctl enable gui/${uid}/${SERVICE_LABEL}`, { stdio: 'ignore' }); execSync(`launchctl bootstrap gui/${uid} ${shellQuote(dailyPlistPath)}`, { stdio: 'ignore' }); execSync(`launchctl enable gui/${uid}/${DAILY_SERVICE_LABEL}`, { stdio: 'ignore' ...[truncated 3151 chars]- Remediation
View remediation
