api

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: 11 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Package api provides interfaces for the CipherSwarm API client. These interfaces enable dependency injection and improve testability by allowing mock implementations in tests.

Index

Constants

View Source
const (
	Bearer_authScopes = "bearer_auth.Scopes"
)

Variables

This section is empty.

Functions

func ConvertInt64SliceToInt

func ConvertInt64SliceToInt(s []int64) ([]int, int)

ConvertInt64SliceToInt converts []int64 to []int with bounds checking to prevent silent overflow on 32-bit platforms. Returns the converted slice and the number of values that were clamped to zero. Callers should log a warning when clamped > 0.

func HashListResponseStream

func HashListResponseStream(resp *GetHashListResponse) io.Reader

HashListResponseStream extracts the response body as an io.Reader from a GetHashListResponse. It uses the parsed Body bytes because the generated oapi-codegen parser reads and closes HTTPResponse.Body during parsing, making the original body stream unavailable. Returns io.Reader (vs io.ReadCloser) because callers in downloader.go don't need Close semantics.

func NewAuthenticateRequest

func NewAuthenticateRequest(server string) (*http.Request, error)

NewAuthenticateRequest generates requests for Authenticate

func NewGetAgentRequest

func NewGetAgentRequest(server string, id int64) (*http.Request, error)

NewGetAgentRequest generates requests for GetAgent

func NewGetAttackRequest

func NewGetAttackRequest(server string, id int64) (*http.Request, error)

NewGetAttackRequest generates requests for GetAttack

func NewGetConfigurationRequest

func NewGetConfigurationRequest(server string) (*http.Request, error)

NewGetConfigurationRequest generates requests for GetConfiguration

func NewGetHashListRequest

func NewGetHashListRequest(server string, id int64) (*http.Request, error)

NewGetHashListRequest generates requests for GetHashList

func NewGetNewTaskRequest

func NewGetNewTaskRequest(server string) (*http.Request, error)

NewGetNewTaskRequest generates requests for GetNewTask

func NewGetTaskRequest

func NewGetTaskRequest(server string, id int64) (*http.Request, error)

NewGetTaskRequest generates requests for GetTask

func NewGetTaskZapsRequest

func NewGetTaskZapsRequest(server string, id int64) (*http.Request, error)

NewGetTaskZapsRequest generates requests for GetTaskZaps

func NewSendCrackRequest

func NewSendCrackRequest(server string, id int64, body SendCrackJSONRequestBody) (*http.Request, error)

NewSendCrackRequest calls the generic SendCrack builder with application/json body

func NewSendCrackRequestWithBody

func NewSendCrackRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSendCrackRequestWithBody generates requests for SendCrack with any type of body

func NewSendHeartbeatRequest

func NewSendHeartbeatRequest(server string, id int64, body SendHeartbeatJSONRequestBody) (*http.Request, error)

NewSendHeartbeatRequest calls the generic SendHeartbeat builder with application/json body

func NewSendHeartbeatRequestWithBody

func NewSendHeartbeatRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSendHeartbeatRequestWithBody generates requests for SendHeartbeat with any type of body

func NewSendStatusRequest

func NewSendStatusRequest(server string, id int64, body SendStatusJSONRequestBody) (*http.Request, error)

NewSendStatusRequest calls the generic SendStatus builder with application/json body

func NewSendStatusRequestWithBody

func NewSendStatusRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSendStatusRequestWithBody generates requests for SendStatus with any type of body

func NewSetAgentShutdownRequest

func NewSetAgentShutdownRequest(server string, id int64) (*http.Request, error)

NewSetAgentShutdownRequest generates requests for SetAgentShutdown

func NewSetTaskAbandonedRequest

func NewSetTaskAbandonedRequest(server string, id int64) (*http.Request, error)

NewSetTaskAbandonedRequest generates requests for SetTaskAbandoned

func NewSetTaskAcceptedRequest

func NewSetTaskAcceptedRequest(server string, id int64) (*http.Request, error)

NewSetTaskAcceptedRequest generates requests for SetTaskAccepted

func NewSetTaskExhaustedRequest

func NewSetTaskExhaustedRequest(server string, id int64) (*http.Request, error)

NewSetTaskExhaustedRequest generates requests for SetTaskExhausted

func NewSubmitBenchmarkRequest

func NewSubmitBenchmarkRequest(server string, id int64, body SubmitBenchmarkJSONRequestBody) (*http.Request, error)

NewSubmitBenchmarkRequest calls the generic SubmitBenchmark builder with application/json body

func NewSubmitBenchmarkRequestWithBody

func NewSubmitBenchmarkRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSubmitBenchmarkRequestWithBody generates requests for SubmitBenchmark with any type of body

func NewSubmitErrorAgentRequest

func NewSubmitErrorAgentRequest(server string, id int64, body SubmitErrorAgentJSONRequestBody) (*http.Request, error)

NewSubmitErrorAgentRequest calls the generic SubmitErrorAgent builder with application/json body

func NewSubmitErrorAgentRequestWithBody

func NewSubmitErrorAgentRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSubmitErrorAgentRequestWithBody generates requests for SubmitErrorAgent with any type of body

func NewUpdateAgentRequest

func NewUpdateAgentRequest(server string, id int64, body UpdateAgentJSONRequestBody) (*http.Request, error)

NewUpdateAgentRequest calls the generic UpdateAgent builder with application/json body

func NewUpdateAgentRequestWithBody

func NewUpdateAgentRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewUpdateAgentRequestWithBody generates requests for UpdateAgent with any type of body

func ResponseStream

func ResponseStream(resp *GetTaskZapsResponse) io.ReadCloser

ResponseStream extracts the response body as an io.ReadCloser from a GetTaskZapsResponse. It uses the parsed Body bytes because the generated oapi-codegen parser reads and closes HTTPResponse.Body during parsing, making the original body stream unavailable. Returns io.ReadCloser (vs io.Reader) because callers in zap.go defer-close the stream.

Types

type APIClient

type APIClient interface {
	Tasks() TasksClient
	Attacks() AttacksClient
	Agents() AgentsClient
	Auth() AuthClient
}

APIClient is the aggregate interface combining all API subsystems. This can be implemented by the AgentClient wrapper or by mocks in tests.

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Body       string
}

APIError represents an HTTP error returned by the CipherSwarm API. It serves as the unified internal error type for 4xx and 5xx API responses. For the API error object model (JSON "error" field), see ErrorObject.

func (*APIError) Error

func (e *APIError) Error() string

Error returns a formatted error string including the status code and body.

type AdvancedAgentConfiguration

