Sentinel · security scanner
ioc-sentinel
Extract indicators of compromise from threat reports, logs, emails and binaries, then export them as CSV, STIX 2.1, JSON or SARIF.
npm i -D @mrlouiswright/ioc-sentinelPublished to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).
What it checks
- 16 IOC types
url,domain,ipv4,ipv6,email,md5,sha1,sha256,sha512,cve,attack,btc,eth,xmr,registry,filename(shortcuts:hash,ip,wallet). - Refanging
hxxp,hXXps,fxp,[.],(.),{.},[dot],\.,[:],[://],[@],(at). - Noise reductiondomains are checked against the gTLD/ccTLD list. Names ending in file extensions (
.exe,.py,.md,.zip...) count as file names unless the analyst defanged them. Private, loopback, CGNAT, documentation… - Watchlist(
-w known-bad.txt): one IOC per line, defanged values accepted, with an optional label after a space, tab or comma. Supports IPv4 CIDR ranges, parent domains (evil.comalso matchescdn.evil.comand URLs on it) and URL prefixes… - Inputsfiles, whole directories (skips
.gitandnode_modules), or stdin (-). Binary files are scanned via static string extraction. - Exports
--format csv|stix|listor--csv/--stix <file>, with--defangto make CSV/list output safe to paste. The STIX 2.1 bundle contains indicators with proper patterns ([file:hashes.'SHA-256' = '…'])…
Quick usage
CLI
npx ioc-sentinel report.pdf.txt # human-readable list, grouped by file
npx ioc-sentinel ./case-42/ --format csv --defang > iocs.csv
cat alert.eml | npx ioc-sentinel - -w known-bad.txt # exit 1 on a watchlist hit
npx ioc-sentinel logs/ --types url,domain,ip --stix iocs.stix.json --sarif iocs.sarif
API
import { extract, refang, defang, scan, formatStix } from 'ioc-sentinel';
extract('C2: hxxp://evil[.]com/gate 185.220.101[.]4');
// [{ type: 'url', value: 'http://evil.com/gate', defanged: true, line: 1, ... }, { type: 'domain', ... }, { type: 'ipv4', ... }]
const report = scan(['./incident'], { watchlist: 'evil.com\n185.220.101.0/24' });
report.iocs; // deduplicated, with counts and sources
formatStix(report); // STIX 2.1 bundle
Every option is documented in the ioc-sentinel docs.
CI / GitHub Action
permissions:
contents: read
security-events: write # only for the SARIF upload
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with: { persist-credentials: false }
- uses: MrLouisWright/ioc-sentinel@v1
with:
targets: 'reports/'
fail-on: critical
sarif: ioc-sentinel.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with: { sarif_file: ioc-sentinel.sarif }