# Threat intel

> Classify IPs, domains, URLs, and file hashes offline, then enrich them against threat-intel reputation feeds

This page includes setup, release pins, credentials, hosting and verification evidence. [JSON alternative](https://query.farm/products/orchard/api/v1/connectors/threatintel.json) contains the same setup facts for structured readers; choose one format.

## Runtime and release

Use DuckDB or Haybarn **2.0.1** with **VGI protocol 3.4**.
Catalog alias: `threatintel`. Release: [v0.5.0](https://github.com/Query-farm/vgi-threatintel/releases/tag/v0.5.0). Metadata generated: 2026-12-01T18:22:16+00:00.

## Choose where it runs

- On your machine: use an installation method below. No Query Farm account is required for local execution.
- Self-host: follow [the connector deployment instructions](https://github.com/Query-farm/vgi-threatintel) and [connection guide](https://query.farm/vgi/connect-to-a-worker/). Use your real endpoint and its authentication settings.
- Query Farm hosted: [create a deployment](https://auth.queryfarm.cloud/console/new?worker=threatintel). Hosting has a $10 monthly minimum per organization; usage and license fees may apply. Copy the deployment-specific ATTACH from the console.

## Service credentials and prerequisites

No service credentials are declared by this connector. Individual datasets, input files or deployments may have their own prerequisites.

Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute("CREATE SECRET stripe (TYPE stripe, api_key ?)", [os.environ["STRIPE_API_KEY"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.

## Install the extension

In stock DuckDB:

```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;
```

In Haybarn:

```sql
INSTALL vgi FROM community;
LOAD vgi;
```

## Attach the connector

The local recipes below pin the catalog release for repeatability. A public demo endpoint follows its deployed release.

### From GitHub

Attach the release directly

Uses the verified release each time you attach the connector.

```sql
ATTACH 'threatintel' AS threatintel (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-threatintel@v0.5.0'
);
```

### Docker

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

```sql
ATTACH 'threatintel' AS threatintel (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-threatintel:0.5.0'
);
```

## See what you can query

Service credentials required for this example: not declared by this example; check the connector requirements above.

```sql
WITH iocs(ioc) AS (
  VALUES ('185.220.101.1'), ('10.0.0.5'), ('malware-c2.example'),
         ('https://good.example/login'), ('44d88612fea8a8f36de82e1278abb02f'), ('not-an-indicator!!')
), typed AS (
  SELECT ioc,
         threatintel.main.indicator_type(ioc) AS kind,
         threatintel.main.is_private_ip(ioc) AS is_private
  FROM iocs
)
SELECT typed.ioc, typed.kind, t.description, typed.is_private,
       typed.kind IS NOT NULL AND NOT typed.is_private AS needs_lookup
FROM typed
LEFT JOIN threatintel.main.indicator_types AS t ON t.indicator_type = typed.kind
ORDER BY needs_lookup DESC, typed.ioc
```

- [threatintel.main.indicator_type — scalar_function](https://query.farm/products/orchard/connectors/threatintel/objects/scalar_function.bWFpbg.aW5kaWNhdG9yX3R5cGU.md): exact declaration for this example.
- [threatintel.main.is_private_ip — scalar_function](https://query.farm/products/orchard/connectors/threatintel/objects/scalar_function.bWFpbg.aXNfcHJpdmF0ZV9pcA.md): exact declaration for this example.
- [threatintel.main.indicator_types — view](https://query.farm/products/orchard/connectors/threatintel/objects/view.bWFpbg.aW5kaWNhdG9yX3R5cGVz.md): exact declaration for this example.

Execution evidence: **captured_result**.

```json
{
  "status": "captured_result",
  "capturedAt": "2026-12-01T06:21:29+00:00",
  "engineVersion": "2.0.1",
  "protocolVersion": "3.4.0",
  "releaseTag": "v0.5.0",
  "sample": {
    "columns": [
      "ioc",
      "kind",
      "description",
      "is_private",
      "needs_lookup"
    ],
    "types": [
      "VARCHAR",
      "VARCHAR",
      "VARCHAR",
      "BOOLEAN",
      "BOOLEAN"
    ],
    "rows": [
      [
        "185.220.101.1",
        "ipv4",
        "IPv4 address in dotted-quad notation",
        false,
        true
      ],
      [
        "44d88612fea8a8f36de82e1278abb02f",
        "md5",
        "MD5 file hash (32 hexadecimal characters)",
        false,
        true
      ],
      [
        "https://good.example/login",
        "url",
        "Absolute HTTP or HTTPS URL",
        false,
        true
      ],
      [
        "malware-c2.example",
        "domain",
        "DNS domain name (hostname)",
        false,
        true
      ],
      [
        "10.0.0.5",
        "ipv4",
        "IPv4 address in dotted-quad notation",
        true,
        false
      ]
    ],
    "more": true
  }
}
```

## Connector reference

### Threat Intelligence

**Enrich and classify cyber threat indicators — IPs, domains, URLs, and file hashes — against threat-intelligence reputation feeds directly in SQL.** This VGI worker turns DuckDB into a threat-hunting and indicator-of-compromise (IoC) triage engine: parse and type any indicator offline, screen out private/reserved IPs, then look up reputation verdicts (malicious flag, score, categories, source) from a pluggable feed — all without leaving your query.

It is built for SOC analysts, threat hunters, incident responders, and detection engineers who want to enrich and prioritize indicators in place rather than juggling separate enrichment scripts and spreadsheets. The worker is a **defensive** security tool intended for **authorized use only**, and it composes with sibling VGI workers such as `vgi-ioc`, `vgi-cve`, `vgi-yara`, and `vgi-sigma` to build a full SQL-native threat-intelligence stack.

Under the hood the worker is a standalone process that [DuckDB](https://duckdb.org) attaches over Apache Arrow via the [vgi-go SDK](https://github.com/Query-farm/vgi-go). It deliberately hard-codes no single feed: it speaks a simple **normalized reputation JSON** over `GET {base_url}?indicator=<value>`, so you point it at any adapter that maps a provider's response into that shape. Popular feeds plug in behind this one interface, including [AlienVault OTX](https://otx.alienvault.com/api), [abuse.ch URLhaus](https://urlhaus-api.abuse.ch/), [abuse.ch ThreatFox](https://threatfox.abuse.ch/api/), and [VirusTotal](https://docs.virustotal.com/) — each with its own API key, rate limits, and terms of use.

## SQL functions

Two offline scalars triage indicators with **no network call**: `indicator_type` classifies a string as `ipv4`/`ipv6`/`domain`/`url`/`md5`/`sha1`/`sha256` (or NULL when unrecognized), and `is_private_ip` flags private/reserved IP addresses that should never be sent to an external feed. The `reputation` table function then enriches a single indicator against the configured source — selected with `base_url` plus optional `api_key` and `timeout_ms` — and returns at most one verdict row with the `malicious` flag, `score`, `categories`, `source`, and `last_seen`.

A typical workflow first triages a whole column of indicators with the two offline scalars — `indicator_type` to classify each observable and `is_private_ip` to screen out internal hosts — and then enriches only the survivors with `reputation('1.2.3.4')`. Private/reserved IPs and unknown indicators return zero rows with no error, so enrichment stays cheap and safe. See the [vgi-threatintel source repository](https://github.com/Query-farm/vgi-threatintel) for adapter examples and the full normalized-feed contract.

## Find the exact SQL object

[Browse 4 object declarations](https://query.farm/products/orchard/api/v1/connectors/threatintel/objects.json) or [search within this connector](https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=threatintel&q=threatintel).

Follow one format of each needed object for complete argument types, defaults, named flags, return columns and examples. Existing links above can replace another search. For questions about hosting, credentials or supported operations, stop once the documentation answers the question; SQL and unrelated object lookups are unnecessary.

## Verification and interpretation

- Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.
- Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.
- A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.
- Service credentials, external data availability and deployment authentication are separate requirements.
- Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL.

```json
{
  "generatedAt": "2026-12-01T18:22:16+00:00",
  "repository": "https://github.com/Query-farm/vgi-threatintel",
  "harvest": {
    "status": "ok",
    "method": "github-auto",
    "error": null,
    "vgi_version": "9773130dde"
  },
  "catalogVerification": {
    "verified": true,
    "status": "passed",
    "total": 7,
    "passed": 7,
    "failed": 0,
    "needs_credentials": 0,
    "location": "github-auto://Query-farm/vgi-threatintel@v0.5.0",
    "transport": "github-auto",
    "environment": {
      "vgi_extension_version": "9773130dde",
      "haybarn_version": "2.0.1rc3",
      "engine_version": "v2.0.1",
      "python": "3.12.4",
      "platform": "darwin_arm64",
      "protocol_version": "3.4.0"
    },
    "checked_at": "2026-12-01T06:19:36+00:00"
  },
  "interpretation": "Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."
}
```
