importcli

package
v0.51.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	ExitOK      = 0
	ExitFail    = 1
	ExitUsage   = 2
	ExitPending = 3
)

Exit codes.

View Source
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.

View Source
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.

View Source
const (
	MaxExportPages = 1000 // 100 000 targets
)

Export limits.

View Source
const MaxFiles = 500

MaxFiles bounds how many files one command reads after its patterns are expanded. They are sent MaxInputs at a time.

Variables

View Source
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

func Main

func Main(args []string, stdin io.Reader, stdout, stderr io.Writer, getenv func(string) string) int

Main runs "openctem import <args>".

func RunMain

func RunMain(args []string, stdout, stderr io.Writer, getenv func(string) string) int

RunMain runs "openctem run <args>".

func TargetsMain

func TargetsMain(args []string, stdout, stderr io.Writer, getenv func(string) string) int

TargetsMain runs "openctem targets <args>".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL