Documentation
¶
Overview ¶
Package importcli is the "openctem import" command: it converts the output of a tool a person ran (nmap XML, testssl.sh JSON, a list of names or URLs, any format of the ctis importer, or any JSON/CSV/XML through a declarative mapping file) into a CTIS report on this machine, and uploads that report to the organization with an API key, or prints or saves it instead.
nmap -sV -oX - 192.0.2.0/24 | openctem import --format nmap --dry-run gau example.com | openctem import --format lines --as url openctem import --format testssl --out scan.ctis.json scan.json openctem import scan.ctis.json
What is uploaded is exactly what --dry-run prints: the CTIS report (format=ctis on POST /api/v1/findings/imports). The platform validates it again, imports it as a partial upload with the API key's rights, judges every host against the organization's scope and answers with a receipt.
The API key is read from OPENCTEM_API_KEY only (never a flag, so it never lands in shell history or a process list). It is sent only over HTTPS, or plain HTTP to a loopback address, and never to a redirect target.
Exit status: 0 imported (or printed or saved), 1 the platform refused or failed the upload or the input held nothing usable, 2 a usage or input error, 3 the upload is still queued when --wait ends.
Index ¶
Constants ¶
const ( ExitOK = 0 ExitFail = 1 ExitUsage = 2 ExitPending = 3 )
Exit codes.
const ( EnvURL = "OPENCTEM_URL" EnvAPIKey = "OPENCTEM_API_KEY" // EnvCAFile names a PEM file of CA certificates trusted in addition to // the system's (a private CA of the console). EnvCAFile = "OPENCTEM_CA_FILE" )
Environment.
const ( // MaxInputs is the most files one upload carries (the import route's // limit). MaxInputs = 10 // MaxInputBytes bounds each input read from a file or the standard // input. MaxInputBytes = 100 << 20 // MaxUploadBytes bounds the CTIS reports of one upload together (the // import route accepts 110 MiB of multipart body). MaxUploadBytes = 100 << 20 )
Limits of one command.
const (
MaxExportPages = 1000 // 100 000 targets
)
Export limits.
const MaxFiles = 500
MaxFiles bounds how many files one command reads after its patterns are expanded. They are sent MaxInputs at a time.
Variables ¶
var TargetKinds = map[string][]string{
"domain": {"domain", "subdomain"},
"ip": {"ip_address"},
"url": {"website", "http_service", "web_application", "api"},
"service": {"service", "open_port"},
}
TargetKinds maps a target kind to the platform's asset types.
Functions ¶
Types ¶
This section is empty.