type AdvancedAgentConfiguration struct {
	// AgentUpdateInterval The interval in seconds to check for agent updates
	AgentUpdateInterval *int `json:"agent_update_interval"`

	// BackendDevice The device to use for hashcat, separated by commas
	BackendDevice *string `json:"backend_device"`

	// EnableAdditionalHashTypes Causes hashcat to perform benchmark-all, rather than just benchmark
	EnableAdditionalHashTypes bool `json:"enable_additional_hash_types"`

	// OpenclDevices The OpenCL device types to use for hashcat, separated by commas
	OpenclDevices *string `json:"opencl_devices"`

	// UseNativeHashcat Use the hashcat binary already installed on the client system
	UseNativeHashcat *bool `json:"use_native_hashcat"`
}

AdvancedAgentConfiguration Advanced hashcat and agent configuration options

type Agent

type Agent struct {
	// AdvancedConfiguration Advanced hashcat and agent configuration options
	AdvancedConfiguration AdvancedAgentConfiguration `json:"advanced_configuration"`

	// ClientSignature The signature of the client
	ClientSignature string `json:"client_signature"`

	// CurrentActivity Current agent activity state
	CurrentActivity *string  `json:"current_activity"`
	Devices         []string `json:"devices"`

	// HostName The hostname of the agent
	HostName string `json:"host_name"`

	// Id The id of the agent
	Id int64 `json:"id"`

	// OperatingSystem The operating system of the agent
	OperatingSystem string `json:"operating_system"`

	// State The state of the agent
	State AgentState `json:"state"`
}

Agent A cracking agent registered with CipherSwarm

type AgentClient

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

AgentClient wraps the generated ClientWithResponses and implements the APIClient interface.

func NewAgentClient

func NewAgentClient(serverURL, token string) (*AgentClient, error)

NewAgentClient creates a new AgentClient from a server URL and bearer token.

func (*AgentClient) Agents

func (a *AgentClient) Agents() AgentsClient

Agents returns a sub-client for agent-related API operations.

func (*AgentClient) Attacks

func (a *AgentClient) Attacks() AttacksClient

Attacks returns a sub-client for attack-related API operations.

func (*AgentClient) Auth

func (a *AgentClient) Auth() AuthClient

Auth returns a sub-client for authentication-related API operations.

func (*AgentClient) Tasks

func (a *AgentClient) Tasks() TasksClient

Tasks returns a sub-client for task-related API operations.

type AgentState

type AgentState string

AgentState The state of the agent

const (
	Active  AgentState = "active"
	Error   AgentState = "error"
	Offline AgentState = "offline"
	Pending AgentState = "pending"
	Stopped AgentState = "stopped"
)

Defines values for AgentState.

type AgentsClient

type AgentsClient interface {
	// SendHeartbeat sends a heartbeat to the server with the current activity state.
	SendHeartbeat(ctx context.Context, id int64, activity string) (*SendHeartbeatResponse, error)

	// UpdateAgent updates agent metadata.
	UpdateAgent(
		ctx context.Context,
		id int64,
		body UpdateAgentJSONRequestBody,
	) (*UpdateAgentResponse, error)

	// SubmitBenchmark submits benchmark results.
	SubmitBenchmark(
		ctx context.Context,
		id int64,
		body SubmitBenchmarkJSONRequestBody,
	) (*SubmitBenchmarkResponse, error)

	// SubmitErrorAgent reports an error to the server.
	SubmitErrorAgent(
		ctx context.Context,
		id int64,
		body SubmitErrorAgentJSONRequestBody,
	) (*SubmitErrorAgentResponse, error)

	// SetAgentShutdown notifies the server of agent shutdown.
	SetAgentShutdown(ctx context.Context, id int64) (*SetAgentShutdownResponse, error)
}

AgentsClient defines the interface for agent-related API operations.

type Attack

type Attack struct {
	// AttackMode Attack mode name
	AttackMode AttackAttackMode `json:"attack_mode"`

	// AttackModeHashcat hashcat attack mode
	AttackModeHashcat int `json:"attack_mode_hashcat"`

	// ClassicMarkov Enable hashcat classic markov mode
	ClassicMarkov bool `json:"classic_markov"`

	// CustomCharset1 Custom charset 1 for hashcat mask attacks
	CustomCharset1 *string `json:"custom_charset_1"`

	// CustomCharset2 Custom charset 2 for hashcat mask attacks
	CustomCharset2 *string `json:"custom_charset_2"`

	// CustomCharset3 Custom charset 3 for hashcat mask attacks
	CustomCharset3 *string `json:"custom_charset_3"`

	// CustomCharset4 Custom charset 4 for hashcat mask attacks
	CustomCharset4 *string `json:"custom_charset_4"`

	// DisableMarkov Disable hashcat markov mode
	DisableMarkov bool `json:"disable_markov"`

	// HashListChecksum The MD5 checksum of the hash list
	HashListChecksum *[]byte `json:"hash_list_checksum"`

	// HashListId The id of the hash list
	HashListId int64 `json:"hash_list_id"`

	// HashListUrl The download URL for the hash list
	HashListUrl *string `json:"hash_list_url"`

	// HashMode The hashcat hash mode
	HashMode int `json:"hash_mode"`

	// Id The id of the attack
	Id int64 `json:"id"`

	// IncrementMaximum The end of the increment range
	IncrementMaximum int `json:"increment_maximum"`

	// IncrementMinimum The start of the increment range
	IncrementMinimum int `json:"increment_minimum"`

	// IncrementMode Enable hashcat increment mode
	IncrementMode bool `json:"increment_mode"`

	// LeftRule The left-hand rule for combinator attacks
	LeftRule *string `json:"left_rule"`

	// MarkovThreshold The hashcat markov threshold
	MarkovThreshold *int `json:"markov_threshold,omitempty"`

	// Mask A hashcat mask string
	Mask *string `json:"mask"`

	// MaskList A downloadable resource file (word list, rule list, or mask list) used by an attack
	MaskList *AttackResourceFile `json:"mask_list"`

	// Optimized Enable hashcat optimized mode
	Optimized bool `json:"optimized"`

	// RightRule The right-hand rule for combinator attacks
	RightRule *string `json:"right_rule"`

	// RuleList A downloadable resource file (word list, rule list, or mask list) used by an attack
	RuleList *AttackResourceFile `json:"rule_list"`

	// SlowCandidateGenerators Enable hashcat slow candidate generators
	SlowCandidateGenerators bool `json:"slow_candidate_generators"`

	// Url The URL to the attack
	Url *string `json:"url"`

	// WordList A downloadable resource file (word list, rule list, or mask list) used by an attack
	WordList *AttackResourceFile `json:"word_list"`

	// WorkloadProfile The hashcat workload profile
	WorkloadProfile int `json:"workload_profile"`
}

