bloodhound

package
v0.0.0-...-3ab05a9 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeCypher

func EscapeCypher(s string) string

TODO: this is an ugly hack, proper solution is to add parameterised query support.

EscapeCypher escapes special characters in s for safe interpolation into a Cypher string literal (single- or double-quoted). Backslashes are escaped first to avoid double-escaping.

Note: BloodHound CE's Cypher endpoint does not support parameterised queries, so string escaping is the only available mitigation. Prefer validating values to a known safe type (e.g. UUID, integer) before calling this function.

Types

type Client

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

Client is the main BloodHound API client.

func NewClient

func NewClient(baseURL string) (*Client, error)

NewClient creates and returns a new BloodHound API client.

func (*Client) DeleteCustomNode

func (c *Client) DeleteCustomNode(kind string) (*http.Response, error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do executes an HTTP request and returns the response.

func (*Client) GetToken

func (c *Client) GetToken() string

GetToken returns the session token currently used by the client.

func (*Client) Login

func (c *Client) Login(username, password string) error

Login authenticates to the BloodHound API using a username and password.

func (*Client) RegisterCustomNodes

func (c *Client) RegisterCustomNodes(body []byte) (*http.Response, error)

func (*Client) RunCypherQuery

func (c *Client) RunCypherQuery(query string, v any) (*http.Response, error)

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(client *http.Client)

SetHTTPClient allows for overriding the default http.Client. This is useful for setting custom transports for logging or testing.

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken provides a public method to configure the client with a session token.

type CypherQuery

type CypherQuery struct {
	Query             string `json:"query"`
	IncludeProperties bool   `json:"include_properties"`
}

CypherQuery represents a Cypher query.

type CypherResponse

type CypherResponse struct {
	*http.Response // embedded, but Body is already closed
}

type ErrorDetail

type ErrorDetail struct {
	Context string `json:"context"`
	Message string `json:"message"`
}

ErrorDetail represents a single error in an API response.

type ErrorResponse

type ErrorResponse struct {
	HTTPStatus int           `json:"http_status"`
	Timestamp  string        `json:"timestamp"`
	RequestID  string        `json:"request_id"`
	Errors     []ErrorDetail `json:"errors"`
}

ErrorResponse represents the error response from the API.

type LoginRequest

type LoginRequest struct {
	LoginMethod string `json:"login_method"`
	Username    string `json:"username"`
	Secret      string `json:"secret"`
}

LoginRequest represents the JSON body for a login request.

type SessionResponse

type SessionResponse struct {
	Data struct {
		SessionToken string `json:"session_token"`
		UserID       string `json:"user_id"`
		UserDN       string `json:"user_dn"`
	} `json:"data"`
}

SessionResponse represents the JSON response from a successful login.

Jump to

Keyboard shortcuts

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