Documentation
¶
Index ¶
- func EscapeCypher(s string) string
- type Client
- func (c *Client) DeleteCustomNode(kind string) (*http.Response, error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) GetToken() string
- func (c *Client) Login(username, password string) error
- func (c *Client) RegisterCustomNodes(body []byte) (*http.Response, error)
- func (c *Client) RunCypherQuery(query string, v any) (*http.Response, error)
- func (c *Client) SetHTTPClient(client *http.Client)
- func (c *Client) SetToken(token string)
- type CypherQuery
- type CypherResponse
- type ErrorDetail
- type ErrorResponse
- type LoginRequest
- type SessionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeCypher ¶
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 (*Client) DeleteCustomNode ¶
func (*Client) RegisterCustomNodes ¶
func (*Client) RunCypherQuery ¶
func (*Client) SetHTTPClient ¶
SetHTTPClient allows for overriding the default http.Client. This is useful for setting custom transports for logging or testing.
type CypherQuery ¶
type CypherQuery struct {
Query string `json:"query"`
IncludeProperties bool `json:"include_properties"`
}
CypherQuery represents a Cypher query.
type CypherResponse ¶
type ErrorDetail ¶
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.