Skip to content

PE executables

Inspect PE, ELF and Mach-O executables for malware triage without ever running them

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/pe/index.md to help me query PE executables 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.

Inspect an executable before running it

Reads a public sample executable as data; it does not execute the file.

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SET VARIABLE sample_binary = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT pe.main.binary_format(getvariable('sample_binary')) AS format, pe.main.machine(getvariable('sample_binary')) AS architecture, round(pe.main.overall_entropy(getvariable('sample_binary')), 3) AS entropy;
Result
format architecture entropy
PE X86_64 5.444

Quick start

Choose where to run PE executables, 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 with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'pe' AS pe (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-pe-worker'
);

3. Run a query

query.sql
SET VARIABLE sample_binary = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT pe.main.binary_format(getvariable('sample_binary')) AS format, pe.main.machine(getvariable('sample_binary')) AS architecture, round(pe.main.overall_entropy(getvariable('sample_binary')), 3) AS entropy;
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 with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'pe' AS pe (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-pe-worker'
);

Overview

Defensive malware-triage worker: static, read-only analysis of PE/ELF/Mach-O executables as SQL functions (the binary is never executed)

Catalog

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

pe 1 schema
main 1 table · 12 functions

Binary-analysis functions: format/architecture, entry point, signing, entropy, imphash, sections, imports, exports, and strings over PE/ELF/Mach-O input

Schema examples (11)
Examples (11)

Browse the worker's analysis catalog before owning a binary.

SELECT name, kind, formats FROM pe.main.analyses ORDER BY kind, name;

Detect the executable container format of a sample.

SELECT pe.main.binary_format((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));

Read the target CPU architecture of a sample.

