cli

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package cli provides command-line interface commands for the Scanorama network scanner. This file implements the API server command for running a standalone API server without the full daemon functionality.

Package cli provides CLI authentication helpers for making API calls. This file implements HTTP client functionality with API key authentication for CLI commands that interact with the Scanorama API server.

Package cli provides command-line interface commands for the Scanorama network scanner. This file implements API key management commands for creating, listing, updating, and deleting API keys used for API server authentication.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This package implements the Cobra-based CLI structure with commands for scanning, discovery, host management, scheduling, and daemon operations.

Package cli provides command-line interface commands for the Scanorama network scanner. This file implements the server command with lifecycle management.

Index

Constants

View Source
const (
	StatusBadRequest          = 400
	StatusUnauthorized        = 401
	StatusForbidden           = 403
	StatusNotFound            = 404
	StatusTooManyRequests     = 429
	StatusInternalServerError = 500
)

HTTP status code constants

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func SetVersion

func SetVersion(v, c, bt string)

SetVersion sets the version information (called from main).

func WithAPIClient added in v0.10.0

func WithAPIClient(operation string, fn func(*APIClient) error) error

WithAPIClient is a helper for commands that need API access

Types

type APIClient added in v0.10.0

type APIClient struct {
	// contains filtered or unexported fields
}

APIClient provides authenticated HTTP client functionality for CLI commands

func NewAPIClient added in v0.10.0

func NewAPIClient() (*APIClient, error)

NewAPIClient creates a new API client with authentication

func (*APIClient) Delete added in v0.10.0

func (c *APIClient) Delete(endpoint string) (*APIResponse, error)

Delete performs a DELETE request

func (*APIClient) Get added in v0.10.0

func (c *APIClient) Get(endpoint string) (*APIResponse, error)

Get performs a GET request to the specified endpoint

func (*APIClient) GetServerInfo added in v0.10.0

func (c *APIClient) GetServerInfo() (map[string]interface{}, error)

GetServerInfo retrieves server information (requires authentication)

func (*APIClient) Post added in v0.10.0

func (c *APIClient) Post(endpoint string, payload interface{}) (*APIResponse, error)

Post performs a POST request with JSON payload

func (*APIClient) Put added in v0.10.0

func (c *APIClient) Put(endpoint string, payload interface{}) (*APIResponse, error)

Put performs a PUT request with JSON payload

func (*APIClient) TestConnection added in v0.10.0

func (c *APIClient) TestConnection() error

TestConnection tests the API connection and authentication

type APIError added in v0.10.0

type APIError struct {
	StatusCode int
	Message    string
	RequestID  string
	Response   *APIResponse
}

APIError represents an API error response

func (*APIError) Error added in v0.10.0

func (e *APIError) Error() string

Error implements the error interface

type APIResponse added in v0.10.0

type APIResponse struct {
	Data      interface{} `json:"data,omitempty"`
	Error     string      `json:"error,omitempty"`
	Message   string      `json:"message,omitempty"`
	RequestID string      `json:"request_id,omitempty"`
	Timestamp time.Time   `json:"timestamp,omitempty"`
}

APIResponse represents a standard API response structure

type DatabaseOperation

type DatabaseOperation func(*db.DB) error

DatabaseOperation represents a function that operates on a database connection.

type DiscoveryJob

type DiscoveryJob struct {
	Name     string
	CronExpr string
	Network  string
	Method   string
	DetectOS bool
}

DiscoveryJob represents a discovery job configuration.

type Host

type Host struct {
	IP              string
	Status          string
	OSFamily        string
	OSName          string
	LastSeen        time.Time
	FirstSeen       time.Time
	IsIgnored       bool
	OpenPorts       int
	TotalScans      int
	DiscoveryMethod string
}

Host represents a discovered host.

type HostFilters

type HostFilters struct {
	Status      string
	OSFamily    string
	LastSeenDur time.Duration
	ShowIgnored bool
}

HostFilters represents the filters for querying hosts.

type ScanJob

type ScanJob struct {
	Name      string
	CronExpr  string
	Targets   string
	LiveHosts bool
	Ports     string
	ScanType  string
	Profile   string
	Timeout   int
	OSFamily  string
}

ScanJob represents a scan job configuration.

type ScheduledJob

type ScheduledJob struct {
	ID        string
	Name      string
	JobType   string
	CronExpr  string
	IsActive  bool
	CreatedAt time.Time
	LastRun   *time.Time
	NextRun   time.Time
	RunCount  int
	Config    map[string]interface{}
}

ScheduledJob represents a scheduled job.

Jump to

Keyboard shortcuts

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