CLI Reference

Complete reference for the shield-base command, all global flags, and the compile, types, and lm-read subcommands.

The shield-base command is the primary entry point. Running it without arguments starts the interactive wizard. You can also drive it entirely from flags for CI/CD pipelines and automated scripts.

Use --help on any command or subcommand to print available options:

pnpm dlx @riavzon/shield-base --help
pnpm dlx @riavzon/shield-base compile --help
pnpm dlx @riavzon/shield-base lm-read --help
pnpm dlx @riavzon/shield-base types --help

Global Flags

Source Selection

FlagDescription
--allSkip interactive selection and fetch all available sources.
--bgpCompile BGP/ASN routing data.
--cityCompile IP-to-city geolocation data.
--geoCompile IP-to-country geolocation data.
--proxyCompile proxy and anonymizer IP lists.
--torCompile Tor relay and exit node data.
--seoCompile verified search engine crawler IP ranges.
--useragentCompile suspicious HTTP user-agent patterns into LMDB.
--emailCompile the disposable email domain blocklist into LMDB.
--l1Compile FireHOL Level 1 threat intelligence.
--l2Compile FireHOL Level 2 threat intelligence.
--l3Compile FireHOL Level 3 threat intelligence.
--l4Compile FireHOL Level 4 threat intelligence.
--anonymousCompile the FireHOL anonymity network list (Tor exits, I2P, VPNs).

Control Flags

FlagDescription
--parallelRun all compilation jobs concurrently.
--refreshForce re-download of previously compiled sources using cached config.
--refreshAllForce re-download and recompilation of all sources using cached config.
--acceptFireholRiskAcknowledge the FireHOL license. Required for --l1 through --l4 and --anonymous.
--contact <str>BGP.tools contact string. Required format: <name> [url] - <email>.
--path <dir>Output directory for compiled databases. Defaults to the current working directory.
--help, -hShow help for the main command or a subcommand.

Examples

# Compile everything in parallel, non-interactively
pnpm dlx @riavzon/shield-base --all --parallel --contact "Name https://example.com - [email protected]" --acceptFireholRisk

# Compile only Tor and proxy data
pnpm dlx @riavzon/shield-base --tor --proxy

# Compile BGP and FireHOL Level 1 to a specific directory
pnpm dlx @riavzon/shield-base --bgp --l1 --acceptFireholRisk --contact "Name - [email protected]" --path ./data/mmdb

# Refresh all previously compiled sources
pnpm dlx @riavzon/shield-base --refreshAll

# Compile LMDB sources only (no mmdbctl needed)
pnpm dlx @riavzon/shield-base --useragent --email

compile Subcommand

Generates MMDB or LMDB databases and TypeScript types from your own JSON data files.

Argument / FlagTypeDescription
<INPUT>PositionalOne or more paths to JSON data files, separated by spaces.
--typemmdb | lmdbRequired. Use mmdb for IP range data (range field required). Use lmdb for key-value data (key or id field required).
--namestringRequired. Base name for the output files.
--outputDirstringDirectory to save the compiled files. Defaults to ./.
--typesbooleanGenerate TypeScript type definitions. Defaults to true.
--no-typesflagDisable TypeScript type generation.
--help, -hflagShow help for this subcommand.
# Compile a single MMDB database
pnpm dlx @riavzon/shield-base compile --type mmdb --name myRanges --outputDir ./out example.json

# Compile a single LMDB database
pnpm dlx @riavzon/shield-base compile --type lmdb --name myKeys --outputDir ./out example.json

# Compile multiple JSON files (batch)
pnpm dlx @riavzon/shield-base compile --type mmdb --name myRanges --outputDir ./out file1.json file2.json

# Disable type generation
pnpm dlx @riavzon/shield-base compile --type lmdb --name myKeys --no-types data.json

When processing multiple input files, the first output uses your --name (for example, myRanges.mmdb), and subsequent files are indexed (myRanges-1.mmdb, myRanges-2.mmdb).

For mmdb, every record in the JSON input must contain a range field with an IPv4/IPv6 address or CIDR range. For lmdb, every record must contain a key or id field used as the lookup key.

lm-read Subcommand

Reads and inspects data from an LMDB .mdb database. Pass the full path to the .mdb environment directory, not its parent.

FlagTypeDescription
--pathstringRequired. Full path to the .mdb database file.
--namestringRequired. Name of the LMDB sub-database.
--operationenumRequired. One of get, range, prefix, count, exists, stats, drop.
--keystringExact key to look up. Required for get and exists.
--prefixstringKey prefix to search. Required for prefix.
--limitstringMaximum records to return. Used by range and prefix. Defaults to 10.
--help, -hflagShow help.
OperationDescription
getRetrieve a single record by exact key.
rangeReturn the first N records in B-tree order.
prefixFind all keys starting with the given prefix.
countCount total records in the database.
existsCheck whether a key exists.
statsPrint LMDB environment statistics (page size, depth, record count).
dropPermanently delete the database. Irreversible.
# Get a record by exact key
pnpm dlx @riavzon/shield-base lm-read --path ./out/useragent.mdb --name useragent --operation get --key "sqlmap"

# List the first 5 records in B-tree order
pnpm dlx @riavzon/shield-base lm-read --path ./out/useragent.mdb --name useragent --operation range --limit 5

# Find all keys starting with a prefix
pnpm dlx @riavzon/shield-base lm-read --path ./out/useragent.mdb --name useragent --operation prefix --prefix "curl"

# Count all records
pnpm dlx @riavzon/shield-base lm-read --path ./out/useragent.mdb --name useragent --operation count

# Check if a key exists
pnpm dlx @riavzon/shield-base lm-read --path ./out/useragent.mdb --name useragent --operation exists --key "nmap"
The drop operation permanently deletes the database and cannot be undone.

types Subcommand

Generates standalone TypeScript type definitions from JSON files or raw JSON strings without compiling a database.

Argument / FlagTypeDescription
<INPUT>PositionalOne or more JSON file paths or raw JSON strings, separated by spaces.
--namestringRequired. Base name for the generated type file.
--outputDirstringDirectory to save the generated .ts file. Defaults to ./.
--help, -hflagShow help.
# From a JSON file
pnpm dlx @riavzon/shield-base types --name myData --outputDir ./src/types data.json

# From a raw JSON string
pnpm dlx @riavzon/shield-base types --name myData --outputDir ./src/types '{"key": "value", "count": 1}'

# Batch: multiple inputs
pnpm dlx @riavzon/shield-base types --name batchTypes --outputDir ./src/types file1.json file2.json

Output files are named <name>Types.ts. Batch inputs produce indexed files: batchTypesTypes.ts, batchTypes-1Types.ts, and so on.

Logo