AGENT SKILL

threat-scope

OpenClaw skill for ThreatScope — fetches CVE feeds from NVD, GitHub Security Advisories, and the CISA Known Exploited Vulnerabilities (KEV) catalog, filters results to a user-defined stack profile, and returns a synthesized brief for the R1 device.

License 许可
MIT
最近更新
2026-09-04
Stars
★ 0
Forks
0

01 前言 Front Matter

name
threat-scope
author
rabbit-r1-skillz
version
1.0.0
description
OpenClaw skill for ThreatScope — fetches CVE feeds from NVD, GitHub Security Advisories, and the CISA Known Exploited Vulnerabilities (KEV) catalog, filters results to a user-defined stack profile, and returns a synthesized brief for the R1 device.

02 资源文件 3

03 SKILL.md 正文

ThreatScope — Local Skill Setup

ThreatScope uses the OpenClaw bridge to reach external security feeds from your local machine. The R1 device sends a fetch command; this skill queries live APIs, filters to your stack, and returns structured CVE data.


What the skill does

  1. Receives a fetch-brief command with a stack array (technology IDs).
  2. Queries three sources in parallel:
    • NVD CVE API — https://services.nvd.nist.gov/rest/json/cves/2.0
    • GitHub Security Advisories — https://api.github.com/advisories
    • CISA KEV catalog — https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json
  3. Filters results to CVEs that reference any technology in the stack list.
  4. Returns a structured array of CVE objects to the R1.

Prerequisites

Requirement Notes
Node.js 20+ node --version to verify
OpenClaw daemon Install from the RabbitOS developer portal; must be running
NVD API key (optional) Free at https://nvd.nist.gov/developers/request-an-api-key — increases rate limit from 5 req/30s to 50 req/30s
Internet access Machine must reach nvd.nist.gov, api.github.com, and cisa.gov

Installation

# From the rabbit-r1-skillz project root
cd threat-scope
npm install   # installs node-fetch and openclaw-sdk

If there is no package.json yet, create one:

npm init -y
npm install node-fetch@3 openclaw-sdk

Skill file: skill.mjs

Create threat-scope/skill.mjs with the following content:

import { OpenClaw } from 'openclaw-sdk';
import fetch from 'node-fetch';

const NVD_API_KEY = process.env.NVD_API_KEY || '';
const CACHE_TTL_MS = 6 * 60 * 60 * 1000;   // 6 hours

// Component keyword map — expand to match your stack
const COMPONENT_KEYWORDS = {
  nodejs:        ['node.js', 'nodejs', 'node js', 'npm'],
  react:         ['react', 'reactjs', 'react.js', 'create-react-app'],
  nextjs:        ['next.js', 'nextjs', 'vercel/next'],
  typescript:    ['typescript', 'ts-node'],
  postgresql:    ['postgresql', 'postgres', 'libpq', 'pg_'],
  redis:         ['redis', 'valkey'],
  mongodb:       ['mongodb', 'mongo', 'mongoose'],
  docker:        ['docker', 'moby', 'containerd', 'runc'],
  kubernetes:    ['kubernetes', 'k8s', 'kubectl', 'kubelet', 'kube-apiserver'],
  nginx:         ['nginx'],
  aws:           ['amazon web services', 'aws-sdk', 'boto3', 's3', 'ec2', 'lambda'],
  gcp:           ['google cloud', 'gcp', 'gke', 'cloud run'],
  azure:         ['azure', 'microsoft azure', 'az cli'],
  stripe:        ['stripe'],
  linux:         ['linux kernel', 'linux', 'glibc', 'systemd'],
  openssl:       ['openssl', 'libssl'],
  python:        ['python', 'cpython', 'pip'],
  django:        ['django'],
  express:       ['expressjs', 'express.js', 'express'],
  graphql:       ['graphql', 'apollo-server'],
  elasticsearch: ['elasticsearch', 'opensearch', 'elastic'],
  rabbitmq:      ['rabbitmq', 'erlang amqp'],
  terraform:     ['terraform', 'hashicorp/terraform'],
  github:        ['github actions', 'actions/runner', 'gh-actions'],
};

let cache = null;

const oc = new OpenClaw({ skillName: 'threat-scope' });

oc.on('fetch-brief', async (payload, respond) => {
  const stack = payload.stack || [];

  // Return cached result if fresh
  if (cache && (Date.now() - cache.ts) < CACHE_TTL_MS) {
    const filtered = filterToStack(cache.cves, stack);
    respond({ cves: filtered, sources: cache.sources, kevCount: filtered.filter(c => c.isKEV).length });
    return;
  }

  try {
    const [nvdCVEs, ghAdvisories, kevList] = await Promise.allSettled([
      fetchNVD(),
      fetchGitHubAdvisories(),
      fetchCISAKEV(),
    ]);

    const allCVEs = [];
    const sources = [];

    if (nvdCVEs.status === 'fulfilled') {
      allCVEs.push(...nvdCVEs.value);
      sources.push('NVD');
    }
    if (ghAdvisories.status === 'fulfilled') {
      mergeCVEs(allCVEs, ghAdvisories.value, 'GitHub');
      sources.push('GitHub');
    }

    let kevIds = new Set();
    if (kevList.status === 'fulfilled') {
      kevIds = new Set(kevList.value.map(k => k.cveID));
      sources.push('CISA');
    }

    // Mark KEV status
    allCVEs.forEach(cve => { cve.isKEV = kevIds.has(cve.id); });

    cache = { ts: Date.now(), cves: allCVEs, sources };

    const filtered = filterToStack(allCVEs, stack);
    respond({ cves: filtered, sources, kevCount: filtered.filter(c => c.isKEV).length });

  } catch (err) {
    respond({ error: err.message });
  }
});

/* ── NVD fetch ────────────────────────────────────────────── */
async function fetchNVD() {
  const params = new URLSearchParams({
    resultsPerPage: 200,
    pubStartDate: isoDateDaysAgo(30),
    pubEndDate: new Date().toISOString().slice(0, 19) + '.000',
  });
  const headers = { 'User-Agent': 'threat-scope/1.0' };
  if (NVD_API_KEY) headers['apiKey'] = NVD_API_KEY;

  const res = await fetch('https://services.nvd.nist.gov/rest/json/cves/2.0?' + params, { headers });
  if (!res.ok) throw new Error('NVD returned ' + res.status);
  const data = await res.json();

  return (data.vulnerabilities || []).map(v => {
    const cve    = v.cve;
    const desc   = (cve.descriptions || []).find(d => d.lang === 'en');
    const cvssV3 = cve.metrics && (cve.metrics.cvssMetricV31 || cve.metrics.cvssMetricV30);
    const cvssScore = cvssV3 && cvssV3[0] ? cvssV3[0].cvssData.baseScore : null;
    const sevChar = cvssScore !== null
      ? (cvssScore >= 9.0 ? 'C' : cvssScore >= 7.0 ? 'H' : cvssScore >= 4.0 ? 'M' : 'L')
      : 'M';

    const patches = (cve.references || []).filter(r =>
      r.tags && (r.tags.includes('Patch') || r.tags.includes('Vendor Advisory'))
    );

    return {
      id:           cve.id,
      description:  desc ? desc.value : '',
      severity:     sevChar,
      cvss:         cvssScore,
      cvssVector:   cvssV3 && cvssV3[0] ? cvssV3[0].cvssData.vectorString : null,
      patchAvailable: patches.length > 0,
      patchVersion: null,
      component:    inferComponent(desc ? desc.value : '', cve.id),
      source:       'NVD',
      publishedDate: cve.published,
      isKEV:        false,
    };
  });
}

/* ── GitHub Advisory fetch ────────────────────────────────── */
async function fetchGitHubAdvisories() {
  const res = await fetch(
    'https://api.github.com/advisories?per_page=100&type=reviewed&sort=updated',
    {
      headers: {
        'Accept': 'application/vnd.github+json',
        'User-Agent': 'threat-scope/1.0',
        'X-GitHub-Api-Version': '2022-11-28',
      },
    }
  );
  if (!res.ok) throw new Error('GitHub returned ' + res.status);
  const data = await res.json();

  return data
    .filter(a => a.cve_id)
    .map(a => {
      const sevChar = mapGHSeverity(a.severity);
      return {
        id:            a.cve_id,
        description:   a.summary || a.description || '',
        severity:      sevChar,
        cvss:          a.cvss && a.cvss.score ? a.cvss.score : null,
        cvssVector:    a.cvss && a.cvss.vector_string ? a.cvss.vector_string : null,
        patchAvailable: !!(a.vulnerabilities && a.vulnerabilities.some(v => v.patched_versions)),
        patchVersion:  a.vulnerabilities && a.vulnerabilities[0]
          ? (a.vulnerabilities[0].patched_versions || [null])[0]
          : null,
        component:     a.package ? (a.package.name || a.package.ecosystem) : inferComponent(a.summary || '', a.cve_id),
        source:        'GitHub',
        publishedDate: a.published_at,
        isKEV:         false,
      };
    });
}

/* ── CISA KEV fetch ───────────────────────────────────────── */
async function fetchCISAKEV() {
  const res = await fetch(
    'https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json',
    { headers: { 'User-Agent': 'threat-scope/1.0' } }
  );
  if (!res.ok) throw new Error('CISA returned ' + res.status);
  const data = await res.json();
  return data.vulnerabilities || [];
}

/* ── Helpers ──────────────────────────────────────────────── */
function filterToStack(cves, stack) {
  if (!stack || stack.length === 0) return [];
  const keywords = stack.flatMap(id => COMPONENT_KEYWORDS[id] || [id.toLowerCase()]);
  return cves.filter(cve => {
    const text = ((cve.description || '') + ' ' + (cve.component || '')).toLowerCase();
    return keywords.some(kw => text.includes(kw));
  });
}

