The SPQL command-line client (spql_cli.py
) allows users to run SPQL queries or generate JSON-encoded queries for tools like curl
or Postman. Refer to SPQL Syntax Rules and SPQL Query Examples for query construction.
Installation
The SPQL command-line client (spql_cli.py) allows users to run SPQL queries or generate JSON-encoded queries for tools like curl or Postman. Refer to SPQL Syntax Rules (#learn-syntax-rules) and SPQL Query Examples (#read-query-examples) for query construction.
Syntax
spql_cli.py [OPTION]
Options
Option | Description |
---|---|
| (Required) SPQL query as a string. |
| Comma-separated field names in square brackets (e.g., |
| Comma-separated sort fields/orders in square brackets (e.g., |
| (Required) Silent Push API key. Can be set as |
| Maximum results to return. |
| Number of results to skip. |
| Include metadata with results. |
| Display JSON-encoded query without executing it. |
| Show this message and exit |
Environment variables
API key:
export SPQL_API_KEY=<api_key>
Fixed fields:
export SPQL_FIELDS=[domain,hostname,ip,url,htmltitle]
Sort order:
export SPQL_SORT=[domain/asc,scan_date/desc]
Example
Search for servers with specific content-type, excluding Apache/nginx, that have opendirectory
and cpanel
in their SSL names, were scanned in the last 30 days, and are filtered by regex and TLD.
export SPQL_SORT=[domain/asc,scan_date/desc]
Note: Use
—echo-query
to generate JSON for SPQL API Functionality.
See SPQL Data Sources for targeting specific repositories.