(Agents)
Agents API
- GetAgent - Gets an instance of an agent
- UpdateAgent - Updates the agent
- SendHeartbeat - Send a heartbeat for an agent
- SubmitBenchmark - submit agent benchmarks
- SubmitErrorAgent - Submit an error for an agent
- SetAgentShutdown - shutdown agent
Returns an agent
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
}
}
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. |
*operations.GetAgentResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorObject | 401 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Updates an agent
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
}
}
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. |
*operations.UpdateAgentResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorObject | 401 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Send a heartbeat for an agent to keep it alive.
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
}
}
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. |
*operations.SendHeartbeatResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorObject | 401 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Submit a benchmark for an agent
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
}
}
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. |
*operations.SubmitBenchmarkResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorObject | 400, 401 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Submit an error for an agent
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
}
}
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. |
*operations.SubmitErrorAgentResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorObject | 401 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |
Marks the agent as shutdown and offline, freeing any assigned tasks.
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
}
}
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. |
*operations.SetAgentShutdownResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.ErrorObject | 401 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |