lib

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package lib provides core functionality for the CipherSwarm agent.

Index

Constants

View Source
const AgentVersion = "0.5.5"

AgentVersion represents the current version of the agent software as a string.

Variables

View Source
var (
	ErrAuthenticationFailed = errors.New("failed to authenticate with the CipherSwarm API")
	ErrConfigurationFailed  = errors.New("failed to get agent configuration")
	ErrBadResponse          = errors.New("bad response from server")
)

Define static errors.

View Source
var (
	// Configuration represents the configuration of the agent.
	Configuration agentConfiguration //nolint:gochecknoglobals // Global agent configuration

)
View Source
var (
	ErrCouldNotValidateCredentials = stderrors.New("could not validate credentials")
)

Static errors to comply with err113 linter.

Functions

func AuthenticateAgent

func AuthenticateAgent(ctx context.Context) error

AuthenticateAgent authenticates the agent with the CipherSwarm API using the API client interface. It sends an authentication request to the API, processes the response, and updates the shared state. On error, it logs the error and returns it. If the response is nil or indicates a failed authentication, an error is logged and returned.

func GetAgentConfiguration

func GetAgentConfiguration(ctx context.Context) error

GetAgentConfiguration retrieves the agent configuration from the CipherSwarm API and handles errors. It updates the global Configuration variable with the fetched configuration. If UseNativeHashcat is true in the configuration, it sets the native Hashcat path.

func SendAgentShutdown added in v0.2.0

func SendAgentShutdown(ctx context.Context)

SendAgentShutdown notifies the server of the agent shutdown and handles any errors during the API call. Callers control context: pass context.Background() for shutdown notifications that must complete.

func SendHeartBeat

func SendHeartBeat(ctx context.Context) (*api.SendHeartbeat200State, error)

SendHeartBeat sends a heartbeat signal to the server and processes the server's response. It handles different response status codes and logs relevant messages. It returns the agent's state object (or nil for no state change) and an error if the heartbeat failed.

func UnwrapOr added in v0.6.1

func UnwrapOr[T any](ptr *T, defaultVal T) T

UnwrapOr returns the dereferenced pointer value, or the given default if the pointer is nil.

func UpdateAgentMetadata

func UpdateAgentMetadata(ctx context.Context) error

UpdateAgentMetadata updates the agent's metadata and sends it to the CipherSwarm API. It retrieves host information, device list, constructs the agent update request body, and sends the updated metadata to the API. Logs relevant information and handles any API errors.

Types

This section is empty.

Directories

Path Synopsis
Package agent provides the main agent functionality for CipherSwarm.
Package agent provides the main agent functionality for CipherSwarm.
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
Package apierrors provides unified error handling for CipherSwarm API interactions.
Package apierrors provides unified error handling for CipherSwarm API interactions.
Package arch provides architecture-specific functionality for Linux systems.
Package arch provides architecture-specific functionality for Linux systems.
Package benchmark provides benchmark management for the CipherSwarm agent.
Package benchmark provides benchmark management for the CipherSwarm agent.
Package config provides configuration management for the CipherSwarm agent.
Package config provides configuration management for the CipherSwarm agent.
Package cracker provides hashcat binary management and process control utilities.
Package cracker provides hashcat binary management and process control utilities.
Package cserrors provides error handling and logging utilities for CipherSwarm.
Package cserrors provides error handling and logging utilities for CipherSwarm.
Package display provides output and logging functions for the CipherSwarm agent.
Package display provides output and logging functions for the CipherSwarm agent.
Package downloader provides file download functionality for CipherSwarm resources.
Package downloader provides file download functionality for CipherSwarm resources.
Package hashcat provides utilities for interacting with hashcat.
Package hashcat provides utilities for interacting with hashcat.
Package progress provides utility functions for progress tracking and other common tasks.
Package progress provides utility functions for progress tracking and other common tasks.
Package task provides task management and execution logic for the CipherSwarm agent.
Package task provides task management and execution logic for the CipherSwarm agent.
Package testhelpers provides reusable test utilities and helpers for testing the CipherSwarm agent.
Package testhelpers provides reusable test utilities and helpers for testing the CipherSwarm agent.
Package zap provides functionality for handling CipherSwarm zap files and hash list processing.
Package zap provides functionality for handling CipherSwarm zap files and hash list processing.

Jump to

Keyboard shortcuts

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