360 Secure SkillHub
360 安全技能中心

Rr Reboot Report V2

面向安全监控的重启检测技能:通过 bash 脚本比对当前启动时间与状态文件中记录的时间,输出 CLEAN、REBOOTED 或 FIRST_RUN 状态,支持查看历史、重置状态与 JSON 输出;可选配置定时任务,在系统重启恢复网络后经 Telegram 发送告警。

elony-7
elony-7
热度 41.66
最近更新 2026-05-11 17:38:11
分类:安全依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / DevOps / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add rr-reboot-report-v2
Metadata
name
rr-reboot-report-v2
description
Detect unexpected system reboots and alert when the system comes back online. Tracks boot history and flags suspicious restarts.
metadata
{"openclaw":{"emoji":"🔄","requires":{"bins":["bash"],"files":["~/.rr-reboot-config"]}}}

RR Reboot Report

Detect unexpected reboots and track boot history. Useful for security monitoring — flags when a system restarts unexpectedly.

Quick Start

# Check for unexpected reboot (run at startup or on first heartbeat)
bash {baseDir}/scripts/check-reboot.sh

# View boot history
bash {baseDir}/scripts/check-reboot.sh --history

# Reset state (mark current boot as known)
bash {baseDir}/scripts/check-reboot.sh --reset

How It Works

  1. On first run, records current boot time to state file
  2. On subsequent runs, compares current boot time with last known
  3. If boot time changed unexpectedly → alerts
  4. State file: ~/.reboot-check-state (customizable with --state)

Output

STATUS: CLEAN       — No reboot since last check
STATUS: REBOOTED    — System rebooted since last check
STATUS: FIRST_RUN   — First time running, recording boot time

Integration

Auto-Alert via Cron (Recommended)

For automatic Telegram alerts on reboot without needing the agent active:

1. Create config file (one-time setup):

cat > ~/.rr-reboot-config << 'EOF'
BOT_TOKEN=your_bot_token_here
CHAT_ID=your_chat_id_here
EOF
chmod 600 ~/.rr-reboot-config

2. Add to crontab:

@reboot /path/to/scripts/reboot-alert.sh

The reboot-alert.sh helper script:

  • Detects reboots automatically
  • Reads credentials from ~/.rr-reboot-config (user-created, isolated config)
  • Sends alert via Telegram Bot API directly
  • Waits for network at boot
  • Resets state after alert

No credentials stored in the script or skill files. All user-provided.

Heartbeat Integration

# In heartbeat script
RESULT=$(bash check-reboot.sh)
[[ "$RESULT" == *"REBOOTED"* ]] && echo "ALERT: Unexpected reboot!"

Options

  • --state FILE — State file path (default: ~/.reboot-check-state)
  • --history — Show recorded boot history
  • --reset — Reset state to current boot
  • --json — Output as JSON