Skip to content

Indicators of compromise

Pull indicators of compromise out of threat reports and defang or refang them safely

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/ioc/index.md to help me query Indicators of compromise with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Extract every distinct indicator from a defanged report as (type, value) rows.

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value
Result
type value
ipv4 10.0.0.5
url http://evil.com

Quick start

Choose where to run Indicators of compromise, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'ioc' AS ioc (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-ioc'
);

3. Run a query

query.sql
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'ioc' AS ioc (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Defensive CTI tooling: extract and defang/refang indicators of compromise (IOCs) from free text.

Catalog

Everything ioc exposes once attached — read straight from the worker's released build.

ioc 1 schema
main 1 view · 12 functions

IOC extraction and defang/refang functions for cyber-threat intelligence.

Schema examples (9)
Examples (9)

Extract every distinct indicator from a defanged report as (type, value) rows.

SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value;
Result
type value
ipv4 10.0.0.5
url http://evil.com

Count the indicators in a report, grouped by type.

SELECT type, count(*) AS n
FROM ioc.main.extract_iocs('c2 hxxp://evil[.]com from 10[.]0[.]0[.]5 and bad[at]evil[.]com')
GROUP BY type
ORDER BY type;

Defang a live URL so it is safe to paste into a report.

SELECT ioc.main.defang('http://evil.com/x') AS safe;

Pull the defanged IPv4 addresses out of a report, one per row.

SELECT UNNEST(ioc.main.extract_ipv4('beacon from 10[.]0[.]0[.]5')) AS ip;
5 more examples

Classify a hex digest by algorithm.

SELECT ioc.main.hash_type('d41d8cd98f00b204e9800998ecf8427e') AS algorithm;

Label every indicator pulled from a defanged report with its coarse group (network, email, hash, vulnerability) and the single-type extractor for it, by joining extract_iocs to the ioc_types registry.

SELECT t.kind, i.type, i.value, t.extractor
FROM ioc.main.extract_iocs('dropper hxxps://cdn[.]evil[.]com/a.exe (sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) beacons to 203[.]0[.]113[.]7, exploits CVE-2021-44228, phish from ops[at]evil[.]com') AS i
JOIN ioc.main.ioc_types AS t ON t.name = i.type
ORDER BY t.kind, i.type, i.value;

Turn a live incident note into a safe-to-share watchlist: extract every indicator with extract_iocs, then defang each value so none of them is clickable.

SELECT i.type, ioc.main.defang(i.value) AS shareable
FROM ioc.main.extract_iocs('beacon to http://evil.com/gate.php from 10.0.0.5, contact [email protected]') AS i
ORDER BY i.type, shareable;

For each alert in a table, list the file hashes it mentions with their algorithm: unnest extract_hashes over the alert text and label each hash with hash_type (alerts without hashes produce no rows).

WITH alerts(id, body) AS (VALUES (1, 'dropped d41d8cd98f00b204e9800998ecf8427e and da39a3ee5e6b4b0d3255bfef95601890afd80709'), (2, 'user reset password'), (3, 'payload e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')) SELECT a.id, h.hash, ioc.main.hash_type(h.hash) AS algorithm
FROM alerts AS a,
     UNNEST(ioc.main.extract_hashes(a.body)) AS h(hash)
ORDER BY a.id, algorithm;

Triage a ticket queue: keep only tickets whose text contains any indicator (is_ioc), then count the IPv4 addresses, URLs and CVEs each one mentions.

WITH tickets(id, body) AS (VALUES (1, 'beacon to hxxp://evil[.]com/x from 10[.]0[.]0[.]5'), (2, 'password reset for jsmith'), (3, 'exploiting CVE-2024-1234 via 10[.]0[.]0[.]5 and 10[.]0[.]0[.]9'), (4, 'printer offline on floor 3')) SELECT id, len(ioc.main.extract_ipv4(body)) AS n_ips, len(ioc.main.extract_urls(body)) AS n_urls, len(ioc.main.extract_cves(body)) AS n_cves
FROM tickets
WHERE ioc.main.is_ioc(body)
ORDER BY id;
Views
ioc_types 3 examples5 cols

Registry of the indicator-of-compromise types this worker recognizes: for each type, the group it belongs to, the function that extracts it, a defanged example, and a one-line description.

Columns
name VARCHAR
The indicator type identifier (matches the `type` column emitted by extract_iocs).
kind VARCHAR
Coarse group the type belongs to: network, email, hash, or vulnerability.
extractor VARCHAR
Name of the scalar function that extracts this indicator type from text.
example VARCHAR
A short, defanged example value of this indicator type.
description VARCHAR
One-line notes on how this indicator type is matched.
Examples (3)

List the network-layer indicator types and the function that extracts each.

SELECT name, extractor
FROM ioc.main.ioc_types
WHERE kind = 'network'
ORDER BY name;

Count how many indicator types fall into each coarse group.

SELECT kind, count(*) AS n_types
FROM ioc.main.ioc_types
GROUP BY kind
ORDER BY kind;

Label every indicator pulled from a defanged report with its coarse group (network, email, hash, vulnerability) and the single-type extractor for it, by joining extract_iocs to the ioc_types registry.

SELECT t.kind, i.type, i.value, t.extractor
FROM ioc.main.extract_iocs('dropper hxxps://cdn[.]evil[.]com/a.exe (sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) beacons to 203[.]0[.]113[.]7, exploits CVE-2021-44228, phish from ops[at]evil[.]com') AS i
JOIN ioc.main.ioc_types AS t ON t.name = i.type
ORDER BY t.kind, i.type, i.value;
Link
Scalar functions
defang (text ANY) 2 examples

Defang indicators in text so they are safe to share (http->hxxp, .->[.], @->[at], ://->[://])

Arguments
text ANY
The free text to defang or refang; indicators inside it are rewritten in place
ReturnsVARCHAR
Examples (2)

Defang a live URL so it is safe to paste into a report (returns 'hxxp[://]evil[.]com/x').

SELECT ioc.main.defang('http://evil.com/x');

Turn a live incident note into a safe-to-share watchlist: extract every indicator with extract_iocs, then defang each value so none of them is clickable.

SELECT i.type, ioc.main.defang(i.value) AS shareable
FROM ioc.main.extract_iocs('beacon to http://evil.com/gate.php from 10.0.0.5, contact [email protected]') AS i
ORDER BY i.type, shareable;
Link
extract_cves (text ANY) 1 example

Extract CVE identifiers (refangs first) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Example

Pull a CVE identifier out of a report (returns 'CVE-2024-1234').

SELECT UNNEST(ioc.main.extract_cves('exploiting CVE-2024-1234 in the wild'));
Link
extract_domains (text ANY) 1 example

Extract bare domains (refangs first; URL/e-mail hosts excluded) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Example

Pull a bare defanged domain out of a report (returns 'evil.example.com').

SELECT UNNEST(ioc.main.extract_domains('callback to evil[.]example[.]com'));
Link
extract_emails (text ANY) 1 example

Extract e-mail addresses (refangs first) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Example

Pull a defanged e-mail address out of a report (returns '[email protected]').

SELECT UNNEST(ioc.main.extract_emails('phish from bad[at]evil[.]com'));
Link
extract_hashes (text ANY) 2 examples

Extract md5/sha1/sha256/sha512 hashes (refangs first) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Examples (2)

Pull a file hash out of a report (returns 'd41d8cd98f00b204e9800998ecf8427e').

SELECT UNNEST(ioc.main.extract_hashes('sample md5 d41d8cd98f00b204e9800998ecf8427e'));

For each alert in a table, list the file hashes it mentions with their algorithm: unnest extract_hashes over the alert text and label each hash with hash_type (alerts without hashes produce no rows).

WITH alerts(id, body) AS (VALUES (1, 'dropped d41d8cd98f00b204e9800998ecf8427e and da39a3ee5e6b4b0d3255bfef95601890afd80709'), (2, 'user reset password'), (3, 'payload e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')) SELECT a.id, h.hash, ioc.main.hash_type(h.hash) AS algorithm
FROM alerts AS a,
     UNNEST(ioc.main.extract_hashes(a.body)) AS h(hash)
ORDER BY a.id, algorithm;
Link
extract_ipv4 (text ANY) 1 example

Extract IPv4 addresses (refangs first; private/reserved included) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Example

Pull the defanged IPv4 address out of a report (returns '10.0.0.5').

SELECT UNNEST(ioc.main.extract_ipv4('beacon from 10[.]0[.]0[.]5'));
Link
extract_ipv6 (text ANY) 1 example

Extract IPv6 addresses (refangs first; canonicalized) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Example

Pull an IPv6 address out of free text (returns '2001:db8::1').

SELECT UNNEST(ioc.main.extract_ipv6('C2 at 2001:db8::1 observed'));
Link
extract_urls (text ANY) 1 example

Extract URLs (refangs first) as VARCHAR[]

Arguments
text ANY
The free text to scan for indicators; it is refanged before matching so defanged forms are still found
ReturnsVARCHAR[]
Example

Pull a defanged URL out of a report (returns 'http://evil.com/x').

SELECT UNNEST(ioc.main.extract_urls('payload from hxxp://evil[.]com/x'));
Link
hash_type (s ANY) 2 examples

Classify a hex string as 'md5'|'sha1'|'sha256'|'sha512' by length, or NULL if it is not a recognized hash

Arguments
s ANY
The candidate hash to classify; its length determines the reported algorithm
ReturnsVARCHAR
Examples (2)

Classify a 32-character hex string as an MD5 hash (returns 'md5').

SELECT ioc.main.hash_type('d41d8cd98f00b204e9800998ecf8427e');

For each alert in a table, list the file hashes it mentions with their algorithm: unnest extract_hashes over the alert text and label each hash with hash_type (alerts without hashes produce no rows).

WITH alerts(id, body) AS (VALUES (1, 'dropped d41d8cd98f00b204e9800998ecf8427e and da39a3ee5e6b4b0d3255bfef95601890afd80709'), (2, 'user reset password'), (3, 'payload e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')) SELECT a.id, h.hash, ioc.main.hash_type(h.hash) AS algorithm
FROM alerts AS a,
     UNNEST(ioc.main.extract_hashes(a.body)) AS h(hash)
ORDER BY a.id, algorithm;
Link
is_ioc (text ANY) 2 examples

True if the text contains ANY recognizable IOC (refangs first)

Arguments
text ANY
The free text to test; it is refanged before checking so defanged indicators still count
ReturnsBOOLEAN
Examples (2)

Test whether free text contains any indicator of compromise (returns true).

SELECT ioc.main.is_ioc('beacon to 10[.]0[.]0[.]5');

Triage a ticket queue: keep only tickets whose text contains any indicator (is_ioc), then count the IPv4 addresses, URLs and CVEs each one mentions.

WITH tickets(id, body) AS (VALUES (1, 'beacon to hxxp://evil[.]com/x from 10[.]0[.]0[.]5'), (2, 'password reset for jsmith'), (3, 'exploiting CVE-2024-1234 via 10[.]0[.]0[.]5 and 10[.]0[.]0[.]9'), (4, 'printer offline on floor 3')) SELECT id, len(ioc.main.extract_ipv4(body)) AS n_ips, len(ioc.main.extract_urls(body)) AS n_urls, len(ioc.main.extract_cves(body)) AS n_cves
FROM tickets
WHERE ioc.main.is_ioc(body)
ORDER BY id;
Link
refang (text ANY) 1 example

Refang defanged indicators back to live form (hxxp->http, [.]->., [at]->@, [://]->://)

Arguments
text ANY
The free text to defang or refang; indicators inside it are rewritten in place
ReturnsVARCHAR
Example

Refang a defanged URL back to live form (returns 'http://evil.com').

SELECT ioc.main.refang('hxxp://evil[.]com');
Link
Table functions
extract_iocs (text VARCHAR) 5 examples

Extract every distinct IOC from text as (type, value) rows (refangs first; deduplicated)

Arguments
text VARCHAR
The bind-time-constant text to scan; it is refanged before matching and every distinct indicator becomes a (type, value) row
Returns columns
type VARCHAR
Indicator type: one of ipv4, ipv6, url, email, domain, md5, sha1, sha256, sha512, cve.
value VARCHAR
The refanged (live-form) indicator value.
Examples (5)

Extract every distinct indicator from a defanged report as (type, value) rows.

SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value;
Result
type value
ipv4 10.0.0.5
url http://evil.com

Count the distinct indicators found in a report, grouped by indicator type.

SELECT type, count(*) AS n
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5 and bad[at]evil[.]com')
GROUP BY type
ORDER BY type;

Keep only the network-layer indicators (IPs, domains, URLs) from a report.

SELECT value
FROM ioc.main.extract_iocs('c2 hxxp://evil[.]com from 10[.]0[.]0[.]5')
WHERE type IN ('ipv4', 'ipv6', 'url', 'domain')
ORDER BY value;
2 more examples

Label every indicator pulled from a defanged report with its coarse group (network, email, hash, vulnerability) and the single-type extractor for it, by joining extract_iocs to the ioc_types registry.

SELECT t.kind, i.type, i.value, t.extractor
FROM ioc.main.extract_iocs('dropper hxxps://cdn[.]evil[.]com/a.exe (sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) beacons to 203[.]0[.]113[.]7, exploits CVE-2021-44228, phish from ops[at]evil[.]com') AS i
JOIN ioc.main.ioc_types AS t ON t.name = i.type
ORDER BY t.kind, i.type, i.value;

Turn a live incident note into a safe-to-share watchlist: extract every indicator with extract_iocs, then defang each value so none of them is clickable.

SELECT i.type, ioc.main.defang(i.value) AS shareable
FROM ioc.main.extract_iocs('beacon to http://evil.com/gate.php from 10.0.0.5, contact [email protected]') AS i
ORDER BY i.type, shareable;
Link

Try these queries

Count the indicators in a report, grouped by type.

SELECT type, count(*) AS n
FROM ioc.main.extract_iocs('c2 hxxp://evil[.]com from 10[.]0[.]0[.]5 and bad[at]evil[.]com')
GROUP BY type
ORDER BY type

Uses extract_iocs

Defang a live URL so it is safe to paste into a report.

SELECT ioc.main.defang('http://evil.com/x') AS safe

Uses defang

Pull the defanged IPv4 addresses out of a report, one per row.

SELECT UNNEST(ioc.main.extract_ipv4('beacon from 10[.]0[.]0[.]5')) AS ip

Uses extract_ipv4

Classify a hex digest by algorithm.

SELECT ioc.main.hash_type('d41d8cd98f00b204e9800998ecf8427e') AS algorithm

Uses hash_type

List the network-layer indicator types and the function that extracts each.

SELECT name, extractor
FROM ioc.main.ioc_types
WHERE kind = 'network'
ORDER BY name

Uses ioc_types

Pull a defanged URL out of a report (returns 'http://evil.com/x').

SELECT UNNEST(ioc.main.extract_urls('payload from hxxp://evil[.]com/x'));

Uses extract_urls

17 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Return a single boolean value that is true when the text 'exploiting CVE-2024-1234 in the wild' contains any indicator of compromise, and false otherwise.
  • From the text 'C2 at 2001:db8::1 observed', return the IPv6 addresses, one address per row (a single column of scalar address strings, not a list).
  • From the defanged text 'payload from hxxp://evil[.]com/x', return the URLs in live (clickable) form, one URL per row.
  • From the defanged text 'callback to evil[.]example[.]com', return the bare domain names, one domain per row.
  • From the defanged text 'phish from bad[at]evil[.]com', return the e-mail addresses in live form, one address per row.
  • From the text 'exploiting CVE-2024-1234 in the wild', return the CVE identifiers, one per row.

Indicators of compromise is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.