function inferComponent(description, cveId) {
  const text = description.toLowerCase();
  for (const [id, keywords] of Object.entries(COMPONENT_KEYWORDS)) {
    if (keywords.some(kw => text.includes(kw))) {
      // Return a clean display name
      const name = kw.charAt(0).toUpperCase() + kw.slice(1);
      return name;
    }
  }
  return cveId;
}

function mapGHSeverity(s) {
  const map = { critical: 'C', high: 'H', moderate: 'M', medium: 'M', low: 'L' };
  return map[(s || '').toLowerCase()] || 'M';
}

function mergeCVEs(target, incoming, source) {
  for (const cve of incoming) {
    const existing = target.find(c => c.id === cve.id);
    if (existing) {
      // Prefer GitHub data for patch version
      if (cve.patchVersion) existing.patchVersion = cve.patchVersion;
      if (cve.patchAvailable) existing.patchAvailable = true;
    } else {
      target.push(cve);
    }
  }
}

function isoDateDaysAgo(days) {
  const d = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
  return d.toISOString().slice(0, 19) + '.000';
}

console.log('[threat-scope] Skill running. Waiting for R1 commands…');
oc.listen();

Running the skill

node threat-scope/skill.mjs

Set your NVD API key for higher rate limits:

NVD_API_KEY=your-key-here node threat-scope/skill.mjs

Keep it running whenever you want ThreatScope to work on the R1. Use a process manager like pm2 or a systemd service to auto-start on boot:

# With pm2
npm install -g pm2
pm2 start threat-scope/skill.mjs --name threat-scope
pm2 save
pm2 startup

Environment variables

Variable Required Description
NVD_API_KEY No NVD API key for higher rate limits (recommended)
OPENCLAW_PORT No Override default OpenClaw port (default: per openclaw-sdk config)

Response schema

The skill returns the following JSON to the R1:

{
  "cves": [
    {
      "id": "CVE-2025-12345",
      "description": "A heap buffer overflow in Node.js…",
      "severity": "C",
      "cvss": 9.8,
      "cvssVector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "patchAvailable": true,
      "patchVersion": "22.14.1",
      "component": "Node.js",
      "source": "NVD",
      "publishedDate": "2025-06-01T00:00:00.000",
      "isKEV": false
    }
  ],
  "sources": ["NVD", "GitHub", "CISA"],
  "kevCount": 0
}

Severity values: C = Critical (CVSS 9.0–10.0), H = High (7.0–8.9), M = Medium (4.0–6.9), L = Low (0.1–3.9).


Privacy notes

  • No CVE data or stack profile is sent to any third party — all requests go directly from your local machine to the public NVD, GitHub, and CISA APIs.
  • The R1 device only receives filtered results; your full stack list never leaves your local machine unfiltered.
  • No authentication credentials are required for the public feeds.

Troubleshooting

Symptom Fix
"No response from threat-scope skill" Verify node skill.mjs is running; check OpenClaw daemon is active
Rate limited by NVD Add an NVD API key via NVD_API_KEY env var
No CVEs returned for your stack Expand the COMPONENT_KEYWORDS map with aliases matching your specific package names
CISA KEV fetch fails Check internet connectivity; CISA occasionally updates the URL — check https://www.cisa.gov/known-exploited-vulnerabilities-catalog for the latest feed URL

04 同仓库更多 Skills

ajohnsonnow
ajohnsonnow/r1-warren

whisper-quiz

WhisperQuiz — voice-answered trivia game for Rabbit R1. Generates questions via the R1's built-in LLM, captures spoken answers via STT, and evaluates correctness with flexible LLM-based matching.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

walk-cast

Walking podcast production skill. Receives raw audio metadata and transcript from the R1, removes long pauses, applies noise reduction and normalization, generates AI chapter titles and episode metadata via LLM, and uploads the final episode to your configured podcast RSS host (Spotify for Podcasters / Anchor, Podbean, Buzzsprout, RSS.com, or any FTP-accessible feed).

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-novel

Local machine skill for VoiceNovel — handles story export to disk.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-guide

Environment description and navigation assistant for blind and low-vision users. Analyzes camera frames via a vision LLM, reads visible text, identifies scene categories (people/vehicles/food/hazards/exits), performs 360° scans, retrieves GPS position, and sends emergency SMS alerts — all via audio feedback with zero screen dependency.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-draft

Voice-driven document drafting for the Rabbit R1. Dictate stream-of-consciousness speech; the R1 formats it into Email, Blog Post, Report, Proposal, Meeting Notes, Creative Writing, Code Comments, Cover Letter, or Tweet Thread — then saves the result to a configured folder on your local machine via OpenClaw.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-commit

Hands-free git and CI workflow voice controller for the Rabbit R1. Speak git/CI commands and hear results — commit, push, status, PR management, test runs, and deploy, all voice-driven via OpenClaw.

★ 0