Attack A hashcat attack configuration assigned to an agent

type AttackAttackMode

type AttackAttackMode string

AttackAttackMode Attack mode name

const (
	Dictionary       AttackAttackMode = "dictionary"
	HybridDictionary AttackAttackMode = "hybrid_dictionary"
	HybridMask       AttackAttackMode = "hybrid_mask"
	Mask             AttackAttackMode = "mask"
)

Defines values for AttackAttackMode.

type AttackResourceFile

type AttackResourceFile struct {
	// Checksum The MD5 checksum of the resource file
	Checksum []byte `json:"checksum"`

	// DownloadUrl The download URL of the resource file
	DownloadUrl string `json:"download_url"`

	// FileName The name of the resource file
	FileName string `json:"file_name"`

	// Id The id of the resource file
	Id int64 `json:"id"`
}

AttackResourceFile A downloadable resource file (word list, rule list, or mask list) used by an attack

type AttacksClient

type AttacksClient interface {
	// GetAttack retrieves attack parameters by ID.
	GetAttack(ctx context.Context, id int64) (*GetAttackResponse, error)

	// GetHashList retrieves the hash list for an attack.
	GetHashList(ctx context.Context, id int64) (*GetHashListResponse, error)
}

AttacksClient defines the interface for attack-related API operations.

type AuthClient

type AuthClient interface {
	// Authenticate verifies agent credentials with the server.
	Authenticate(ctx context.Context) (*AuthenticateResponse, error)

	// GetConfiguration retrieves agent configuration from the server.
	GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)
}

AuthClient defines the interface for authentication-related API operations.

type AuthenticateResponse

type AuthenticateResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		AgentId       int64 `json:"agent_id"`
		Authenticated bool  `json:"authenticated"`
	}
	JSON401 *ErrorObject
}

func ParseAuthenticateResponse

func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error)

ParseAuthenticateResponse parses an HTTP response from a AuthenticateWithResponse call

func (AuthenticateResponse) Status

func (r AuthenticateResponse) Status() string

Status returns HTTPResponse.Status

func (AuthenticateResponse) StatusCode

