Skip to content

Latest commit

 

History

History
339 lines (257 loc) · 17 KB

File metadata and controls

339 lines (257 loc) · 17 KB

Agents

(Agents)

Overview

Agents API

Available Operations

GetAgent

Returns an agent

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Agents.GetAgent(ctx, 135003)
    if err != nil {
        log.Fatal(err)
    }
    if res.Agent != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id int64 ✔️ id
opts []operations.Option The options for this request.

Response

*operations.GetAgentResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

UpdateAgent

Updates an agent

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"github.com/unclesp1d3r/cipherswarm-agent-sdk-go/models/operations"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Agents.UpdateAgent(ctx, 828119, &operations.UpdateAgentRequestBody{
        ID: 2573,
        HostName: "stoltenberg",
        ClientSignature: "Linux, RHEL 6.10",
        OperatingSystem: "linux",
        Devices: []string{
            "cpu",
            "GPU",
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Agent != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id int64 ✔️ id
requestBody *operations.UpdateAgentRequestBody N/A
opts []operations.Option The options for this request.

Response

*operations.UpdateAgentResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

SendHeartbeat

Send a heartbeat for an agent to keep it alive.

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Agents.SendHeartbeat(ctx, 992386)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id int64 ✔️ id
opts []operations.Option The options for this request.

Response

*operations.SendHeartbeatResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

SubmitBenchmark

Submit a benchmark for an agent

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"github.com/unclesp1d3r/cipherswarm-agent-sdk-go/models/components"
	"github.com/unclesp1d3r/cipherswarm-agent-sdk-go/models/operations"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Agents.SubmitBenchmark(ctx, 306461, operations.SubmitBenchmarkRequestBody{
        HashcatBenchmarks: []components.HashcatBenchmark{
            components.HashcatBenchmark{
                HashType: 442220,
                Runtime: 8499,
                HashSpeed: 156.49,
                Device: 322052,
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id int64 ✔️ id
requestBody operations.SubmitBenchmarkRequestBody ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SubmitBenchmarkResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 400, 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

SubmitErrorAgent

Submit an error for an agent

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Agents.SubmitErrorAgent(ctx, 607526, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id int64 ✔️ id
requestBody *operations.SubmitErrorAgentRequestBody N/A
opts []operations.Option The options for this request.

Response

*operations.SubmitErrorAgentResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

SetAgentShutdown

Marks the agent as shutdown and offline, freeing any assigned tasks.

Example Usage

package main

import(
	cipherswarmagentsdkgo "github.com/unclesp1d3r/cipherswarm-agent-sdk-go"
	"context"
	"log"
)

func main() {
    s := cipherswarmagentsdkgo.New(
        cipherswarmagentsdkgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Agents.SetAgentShutdown(ctx, 811605)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id int64 ✔️ id
opts []operations.Option The options for this request.

Response

*operations.SetAgentShutdownResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorObject 401 application/json
sdkerrors.SDKError 4XX, 5XX */*