SELECT pe.main.machine((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho')));

Compute whole-file entropy as a packing/encryption signal.

SELECT round(pe.main.overall_entropy((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'))), 3) AS file_entropy;
7 more examples

Fingerprint a PE by its import hash for clustering.

SELECT pe.main.imphash((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));

Rank a sample's sections by per-section entropy.

SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT name, entropy FROM pe.main.sections(getvariable('bin')) ORDER BY entropy DESC;

List the first imported symbols of a sample.

SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT library, function FROM pe.main.imports(getvariable('bin')) LIMIT 10;

Extract long printable strings for IOC hunting.

SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT seq, value FROM pe.main.strings(getvariable('bin'), min_len := 8) LIMIT 10;

Triage a set of files in one pass (read_blob also takes a folder glob such as 'samples/*'): container format, CPU architecture, code-signing, section count and whole-file entropy per file (a non-executable such as garbage.bin comes back all-NULL instead of failing the query).

SELECT filename, pe.main.binary_format(content) AS container,
  pe.main.machine(content) AS arch, pe.main.is_signed(content) AS signed,
  pe.main.section_count(content) AS n_sections,
  round(pe.main.overall_entropy(content), 2) AS file_entropy
FROM read_blob(['https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/garbage.bin'])
ORDER BY filename;

Localize the densest content of a sample: the sections whose entropy exceeds the file's own whole-file entropy (for hello.exe, `.text` and the `/19` debug section at ~5.9-6.0 bits/byte against a 5.44 baseline).

SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
WITH baseline AS (SELECT pe.main.overall_entropy(getvariable('bin')) AS file_entropy) SELECT s.name, round(s.entropy, 3) AS entropy, round(b.file_entropy, 3) AS file_entropy FROM pe.main.sections(getvariable('bin')) AS s, baseline AS b WHERE s.entropy > b.file_entropy ORDER BY s.entropy DESC;

Cluster a folder of PE samples by import hash and show each cluster's size, build-time span and member files (non-PE files have no imphash and are skipped; the sample set holds a single PE, so it yields one cluster).

SELECT pe.main.imphash(content) AS imphash, count(*) AS samples,
  min(pe.main.compile_timestamp(content)) AS first_built,
  max(pe.main.compile_timestamp(content)) AS last_built,
  list(filename ORDER BY filename) AS files
FROM read_blob(['https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/garbage.bin'])
WHERE pe.main.imphash(content) IS NOT NULL
GROUP BY 1
ORDER BY samples DESC, imphash;
Tables
analyses 3 examples5 cols

Browsable registry of every analysis (scalar/table) this worker exposes (discovery table).

Columns
name VARCHAR
Function name to call (e.g. `imphash`, `sections`).
kindnot null VARCHAR
`scalar` (one value per binary) or `table` (many rows per binary).
categorynot null VARCHAR
Navigation category slug (format/structure/entropy/signing/symbols/strings).
formatsnot null VARCHAR
Which container formats (PE / ELF / Mach-O) the analysis applies to.
resultnot null VARCHAR
What the analysis returns.
ConstraintsPRIMARY KEY (name)
Examples (3)

List the scalar analyses (one value per binary) in category order.

SELECT name, category, result
FROM pe.main.analyses
WHERE kind = 'scalar'
ORDER BY category, name;

Which analyses are PE-only?

SELECT name FROM pe.main.analyses WHERE formats = 'PE only' ORDER BY name;

Count analyses by kind.

SELECT kind, count(*) AS n
FROM pe.main.analyses
GROUP BY kind
ORDER BY kind;
Link
Scalar functions
binary_format (binary VARCHAR) +1 overload 3 examples

Executable format ('PE'/'ELF'/'MachO') of a binary (VARCHAR path), or NULL

Arguments
binary VARCHAR
Raw binary bytes.
Overloads
binary_format(binary VARCHAR) → VARCHARbinary_format(binary BLOB) → VARCHAR
ReturnsVARCHAR
Examples (3)

Detect the executable format of a Linux ELF sample (returns 'ELF')

SELECT pe.main.binary_format((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf')));

Detect the executable format of a Windows PE sample's bytes

SELECT pe.main.binary_format((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));

Triage a set of files in one pass (read_blob also takes a folder glob such as 'samples/*'): container format, CPU architecture, code-signing, section count and whole-file entropy per file (a non-executable such as garbage.bin comes back all-NULL instead of failing the query).

SELECT filename, pe.main.binary_format(content) AS container,
  pe.main.machine(content) AS arch, pe.main.is_signed(content) AS signed,
  pe.main.section_count(content) AS n_sections,
  round(pe.main.overall_entropy(content), 2) AS file_entropy
FROM read_blob(['https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/garbage.bin'])
ORDER BY filename;
Link
compile_timestamp (binary VARCHAR) +1 overload 2 examples

PE build timestamp (TimeDateStamp) of a binary (VARCHAR path); NULL for ELF/Mach-O

Arguments
binary VARCHAR
Filesystem path to a binary.
Overloads
compile_timestamp(binary VARCHAR) → TIMESTAMPcompile_timestamp(binary BLOB) → TIMESTAMP
ReturnsTIMESTAMP
Examples (2)

Build year of a Windows PE sample, from its compile timestamp

SELECT year(pe.main.compile_timestamp((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')))) AS build_year;

PE compile timestamp of a Windows PE sample

SELECT pe.main.compile_timestamp((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));
Link
entry_point (binary VARCHAR) +1 overload 2 examples

Entry-point virtual address of a binary (VARCHAR path), or NULL

Arguments
binary VARCHAR
Filesystem path to a binary.
Overloads
entry_point(binary VARCHAR) → UBIGINTentry_point(binary BLOB) → UBIGINT
ReturnsUBIGINT
Examples (2)

Entry-point address of a Linux ELF sample

SELECT pe.main.entry_point((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf')));

Entry-point address of a Windows PE sample

SELECT pe.main.entry_point((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));
Link
imphash (binary VARCHAR) +1 overload 3 examples

PE import hash (for clustering) of a binary (VARCHAR path); NULL for ELF/Mach-O

Arguments
binary VARCHAR
Filesystem path to a binary.
Overloads
imphash(binary VARCHAR) → VARCHARimphash(binary BLOB) → VARCHAR
ReturnsVARCHAR
Examples (3)

Check whether a PE sample's import hash matches a known cluster's imphash

SELECT pe.main.imphash((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'))) = '7ff113ca9631a5215fdc9b66c067ad8f' AS in_known_cluster;

Import hash of a Windows PE sample

SELECT pe.main.imphash((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));

Cluster a folder of PE samples by import hash and show each cluster's size, build-time span and member files (non-PE files have no imphash and are skipped; the sample set holds a single PE, so it yields one cluster).

SELECT pe.main.imphash(content) AS imphash, count(*) AS samples,
  min(pe.main.compile_timestamp(content)) AS first_built,
  max(pe.main.compile_timestamp(content)) AS last_built,
  list(filename ORDER BY filename) AS files
FROM read_blob(['https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho', 'https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/garbage.bin'])
WHERE pe.main.imphash(content) IS NOT NULL
GROUP BY 1
ORDER BY samples DESC, imphash;
Link
is_signed (binary VARCHAR) +1 overload 2 examples

True if a binary (VARCHAR path) carries a code signature (PE Authenticode / Mach-O)

Arguments
binary VARCHAR
Filesystem path to a binary.
Overloads
is_signed(binary VARCHAR) → BOOLEANis_signed(binary BLOB) → BOOLEAN
ReturnsBOOLEAN
Examples (2)

Whether a macOS Mach-O sample is code-signed (true: it carries an ad-hoc signature)

SELECT pe.main.is_signed((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho')));

Whether a Windows PE sample is code-signed (false: it has no Authenticode signature)

SELECT pe.main.is_signed((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));
Link
machine (binary VARCHAR) +1 overload 2 examples

Architecture of a binary (VARCHAR path), e.g. 'X86_64'/'ARM64', or NULL

Arguments
binary VARCHAR
Filesystem path to a binary.
Overloads
machine(binary VARCHAR) → VARCHARmachine(binary BLOB) → VARCHAR
ReturnsVARCHAR
Examples (2)

Architecture of a macOS Mach-O sample (returns 'ARM64')

SELECT pe.main.machine((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho')));

Architecture of a Windows PE sample

SELECT pe.main.machine((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));
Link
overall_entropy (binary VARCHAR) +1 overload 2 examples

Shannon entropy (bits/byte, 0-8) of a binary (VARCHAR path); high => packed/encrypted

Arguments
binary VARCHAR
Raw binary bytes.
Overloads
overall_entropy(binary VARCHAR) → DOUBLEoverall_entropy(binary BLOB) → DOUBLE
ReturnsDOUBLE
Examples (2)

Whole-file entropy of a mostly zero-padded Mach-O sample (a low value, about 0.34)

SELECT round(pe.main.overall_entropy((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho'))), 2) AS file_entropy;

Whole-file entropy of a Windows PE sample

SELECT pe.main.overall_entropy((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));
Link
section_count (binary VARCHAR) +1 overload 2 examples

Number of sections in a binary (VARCHAR path), or NULL

Arguments
binary VARCHAR
Raw binary bytes.
Overloads
section_count(binary VARCHAR) → INTEGERsection_count(binary BLOB) → INTEGER
ReturnsINTEGER
Examples (2)

Section count of a Linux ELF sample

SELECT pe.main.section_count((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_elf')));

Section count of a Windows PE sample

SELECT pe.main.section_count((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')));
Link
Table functions
exports (binary VARCHAR) +1 overload 1 example

Exported symbols (name, address) of a binary (VARCHAR path)

Arguments
binary VARCHAR
Raw binary bytes.
Overloads
exports(binary VARCHAR)exports(binary BLOB)
Returns columns
name VARCHAR
Exported symbol name.
address UBIGINT
Symbol address/value (0 when unavailable).
Example
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho'));
SELECT name, address FROM pe.main.exports(getvariable('bin')) ORDER BY name;
Link
imports (binary VARCHAR) +1 overload 2 examples

Imported symbols (library, function) of a binary (VARCHAR path)

Arguments
binary VARCHAR
Filesystem path to a binary.
Overloads
imports(binary VARCHAR)imports(binary BLOB)
Returns columns
library VARCHAR
Imported library/DLL name (empty for ELF/Mach-O).
function VARCHAR
Imported symbol name, or `ordinal#N` when imported by ordinal.
Examples (2)
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT library, function FROM pe.main.imports(getvariable('bin')) ORDER BY library, function LIMIT 10;
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT library, count(*) AS n_functions FROM pe.main.imports(getvariable('bin')) GROUP BY library ORDER BY n_functions DESC;
Link
sections (binary VARCHAR) +1 overload 4 examples

Per-section (name, virtual_size, raw_size, entropy, flags) of a binary (VARCHAR path)

Arguments
binary VARCHAR
Raw binary bytes.
Overloads
sections(binary VARCHAR)sections(binary BLOB)
Returns columns
name VARCHAR
Section name (e.g. `.text`, `.data`, `__TEXT`).
virtual_size BIGINT
Size in bytes when mapped into memory.
raw_size BIGINT
Size in bytes on disk.
entropy DOUBLE
Per-section Shannon entropy (0-8); high (>~7) suggests packing/encryption.
characteristics VARCHAR
Comma-joined section flags (PE only; empty for ELF/Mach-O).
Examples (4)
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT name, entropy FROM pe.main.sections(getvariable('bin')) ORDER BY entropy DESC LIMIT 5;
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT name, virtual_size, raw_size, round(entropy, 3) AS entropy FROM pe.main.sections(getvariable('bin')) ORDER BY entropy DESC LIMIT 5;
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT name, round(entropy, 3) AS entropy FROM pe.main.sections(getvariable('bin')) WHERE entropy > 5.5 ORDER BY entropy DESC;
1 more example
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
WITH baseline AS (SELECT pe.main.overall_entropy(getvariable('bin')) AS file_entropy) SELECT s.name, round(s.entropy, 3) AS entropy, round(b.file_entropy, 3) AS file_entropy FROM pe.main.sections(getvariable('bin')) AS s, baseline AS b WHERE s.entropy > b.file_entropy ORDER BY s.entropy DESC;
Link
strings (binary VARCHAR, min_len := INTEGER) +1 overload 4 examples
Positional arguments
binary VARCHAR
Filesystem path to a binary.
Named arguments
min_len := INTEGER
Minimum string length to report (default 5). · default 5
Overloads
strings(binary VARCHAR, min_len INTEGER)strings(binary BLOB, min_len INTEGER)
Returns columns
seq BIGINT
1-based ordinal of the string in file order.
value VARCHAR
Printable ASCII/UTF-16 string (length >= `min_len`).
Examples (4)

Extract printable strings from raw BLOB bytes (no file needed)

SELECT seq, value
FROM pe.main.strings('\x00\x01demo payload: printable ASCII recovered straight from a BLOB\x00\xFFcmd.exe /c whoami\x00\x02http://example.invalid/beacon\x00ok\x00'::BLOB, min_len := 5)
ORDER BY seq;

Count the strings of at least 12 characters in a BLOB

SELECT count(*) AS long_strings
FROM pe.main.strings('\x00\x01demo payload: printable ASCII recovered straight from a BLOB\x00\xFFcmd.exe /c whoami\x00\x02http://example.invalid/beacon\x00ok\x00'::BLOB, min_len := 12);
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT seq, value FROM pe.main.strings(getvariable('bin'), min_len := 8) ORDER BY seq LIMIT 5;
1 more example
SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT DISTINCT value FROM pe.main.strings(getvariable('bin')) WHERE lower(value) LIKE '%.dll' ORDER BY value;
Link

Try these queries

Browse the worker's analysis catalog before owning a binary.

SELECT name, kind, formats FROM pe.main.analyses ORDER BY kind, name

Uses analyses

Detect the executable container format of a sample.

SELECT pe.main.binary_format((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')))

Uses binary_format

Read the target CPU architecture of a sample.

SELECT pe.main.machine((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello_macho')))

Uses machine

Compute whole-file entropy as a packing/encryption signal.

SELECT round(pe.main.overall_entropy((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'))), 3) AS file_entropy

Uses overall_entropy

Fingerprint a PE by its import hash for clustering.

SELECT pe.main.imphash((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe')))

Uses imphash

Rank a sample's sections by per-section entropy.

SET VARIABLE bin = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-pe/v0.4.0/test/sql/data/hello.exe'));
SELECT name, entropy FROM pe.main.sections(getvariable('bin')) ORDER BY entropy DESC

Uses sections

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

PE executables 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.