func (r AuthenticateResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetAgent

func (c *Client) GetAgent(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetAttack

func (c *Client) GetAttack(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetConfiguration

func (c *Client) GetConfiguration(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetHashList

func (c *Client) GetHashList(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetNewTask

func (c *Client) GetNewTask(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetTaskZaps

func (c *Client) GetTaskZaps(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendCrack

func (c *Client) SendCrack(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendCrackWithBody

func (c *Client) SendCrackWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendHeartbeat

func (c *Client) SendHeartbeat(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendHeartbeatWithBody

func (c *Client) SendHeartbeatWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendStatus

func (c *Client) SendStatus(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendStatusWithBody

func (c *Client) SendStatusWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetAgentShutdown

func (c *Client) SetAgentShutdown(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetTaskAbandoned

func (c *Client) SetTaskAbandoned(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetTaskAccepted

func (c *Client) SetTaskAccepted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetTaskExhausted

func (c *Client) SetTaskExhausted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitBenchmark

func (c *Client) SubmitBenchmark(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitBenchmarkWithBody

func (c *Client) SubmitBenchmarkWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitErrorAgent

func (c *Client) SubmitErrorAgent(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitErrorAgentWithBody

func (c *Client) SubmitErrorAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateAgent

func (c *Client) UpdateAgent(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateAgentWithBody

func (c *Client) UpdateAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetAgent request
	GetAgent(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpdateAgentWithBody request with any body
	UpdateAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpdateAgent(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendHeartbeatWithBody request with any body
	SendHeartbeatWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendHeartbeat(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetAgentShutdown request
	SetAgentShutdown(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SubmitBenchmarkWithBody request with any body
	SubmitBenchmarkWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SubmitBenchmark(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SubmitErrorAgentWithBody request with any body
	SubmitErrorAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SubmitErrorAgent(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetAttack request
	GetAttack(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetHashList request
	GetHashList(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// Authenticate request
	Authenticate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetConfiguration request
	GetConfiguration(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetNewTask request
	GetNewTask(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTask request
	GetTask(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetTaskAbandoned request
	SetTaskAbandoned(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetTaskAccepted request
	SetTaskAccepted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetTaskExhausted request
	SetTaskExhausted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTaskZaps request
	GetTaskZaps(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendCrackWithBody request with any body
	SendCrackWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendCrack(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendStatusWithBody request with any body
	SendStatusWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendStatus(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) AuthenticateWithResponse

func (c *ClientWithResponses) AuthenticateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error)

AuthenticateWithResponse request returning *AuthenticateResponse

func (*ClientWithResponses) GetAgentWithResponse

func (c *ClientWithResponses) GetAgentWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAgentResponse, error)

GetAgentWithResponse request returning *GetAgentResponse

func (*ClientWithResponses) GetAttackWithResponse

func (c *ClientWithResponses) GetAttackWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAttackResponse, error)

GetAttackWithResponse request returning *GetAttackResponse

func (*ClientWithResponses) GetConfigurationWithResponse

func (c *ClientWithResponses) GetConfigurationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigurationResponse, error)

GetConfigurationWithResponse request returning *GetConfigurationResponse

func (*ClientWithResponses) GetHashListWithResponse

func (c *ClientWithResponses) GetHashListWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetHashListResponse, error)

GetHashListWithResponse request returning *GetHashListResponse

func (*ClientWithResponses) GetNewTaskWithResponse

func (c *ClientWithResponses) GetNewTaskWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNewTaskResponse, error)

GetNewTaskWithResponse request returning *GetNewTaskResponse

func (*ClientWithResponses) GetTaskWithResponse

func (c *ClientWithResponses) GetTaskWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskResponse, error)

GetTaskWithResponse request returning *GetTaskResponse

func (*ClientWithResponses) GetTaskZapsWithResponse

func (c *ClientWithResponses) GetTaskZapsWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskZapsResponse, error)

GetTaskZapsWithResponse request returning *GetTaskZapsResponse

func (*ClientWithResponses) SendCrackWithBodyWithResponse

func (c *ClientWithResponses) SendCrackWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

SendCrackWithBodyWithResponse request with arbitrary body returning *SendCrackResponse

func (*ClientWithResponses) SendCrackWithResponse

func (c *ClientWithResponses) SendCrackWithResponse(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

func (*ClientWithResponses) SendHeartbeatWithBodyWithResponse

func (c *ClientWithResponses) SendHeartbeatWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

SendHeartbeatWithBodyWithResponse request with arbitrary body returning *SendHeartbeatResponse

func (*ClientWithResponses) SendHeartbeatWithResponse

func (c *ClientWithResponses) SendHeartbeatWithResponse(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

func (*ClientWithResponses) SendStatusWithBodyWithResponse

func (c *ClientWithResponses) SendStatusWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)

SendStatusWithBodyWithResponse request with arbitrary body returning *SendStatusResponse

func (*ClientWithResponses) SendStatusWithResponse

func (c *ClientWithResponses) SendStatusWithResponse(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)

func (*ClientWithResponses) SetAgentShutdownWithResponse

func (c *ClientWithResponses) SetAgentShutdownWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetAgentShutdownResponse, error)

SetAgentShutdownWithResponse request returning *SetAgentShutdownResponse

func (*ClientWithResponses) SetTaskAbandonedWithResponse

func (c *ClientWithResponses) SetTaskAbandonedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAbandonedResponse, error)

SetTaskAbandonedWithResponse request returning *SetTaskAbandonedResponse

func (*ClientWithResponses) SetTaskAcceptedWithResponse

func (c *ClientWithResponses) SetTaskAcceptedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAcceptedResponse, error)

SetTaskAcceptedWithResponse request returning *SetTaskAcceptedResponse

func (*ClientWithResponses) SetTaskExhaustedWithResponse

func (c *ClientWithResponses) SetTaskExhaustedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskExhaustedResponse, error)

SetTaskExhaustedWithResponse request returning *SetTaskExhaustedResponse

func (*ClientWithResponses) SubmitBenchmarkWithBodyWithResponse

func (c *ClientWithResponses) SubmitBenchmarkWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

SubmitBenchmarkWithBodyWithResponse request with arbitrary body returning *SubmitBenchmarkResponse

func (*ClientWithResponses) SubmitBenchmarkWithResponse

func (c *ClientWithResponses) SubmitBenchmarkWithResponse(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

func (*ClientWithResponses) SubmitErrorAgentWithBodyWithResponse

func (c *ClientWithResponses) SubmitErrorAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

SubmitErrorAgentWithBodyWithResponse request with arbitrary body returning *SubmitErrorAgentResponse

func (*ClientWithResponses) SubmitErrorAgentWithResponse

func (c *ClientWithResponses) SubmitErrorAgentWithResponse(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

func (*ClientWithResponses) UpdateAgentWithBodyWithResponse

func (c *ClientWithResponses) UpdateAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

UpdateAgentWithBodyWithResponse request with arbitrary body returning *UpdateAgentResponse

func (*ClientWithResponses) UpdateAgentWithResponse

func (c *ClientWithResponses) UpdateAgentWithResponse(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetAgentWithResponse request
	GetAgentWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAgentResponse, error)

	// UpdateAgentWithBodyWithResponse request with any body
	UpdateAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

	UpdateAgentWithResponse(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

	// SendHeartbeatWithBodyWithResponse request with any body
	SendHeartbeatWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

	SendHeartbeatWithResponse(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

	// SetAgentShutdownWithResponse request
	SetAgentShutdownWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetAgentShutdownResponse, error)

	// SubmitBenchmarkWithBodyWithResponse request with any body
	SubmitBenchmarkWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

	SubmitBenchmarkWithResponse(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

	// SubmitErrorAgentWithBodyWithResponse request with any body
	SubmitErrorAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

	SubmitErrorAgentWithResponse(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

	// GetAttackWithResponse request
	GetAttackWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAttackResponse, error)

	// GetHashListWithResponse request
	GetHashListWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetHashListResponse, error)

	// AuthenticateWithResponse request
	AuthenticateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error)

	// GetConfigurationWithResponse request
	GetConfigurationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigurationResponse, error)

	// GetNewTaskWithResponse request
	GetNewTaskWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNewTaskResponse, error)

	// GetTaskWithResponse request
	GetTaskWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskResponse, error)

	// SetTaskAbandonedWithResponse request
	SetTaskAbandonedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAbandonedResponse, error)

	// SetTaskAcceptedWithResponse request
	SetTaskAcceptedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAcceptedResponse, error)

	// SetTaskExhaustedWithResponse request
	SetTaskExhaustedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskExhaustedResponse, error)

	// GetTaskZapsWithResponse request
	GetTaskZapsWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskZapsResponse, error)

	// SendCrackWithBodyWithResponse request with any body
	SendCrackWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

	SendCrackWithResponse(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

	// SendStatusWithBodyWithResponse request with any body
	SendStatusWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)

	SendStatusWithResponse(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type DeviceStatus

type DeviceStatus struct {
	// DeviceId The id of the device
	DeviceId int `json:"device_id"`

	// DeviceName The name of the device
	DeviceName string `json:"device_name"`

	// DeviceType The type of the device
	DeviceType DeviceStatusDeviceType `json:"device_type"`

	// Speed The speed of the device
	Speed int64 `json:"speed"`

	// Temperature The temperature of the device, or -1 if unmonitored.
	Temperature int `json:"temperature"`

	// Utilization The utilization of the device
	Utilization int `json:"utilization"`
}

DeviceStatus Status and performance metrics for a single GPU or CPU device

type DeviceStatusDeviceType

type DeviceStatusDeviceType string

DeviceStatusDeviceType The type of the device

const (
	CPU DeviceStatusDeviceType = "CPU"
	GPU DeviceStatusDeviceType = "GPU"
)

Defines values for DeviceStatusDeviceType.

type ErrorObject

type ErrorObject struct {
	Err                  string         `json:"error"`
	AdditionalProperties map[string]any `json:"-"`
}

ErrorObject represents an API error object with an "error" JSON field. It implements the error interface and maps to the OpenAPI ErrorObject schema. The generated ErrorObject schema is excluded from client.gen.go (via exclude-schemas in config.yaml) because a struct field named "Error" conflicts with the Error() method required by the error interface. The Err field is serialized as "error" in JSON to match the API contract.

func (*ErrorObject) Error

func (e *ErrorObject) Error() string

Error implements the error interface, returning the error message.

func (*ErrorObject) Get

func (e *ErrorObject) Get(fieldName string) (any, bool)

Get returns the specified additional property and whether it was found.

func (*ErrorObject) MarshalJSON

func (e *ErrorObject) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling to handle AdditionalProperties.

func (*ErrorObject) Set

func (e *ErrorObject) Set(fieldName string, value any)

Set sets the specified additional property.

func (*ErrorObject) UnmarshalJSON

func (e *ErrorObject) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom JSON unmarshaling to handle AdditionalProperties.

type GetAgentResponse

type GetAgentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Agent
	JSON401      *ErrorObject
}

func ParseGetAgentResponse

func ParseGetAgentResponse(rsp *http.Response) (*GetAgentResponse, error)

ParseGetAgentResponse parses an HTTP response from a GetAgentWithResponse call

func (GetAgentResponse) Status

func (r GetAgentResponse) Status() string

Status returns HTTPResponse.Status

func (GetAgentResponse) StatusCode

func (r GetAgentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetAttackResponse

type GetAttackResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Attack
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseGetAttackResponse

func ParseGetAttackResponse(rsp *http.Response) (*GetAttackResponse, error)

ParseGetAttackResponse parses an HTTP response from a GetAttackWithResponse call

func (GetAttackResponse) Status

func (r GetAttackResponse) Status() string

Status returns HTTPResponse.Status

func (GetAttackResponse) StatusCode

func (r GetAttackResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetConfigurationResponse

type GetConfigurationResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		// ApiVersion The minimum accepted version of the API
		ApiVersion int `json:"api_version"`

		// BenchmarksNeeded Whether the agent needs to run benchmarks. False when the server already has valid benchmarks for this agent.
		BenchmarksNeeded bool `json:"benchmarks_needed"`

		// Config Advanced hashcat and agent configuration options
		Config AdvancedAgentConfiguration `json:"config"`
	}
	JSON401 *ErrorObject
}

func ParseGetConfigurationResponse

func ParseGetConfigurationResponse(rsp *http.Response) (*GetConfigurationResponse, error)

ParseGetConfigurationResponse parses an HTTP response from a GetConfigurationWithResponse call

func (GetConfigurationResponse) Status

func (r GetConfigurationResponse) Status() string

Status returns HTTPResponse.Status

func (GetConfigurationResponse) StatusCode

func (r GetConfigurationResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHashListResponse

type GetHashListResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseGetHashListResponse

func ParseGetHashListResponse(rsp *http.Response) (*GetHashListResponse, error)

ParseGetHashListResponse parses an HTTP response from a GetHashListWithResponse call

func (GetHashListResponse) Status

func (r GetHashListResponse) Status() string

Status returns HTTPResponse.Status

func (GetHashListResponse) StatusCode

func (r GetHashListResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetNewTaskResponse

type GetNewTaskResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Task
	JSON401      *ErrorObject
}

func ParseGetNewTaskResponse

func ParseGetNewTaskResponse(rsp *http.Response) (*GetNewTaskResponse, error)

ParseGetNewTaskResponse parses an HTTP response from a GetNewTaskWithResponse call

func (GetNewTaskResponse) Status

func (r GetNewTaskResponse) Status() string

Status returns HTTPResponse.Status

func (GetNewTaskResponse) StatusCode

func (r GetNewTaskResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTaskResponse

type GetTaskResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Task
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseGetTaskResponse

func ParseGetTaskResponse(rsp *http.Response) (*GetTaskResponse, error)

ParseGetTaskResponse parses an HTTP response from a GetTaskWithResponse call

func (GetTaskResponse) Status

func (r GetTaskResponse) Status() string

Status returns HTTPResponse.Status

func (GetTaskResponse) StatusCode

func (r GetTaskResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTaskZapsResponse

type GetTaskZapsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseGetTaskZapsResponse

func ParseGetTaskZapsResponse(rsp *http.Response) (*GetTaskZapsResponse, error)

ParseGetTaskZapsResponse parses an HTTP response from a GetTaskZapsWithResponse call

func (GetTaskZapsResponse) Status

func (r GetTaskZapsResponse) Status() string

Status returns HTTPResponse.Status

func (GetTaskZapsResponse) StatusCode

func (r GetTaskZapsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HashcatBenchmark

type HashcatBenchmark struct {
	// Device The device used for the benchmark
	Device int `json:"device"`

	// HashSpeed The speed of the benchmark in hashes per second.
	HashSpeed float64 `json:"hash_speed"`

	// HashType The hashcat hash type
	HashType int `json:"hash_type"`

	// Runtime The runtime of the benchmark in milliseconds.
	Runtime int64 `json:"runtime"`
}

HashcatBenchmark A single hashcat benchmark result for a specific hash type and device

type HashcatGuess

type HashcatGuess struct {
	// GuessBase The base value used for the guess (for example, the mask)
	GuessBase string `json:"guess_base"`

	// GuessBaseCount The number of times the base value was used
	GuessBaseCount int64 `json:"guess_base_count"`

	// GuessBaseOffset The offset of the base value
	GuessBaseOffset int64 `json:"guess_base_offset"`

	// GuessBasePercentage The percentage completion of the base value
	GuessBasePercentage float64 `json:"guess_base_percentage"`

	// GuessMod The modifier used for the guess (for example, the wordlist)
	GuessMod string `json:"guess_mod"`

	// GuessModCount The number of times the modifier was used
	GuessModCount int64 `json:"guess_mod_count"`

	// GuessModOffset The offset of the modifier
	GuessModOffset int64 `json:"guess_mod_offset"`

	// GuessModPercentage The percentage completion of the modifier
	GuessModPercentage float64 `json:"guess_mod_percentage"`

	// GuessMode The mode used for the guess
	GuessMode int `json:"guess_mode"`
}

HashcatGuess Current hashcat guess progress including base and modifier values

type HashcatResult

type HashcatResult struct {
	// Hash The hash value
	Hash string `json:"hash"`

	// PlainText The plain text value
	PlainText string `json:"plain_text"`

	// Timestamp The time the hash was cracked
	Timestamp time.Time `json:"timestamp"`
}

HashcatResult A cracked hash result submitted by an agent

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type MockAgentsClient

type MockAgentsClient struct {
	SendHeartbeatFunc    func(ctx context.Context, id int64, activity string) (*SendHeartbeatResponse, error)
	UpdateAgentFunc      func(ctx context.Context, id int64, body UpdateAgentJSONRequestBody) (*UpdateAgentResponse, error)
	SubmitBenchmarkFunc  func(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody) (*SubmitBenchmarkResponse, error)
	SubmitErrorAgentFunc func(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody) (*SubmitErrorAgentResponse, error)
	SetAgentShutdownFunc func(ctx context.Context, id int64) (*SetAgentShutdownResponse, error)
}

MockAgentsClient is a configurable mock for AgentsClient.

func (*MockAgentsClient) SendHeartbeat

func (m *MockAgentsClient) SendHeartbeat(
	ctx context.Context,
	id int64,
	activity string,
) (*SendHeartbeatResponse, error)

SendHeartbeat calls the configured function or returns an error if not configured.

func (*MockAgentsClient) SetAgentShutdown

func (m *MockAgentsClient) SetAgentShutdown(
	ctx context.Context,
	id int64,
) (*SetAgentShutdownResponse, error)

SetAgentShutdown calls the configured function or returns an error if not configured.

func (*MockAgentsClient) SubmitBenchmark

SubmitBenchmark calls the configured function or returns an error if not configured.

func (*MockAgentsClient) SubmitErrorAgent

SubmitErrorAgent calls the configured function or returns an error if not configured.

func (*MockAgentsClient) UpdateAgent

UpdateAgent calls the configured function or returns an error if not configured.

type MockAttacksClient

type MockAttacksClient struct {
	GetAttackFunc   func(ctx context.Context, id int64) (*GetAttackResponse, error)
	GetHashListFunc func(ctx context.Context, id int64) (*GetHashListResponse, error)
}

MockAttacksClient is a configurable mock for AttacksClient.

func (*MockAttacksClient) GetAttack

func (m *MockAttacksClient) GetAttack(ctx context.Context, id int64) (*GetAttackResponse, error)

GetAttack calls the configured function or returns an error if not configured.

func (*MockAttacksClient) GetHashList

func (m *MockAttacksClient) GetHashList(ctx context.Context, id int64) (*GetHashListResponse, error)

GetHashList calls the configured function or returns an error if not configured.

type MockAuthClient

type MockAuthClient struct {
	AuthenticateFunc     func(ctx context.Context) (*AuthenticateResponse, error)
	GetConfigurationFunc func(ctx context.Context) (*GetConfigurationResponse, error)
}

MockAuthClient is a configurable mock for AuthClient.

func (*MockAuthClient) Authenticate

func (m *MockAuthClient) Authenticate(ctx context.Context) (*AuthenticateResponse, error)

Authenticate calls the configured function or returns an error if not configured.

func (*MockAuthClient) GetConfiguration

func (m *MockAuthClient) GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)

GetConfiguration calls the configured function or returns an error if not configured.

type MockClient

type MockClient struct {
	TasksImpl   TasksClient
	AttacksImpl AttacksClient
	AgentsImpl  AgentsClient
	AuthImpl    AuthClient
}

MockClient is a test double for the APIClient interface. Each subsystem client can be configured independently.

func (*MockClient) Agents

func (m *MockClient) Agents() AgentsClient

Agents returns the configured AgentsClient, or an unconfigured mock that returns descriptive errors.

func (*MockClient) Attacks

func (m *MockClient) Attacks() AttacksClient

Attacks returns the configured AttacksClient, or an unconfigured mock that returns descriptive errors.

func (*MockClient) Auth

func (m *MockClient) Auth() AuthClient

Auth returns the configured AuthClient, or an unconfigured mock that returns descriptive errors.

func (*MockClient) Tasks

func (m *MockClient) Tasks() TasksClient

Tasks returns the configured TasksClient, or an unconfigured mock that returns descriptive errors.

type MockTasksClient

type MockTasksClient struct {
	GetNewTaskFunc       func(ctx context.Context) (*GetNewTaskResponse, error)
	SetTaskAcceptedFunc  func(ctx context.Context, id int64) (*SetTaskAcceptedResponse, error)
	SetTaskExhaustedFunc func(ctx context.Context, id int64) (*SetTaskExhaustedResponse, error)
	SetTaskAbandonedFunc func(ctx context.Context, id int64) (*SetTaskAbandonedResponse, error)
	SendStatusFunc       func(ctx context.Context, id int64, status TaskStatus) (*SendStatusResponse, error)
	SendCrackFunc        func(ctx context.Context, id int64, result HashcatResult) (*SendCrackResponse, error)
	GetTaskZapsFunc      func(ctx context.Context, id int64) (*GetTaskZapsResponse, error)
}

MockTasksClient is a configurable mock for TasksClient. Set the function fields to control mock behavior.

func (*MockTasksClient) GetNewTask

func (m *MockTasksClient) GetNewTask(ctx context.Context) (*GetNewTaskResponse, error)

GetNewTask calls the configured function or returns an error if not configured.

func (*MockTasksClient) GetTaskZaps

func (m *MockTasksClient) GetTaskZaps(ctx context.Context, id int64) (*GetTaskZapsResponse, error)

GetTaskZaps calls the configured function or returns an error if not configured.

func (*MockTasksClient) SendCrack

func (m *MockTasksClient) SendCrack(
	ctx context.Context,
	id int64,
	result HashcatResult,
) (*SendCrackResponse, error)

SendCrack calls the configured function or returns an error if not configured.

func (*MockTasksClient) SendStatus

func (m *MockTasksClient) SendStatus(
	ctx context.Context,
	id int64,
	status TaskStatus,
) (*SendStatusResponse, error)

SendStatus calls the configured function or returns an error if not configured.

func (*MockTasksClient) SetTaskAbandoned

func (m *MockTasksClient) SetTaskAbandoned(
	ctx context.Context,
	id int64,
) (*SetTaskAbandonedResponse, error)

SetTaskAbandoned calls the configured function or returns an error if not configured.

func (*MockTasksClient) SetTaskAccepted

func (m *MockTasksClient) SetTaskAccepted(ctx context.Context, id int64) (*SetTaskAcceptedResponse, error)

SetTaskAccepted calls the configured function or returns an error if not configured.

func (*MockTasksClient) SetTaskExhausted

func (m *MockTasksClient) SetTaskExhausted(
	ctx context.Context,
	id int64,
) (*SetTaskExhaustedResponse, error)

SetTaskExhausted calls the configured function or returns an error if not configured.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SendCrackJSONRequestBody

type SendCrackJSONRequestBody = HashcatResult

SendCrackJSONRequestBody defines body for SendCrack for application/json ContentType.

type SendCrackResponse

type SendCrackResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON404      *ErrorObject
}

func ParseSendCrackResponse

func ParseSendCrackResponse(rsp *http.Response) (*SendCrackResponse, error)

ParseSendCrackResponse parses an HTTP response from a SendCrackWithResponse call

func (SendCrackResponse) Status

func (r SendCrackResponse) Status() string

Status returns HTTPResponse.Status

func (SendCrackResponse) StatusCode

func (r SendCrackResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SendHeartbeat200State

type SendHeartbeat200State string
const (
	// StateActive indicates the agent is ready to accept tasks.
	StateActive SendHeartbeat200State = "active"
	// StateError indicates the agent has encountered an error.
	StateError SendHeartbeat200State = "error"
	// StateOffline indicates the agent has not checked in recently.
	StateOffline SendHeartbeat200State = "offline"
	// StatePending indicates the agent needs to perform setup again.
	StatePending SendHeartbeat200State = "pending"
	// StateStopped indicates the agent has been stopped by the user.
	StateStopped SendHeartbeat200State = "stopped"
)

SendHeartbeat200State constants for heartbeat response state values. The generated code defines the type but not constants.

type SendHeartbeatJSONBody

type SendHeartbeatJSONBody struct {
	// Activity Current agent activity state. Known values: starting, benchmarking, updating, downloading, waiting, cracking, stopping. Future versions may support additional values.
	Activity *string `json:"activity"`
}

SendHeartbeatJSONBody defines parameters for SendHeartbeat.

type SendHeartbeatJSONRequestBody

type SendHeartbeatJSONRequestBody SendHeartbeatJSONBody

SendHeartbeatJSONRequestBody defines body for SendHeartbeat for application/json ContentType.

type SendHeartbeatResponse

type SendHeartbeatResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		// State The state of the agent:
		//                        * `pending` - The agent needs to perform the setup process again.
		//                        * `active` - The agent is ready to accept tasks, all is good.
		//                        * `error` - The agent has encountered an error and needs to be checked.
		//                        * `stopped` - The agent has been stopped by the user.
		//                        * `offline` - The agent has not checked in recently and is considered offline.
		State SendHeartbeat200State `json:"state"`
	}
	JSON401 *ErrorObject
}

func ParseSendHeartbeatResponse

func ParseSendHeartbeatResponse(rsp *http.Response) (*SendHeartbeatResponse, error)

ParseSendHeartbeatResponse parses an HTTP response from a SendHeartbeatWithResponse call

func (SendHeartbeatResponse) Status

func (r SendHeartbeatResponse) Status() string

Status returns HTTPResponse.Status

func (SendHeartbeatResponse) StatusCode

func (r SendHeartbeatResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SendStatusJSONRequestBody

type SendStatusJSONRequestBody = TaskStatus

SendStatusJSONRequestBody defines body for SendStatus for application/json ContentType.

type SendStatusResponse

type SendStatusResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON422      *ErrorObject
}

func ParseSendStatusResponse

func ParseSendStatusResponse(rsp *http.Response) (*SendStatusResponse, error)

ParseSendStatusResponse parses an HTTP response from a SendStatusWithResponse call

func (SendStatusResponse) Status

func (r SendStatusResponse) Status() string

Status returns HTTPResponse.Status

func (SendStatusResponse) StatusCode

func (r SendStatusResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetAgentShutdownResponse

type SetAgentShutdownResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
}

func ParseSetAgentShutdownResponse

func ParseSetAgentShutdownResponse(rsp *http.Response) (*SetAgentShutdownResponse, error)

ParseSetAgentShutdownResponse parses an HTTP response from a SetAgentShutdownWithResponse call

func (SetAgentShutdownResponse) Status

func (r SetAgentShutdownResponse) Status() string

Status returns HTTPResponse.Status

func (SetAgentShutdownResponse) StatusCode

func (r SetAgentShutdownResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetTaskAbandonedError

type SetTaskAbandonedError struct {
	Details []string `json:"details"`
	Error_  *string  `json:"error"` //nolint:revive // underscore avoids collision with Error() method
}

SetTaskAbandonedError represents a 422 error when abandoning a task. It maps to the 422 response schema for the SetTaskAbandoned endpoint.

func (*SetTaskAbandonedError) Error

func (e *SetTaskAbandonedError) Error() string

Error returns a JSON representation of the error. Falls back to a descriptive string if JSON marshaling fails.

type SetTaskAbandonedResponse

type SetTaskAbandonedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		State   *string `json:"state,omitempty"`
		Success *bool   `json:"success,omitempty"`
	}
	JSON401 *ErrorObject
	JSON404 *ErrorObject
	JSON422 *struct {
		Details *[]string `json:"details,omitempty"`
		Error   *string   `json:"error,omitempty"`
	}
}

func ParseSetTaskAbandonedResponse

func ParseSetTaskAbandonedResponse(rsp *http.Response) (*SetTaskAbandonedResponse, error)

ParseSetTaskAbandonedResponse parses an HTTP response from a SetTaskAbandonedWithResponse call

func (SetTaskAbandonedResponse) Status

func (r SetTaskAbandonedResponse) Status() string

Status returns HTTPResponse.Status

func (SetTaskAbandonedResponse) StatusCode

func (r SetTaskAbandonedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetTaskAcceptedResponse

type SetTaskAcceptedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON404      *ErrorObject
	JSON422      *ErrorObject
}

func ParseSetTaskAcceptedResponse

func ParseSetTaskAcceptedResponse(rsp *http.Response) (*SetTaskAcceptedResponse, error)

ParseSetTaskAcceptedResponse parses an HTTP response from a SetTaskAcceptedWithResponse call

func (SetTaskAcceptedResponse) Status

func (r SetTaskAcceptedResponse) Status() string

Status returns HTTPResponse.Status

func (SetTaskAcceptedResponse) StatusCode

func (r SetTaskAcceptedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetTaskExhaustedResponse

type SetTaskExhaustedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseSetTaskExhaustedResponse

func ParseSetTaskExhaustedResponse(rsp *http.Response) (*SetTaskExhaustedResponse, error)

ParseSetTaskExhaustedResponse parses an HTTP response from a SetTaskExhaustedWithResponse call

func (SetTaskExhaustedResponse) Status

func (r SetTaskExhaustedResponse) Status() string

Status returns HTTPResponse.Status

func (SetTaskExhaustedResponse) StatusCode

func (r SetTaskExhaustedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Severity

Severity is a type alias for the generated SubmitErrorAgentJSONBodySeverity. This provides named constants for error severity levels.

const (
	SeverityCritical Severity = Critical
	SeverityWarning  Severity = Warning
	SeverityInfo     Severity = Info
	SeverityMajor    Severity = Major
	SeverityMinor    Severity = Minor
	SeverityFatal    Severity = Fatal
)

Severity levels for error reporting.

type SubmitBenchmarkJSONBody

type SubmitBenchmarkJSONBody struct {
	HashcatBenchmarks []HashcatBenchmark `json:"hashcat_benchmarks"`
}

SubmitBenchmarkJSONBody defines parameters for SubmitBenchmark.

type SubmitBenchmarkJSONRequestBody

type SubmitBenchmarkJSONRequestBody SubmitBenchmarkJSONBody

SubmitBenchmarkJSONRequestBody defines body for SubmitBenchmark for application/json ContentType.

type SubmitBenchmarkResponse

type SubmitBenchmarkResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON400      *ErrorObject
	JSON401      *ErrorObject
}

func ParseSubmitBenchmarkResponse

func ParseSubmitBenchmarkResponse(rsp *http.Response) (*SubmitBenchmarkResponse, error)

ParseSubmitBenchmarkResponse parses an HTTP response from a SubmitBenchmarkWithResponse call

func (SubmitBenchmarkResponse) Status

func (r SubmitBenchmarkResponse) Status() string

Status returns HTTPResponse.Status

func (SubmitBenchmarkResponse) StatusCode

func (r SubmitBenchmarkResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SubmitErrorAgentJSONBody

type SubmitErrorAgentJSONBody struct {
	// AgentId The agent that caused the error
	AgentId int64 `json:"agent_id"`

	// Message The error message
	Message string `json:"message"`

	// Metadata Additional metadata about the error
	Metadata *struct {
		// ErrorDate The date of the error
		ErrorDate time.Time `json:"error_date"`

		// Other Other metadata
		Other *map[string]interface{} `json:"other"`
	} `json:"metadata"`

	// Severity The severity of the error:
	//                        * `info` - Informational message, no action required.
	//                        * `warning` - Non-critical error, no action required. Anticipated, but not necessarily problematic.
	//                        * `minor` - Minor error, no action required. Should be investigated, but the task can continue.
	//                        * `major` - Major error, action required. The task should be investigated and possibly restarted.
	//                        * `critical` - Critical error, action required. The task should be stopped and investigated.
	//                         * `fatal` - Fatal error, action required. The agent cannot continue with the task and should not be reattempted.
	Severity SubmitErrorAgentJSONBodySeverity `json:"severity"`

	// TaskId The task that caused the error, if any
	TaskId *int64 `json:"task_id"`
}

SubmitErrorAgentJSONBody defines parameters for SubmitErrorAgent.

type SubmitErrorAgentJSONBodySeverity

type SubmitErrorAgentJSONBodySeverity string

SubmitErrorAgentJSONBodySeverity defines parameters for SubmitErrorAgent.

Defines values for SubmitErrorAgentJSONBodySeverity.

type SubmitErrorAgentJSONRequestBody

type SubmitErrorAgentJSONRequestBody SubmitErrorAgentJSONBody

SubmitErrorAgentJSONRequestBody defines body for SubmitErrorAgent for application/json ContentType.

type SubmitErrorAgentResponse

type SubmitErrorAgentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
}

func ParseSubmitErrorAgentResponse

func ParseSubmitErrorAgentResponse(rsp *http.Response) (*SubmitErrorAgentResponse, error)

ParseSubmitErrorAgentResponse parses an HTTP response from a SubmitErrorAgentWithResponse call

func (SubmitErrorAgentResponse) Status

func (r SubmitErrorAgentResponse) Status() string

Status returns HTTPResponse.Status

func (SubmitErrorAgentResponse) StatusCode

func (r SubmitErrorAgentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Task

type Task struct {
	// AttackId The id of the attack
	AttackId int64 `json:"attack_id"`

	// Id The id of the task
	Id int64 `json:"id"`

	// Limit The limit of the keyspace
	Limit *int64 `json:"limit"`

	// Skip The offset of the keyspace
	Skip *int64 `json:"skip"`

	// StartDate The time the task was started
	StartDate time.Time `json:"start_date"`

	// Status The status of the task
	Status string `json:"status"`
}

Task A unit of work assigned to an agent for a specific attack

type TaskStatus

type TaskStatus struct {
	// DeviceStatuses The status of the devices used for the task
	DeviceStatuses []DeviceStatus `json:"device_statuses"`

	// EstimatedStop The estimated time of completion.
	EstimatedStop time.Time `json:"estimated_stop"`

	// HashcatGuess Current hashcat guess progress including base and modifier values
	HashcatGuess HashcatGuess `json:"hashcat_guess"`

	// OriginalLine The original line from hashcat
	OriginalLine string `json:"original_line"`

	// Progress The progress of the task
	Progress []int64 `json:"progress"`

	// RecoveredHashes The number of recovered hashes
	RecoveredHashes []int `json:"recovered_hashes"`

	// RecoveredSalts The number of recovered salts
	RecoveredSalts []int `json:"recovered_salts"`

	// Rejected The number of rejected guesses
	Rejected int64 `json:"rejected"`

	// RestorePoint The restore point of the task
	RestorePoint int64 `json:"restore_point"`

	// Session The session name
	Session string `json:"session"`

	// Status The status of the task
	Status int `json:"status"`

	// Target The target of the task
	Target string `json:"target"`

	// Time The time the status was received
	Time time.Time `json:"time"`

	// TimeStart The time the task started.
	TimeStart time.Time `json:"time_start"`
}

TaskStatus A hashcat status update submitted by an agent during task execution

type TasksClient

type TasksClient interface {
	// GetNewTask retrieves a new task from the server.
	GetNewTask(ctx context.Context) (*GetNewTaskResponse, error)

	// SetTaskAccepted marks a task as accepted.
	SetTaskAccepted(ctx context.Context, id int64) (*SetTaskAcceptedResponse, error)

	// SetTaskExhausted marks a task as exhausted (keyspace fully searched).
	SetTaskExhausted(ctx context.Context, id int64) (*SetTaskExhaustedResponse, error)

	// SetTaskAbandoned marks a task as abandoned.
	SetTaskAbandoned(ctx context.Context, id int64) (*SetTaskAbandonedResponse, error)

	// SendStatus sends a status update for a running task.
	SendStatus(ctx context.Context, id int64, status TaskStatus) (*SendStatusResponse, error)

	// SendCrack sends a cracked hash result.
	SendCrack(ctx context.Context, id int64, result HashcatResult) (*SendCrackResponse, error)

	// GetTaskZaps retrieves previously cracked hashes for a task.
	GetTaskZaps(ctx context.Context, id int64) (*GetTaskZapsResponse, error)
}

TasksClient defines the interface for task-related API operations. This enables mocking in tests and decouples code from the concrete API client implementation.

type UpdateAgentJSONBody

type UpdateAgentJSONBody struct {
	// ClientSignature The signature of the client
	ClientSignature string   `json:"client_signature"`
	Devices         []string `json:"devices"`

	// HostName The hostname of the agent
	HostName string `json:"host_name"`

	// Id The id of the agent
	Id int64 `json:"id"`

	// OperatingSystem The operating system of the agent
	OperatingSystem string `json:"operating_system"`
}

UpdateAgentJSONBody defines parameters for UpdateAgent.

type UpdateAgentJSONRequestBody

type UpdateAgentJSONRequestBody UpdateAgentJSONBody

UpdateAgentJSONRequestBody defines body for UpdateAgent for application/json ContentType.

type UpdateAgentResponse

type UpdateAgentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Agent
	JSON401      *ErrorObject
}

func ParseUpdateAgentResponse

func ParseUpdateAgentResponse(rsp *http.Response) (*UpdateAgentResponse, error)

ParseUpdateAgentResponse parses an HTTP response from a UpdateAgentWithResponse call

func (UpdateAgentResponse) Status

func (r UpdateAgentResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateAgentResponse) StatusCode

func (r UpdateAgentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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