T06 · System Persistence
- Location
assets/daily_report.py:588- Finding
Persistent Daily Execution Through LaunchAgent or Crontab
- Content
View full analysis
Label {PLIST_LABEL} ProgramArguments /usr/bin/python3 {script_path} --no-open StartCalendarInterval Hour 9 Minute 0 RunAtLoad ''' plist_path.write_text(plist_content, encoding="utf-8") try: subprocess.run( ["launchctl", "load", str(plist_path)], check=True, capture_output=True ) return True except subprocess.CalledProcessError as e: return False else: script_path = os.path.abspath(__file__) cron_line = f"0 9 * * * /usr/bin/python3 {script_path} --no-open" try: subprocess.run( f'(crontab -l 2>/dev/null; echo "{cron_line}") | crontab -', shell=True, check=True, capture_output=True ) return True except subprocess.CalledProcessError: return False ``` ### Technical Analysis The `--subscribe` option installs a user LaunchAgent on macOS or modifies the user's crontab ...[truncated 1511 chars]- Remediation
View remediation
