A full-featured, ESM-compatible IOC diffing and normalization library + CLI for InfoSec tooling.
added
, removed
, and changed
outputslevenshtein
)npm install @iocium/ioc-diff
import { diffIOCs, parsePlainIOCs } from '@iocium/ioc-diff';
const oldList = parsePlainIOCs(['malicious.com', '1.1.1.1']);
const newList = parsePlainIOCs(['malicious.com', '2.2.2.2']);
const result = diffIOCs(oldList, newList, {
matchBy: 'value+type',
compareTags: true,
fuzzyMatch: true,
fuzzyThreshold: 0.9
});
console.log(result.added); // IOCs in new but not old
console.log(result.removed); // IOCs in old but not new
console.log(result.changed); // Matching IOCs with tag/severity differences
ioc-diff --old old.csv --new new.csv --old-format csv --new-format csv
Flag | Description |
---|---|
--old |
Path to old IOC file |
--new |
Path to new IOC file |
--old-format |
Override format detection |
--new-format |
Override format detection |
--fuzzy |
Enable fuzzy matching |
--threshold |
Fuzzy similarity threshold (0โ1) |
plaintext
json
misp
csv
yara
sigma
ioc-diff --old iocs_old.txt --new iocs_new.txt
ioc-diff --old old.json --new new.csv --old-format json --new-format csv
ip
, domain
, url
, email
, sha256
, md5
)value+type
matchBy: 'value'
)tags
, severity
, source
DiffOptions
, IOC
, and IOCDiffResult
npm run build
npm test -- --coverage
MIT
PRs welcome! Please write tests and follow ESM-compatible conventions.