Documentation
¶
Index ¶
- func SendIteratorRequest(args offsetGetter, sr sendRequest, fn Callback, pageSize int64) (int64, error)
- type Callback
- type ErrorWithKind
- type HTTPConnector
- func (c *HTTPConnector) AddClientsLabels(_ context.Context, args *acpb.ApiAddClientsLabelsArgs) error
- func (c *HTTPConnector) CancelFlow(_ context.Context, args *afpb.ApiCancelFlowArgs) error
- func (c *HTTPConnector) CreateClientApproval(_ context.Context, args *aupb.ApiCreateClientApprovalArgs) (*aupb.ApiClientApproval, error)
- func (c *HTTPConnector) CreateFlow(_ context.Context, args *afpb.ApiCreateFlowArgs) (*afpb.ApiFlow, error)
- func (c *HTTPConnector) CreateHunt(_ context.Context, args *ahpb.ApiCreateHuntArgs) (*ahpb.ApiHunt, error)
- func (c *HTTPConnector) CreateHuntApproval(_ context.Context, args *aupb.ApiCreateHuntApprovalArgs) (*aupb.ApiHuntApproval, error)
- func (c *HTTPConnector) CreateVFSRefreshOperation(_ context.Context, args *avpb.ApiCreateVfsRefreshOperationArgs) (*avpb.ApiCreateVfsRefreshOperationResult, error)
- func (c *HTTPConnector) GetClient(_ context.Context, args *acpb.ApiGetClientArgs) (*acpb.ApiClient, error)
- func (c *HTTPConnector) GetClientApproval(_ context.Context, args *aupb.ApiGetClientApprovalArgs) (*aupb.ApiClientApproval, error)
- func (c *HTTPConnector) GetFileBlob(_ context.Context, args *avpb.ApiGetFileBlobArgs) (io.ReadCloser, error)
- func (c *HTTPConnector) GetFileDetails(_ context.Context, args *avpb.ApiGetFileDetailsArgs) (*avpb.ApiGetFileDetailsResult, error)
- func (c *HTTPConnector) GetFileVersionTimes(_ context.Context, args *avpb.ApiGetFileVersionTimesArgs) (*avpb.ApiGetFileVersionTimesResult, error)
- func (c *HTTPConnector) GetFlow(_ context.Context, args *afpb.ApiGetFlowArgs) (*afpb.ApiFlow, error)
- func (c *HTTPConnector) GetFlowFilesArchive(_ context.Context, args *afpb.ApiGetFlowFilesArchiveArgs) (io.ReadCloser, error)
- func (c *HTTPConnector) GetGRRUser(_ context.Context) (*aupb.ApiGrrUser, error)
- func (c *HTTPConnector) GetHunt(_ context.Context, args *ahpb.ApiGetHuntArgs) (*ahpb.ApiHunt, error)
- func (c *HTTPConnector) GetHuntApproval(_ context.Context, args *aupb.ApiGetHuntApprovalArgs) (*aupb.ApiHuntApproval, error)
- func (c *HTTPConnector) GetHuntFilesArchive(_ context.Context, args *ahpb.ApiGetHuntFilesArchiveArgs) (io.ReadCloser, error)
- func (c *HTTPConnector) GetUsername(ctx context.Context) (string, error)
- func (c *HTTPConnector) GetVFSFileContentUpdateState(_ context.Context, args *avpb.ApiGetVfsFileContentUpdateStateArgs) (*avpb.ApiGetVfsFileContentUpdateStateResult, error)
- func (c *HTTPConnector) GetVFSFilesArchive(_ context.Context, args *avpb.ApiGetVfsFilesArchiveArgs) (io.ReadCloser, error)
- func (c *HTTPConnector) GetVFSRefreshOperationState(_ context.Context, args *avpb.ApiGetVfsRefreshOperationStateArgs) (*avpb.ApiGetVfsRefreshOperationStateResult, error)
- func (c *HTTPConnector) GetVFSTimeline(_ context.Context, args *avpb.ApiGetVfsTimelineArgs) (*avpb.ApiGetVfsTimelineResult, error)
- func (c *HTTPConnector) GetVFSTimelineAsCSV(_ context.Context, args *avpb.ApiGetVfsTimelineAsCsvArgs) (io.ReadCloser, error)
- func (c *HTTPConnector) GrantClientApproval(_ context.Context, args *aupb.ApiGrantClientApprovalArgs) (*aupb.ApiClientApproval, error)
- func (c *HTTPConnector) GrantHuntApproval(_ context.Context, args *aupb.ApiGrantHuntApprovalArgs) (*aupb.ApiHuntApproval, error)
- func (c *HTTPConnector) ListClientApprovals(_ context.Context, args *aupb.ApiListClientApprovalsArgs, ...) error
- func (c *HTTPConnector) ListFiles(_ context.Context, args *avpb.ApiListFilesArgs, fn func(m *avpb.ApiFile) error) error
- func (c *HTTPConnector) ListFlowResults(_ context.Context, args *afpb.ApiListFlowResultsArgs, ...) (int64, error)
- func (c *HTTPConnector) ListFlows(_ context.Context, args *afpb.ApiListFlowsArgs, fn func(m *afpb.ApiFlow) error) error
- func (c *HTTPConnector) ListHuntApprovals(_ context.Context, args *aupb.ApiListHuntApprovalsArgs, ...) error
- func (c *HTTPConnector) ListHuntResults(_ context.Context, args *ahpb.ApiListHuntResultsArgs, ...) (int64, error)
- func (c *HTTPConnector) ListHunts(_ context.Context, args *ahpb.ApiListHuntsArgs, fn func(m *ahpb.ApiHunt) error) (int64, error)
- func (c *HTTPConnector) ModifyHunt(_ context.Context, args *ahpb.ApiModifyHuntArgs) (*ahpb.ApiHunt, error)
- func (c *HTTPConnector) RemoveClientsLabels(_ context.Context, args *acpb.ApiRemoveClientsLabelsArgs) error
- func (c *HTTPConnector) SearchClients(_ context.Context, args *acpb.ApiSearchClientsArgs, ...) error
- func (c *HTTPConnector) SetPageSize(pageSize int64)
- func (c *HTTPConnector) UpdateVFSFileContent(_ context.Context, args *avpb.ApiUpdateVfsFileContentArgs) (*avpb.ApiUpdateVfsFileContentResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendIteratorRequest ¶
func SendIteratorRequest(args offsetGetter, sr sendRequest, fn Callback, pageSize int64) (int64, error)
SendIteratorRequest takes an argument, a function sr that sends a single request to GRR server, and a callback fn that applies to each result item returned by sr, and pageSize of the connector.
Types ¶
type Callback ¶
Callback is a func type that can be passed as an argument for SendIteratorRequest. sendIterator will call Callback on each item from results.
type ErrorWithKind ¶
ErrorWithKind is an interface that wraps an error and its ErrorKind.
func ConvertUserError ¶
func ConvertUserError(err error) ErrorWithKind
ConvertUserError converts an user error to ErrorWithKind.
type HTTPConnector ¶
type HTTPConnector struct {
// contains filtered or unexported fields
}
HTTPConnector allows GRR clients (defined in client package) to send request and receive response from GRR server via HTTP.
func NewHTTPConnector ¶
func NewHTTPConnector(apiEndpoint string, pageSize int64, setAuth func(r *http.Request)) *HTTPConnector
NewHTTPConnector returns a newly created HTTP connector, in which setAuth adds authentication for each single HTTP request. It can be nil if no authentication is required. Example usage: NewHTTPConnector("http://localhost:8081", func(r *http.Request) { r.SetBasicAuth("username", "password") })
func (*HTTPConnector) AddClientsLabels ¶
func (c *HTTPConnector) AddClientsLabels(_ context.Context, args *acpb.ApiAddClientsLabelsArgs) error
AddClientsLabels sends a request to GRR server to add labels for the client via HTTP.
func (*HTTPConnector) CancelFlow ¶
func (c *HTTPConnector) CancelFlow(_ context.Context, args *afpb.ApiCancelFlowArgs) error
CancelFlow sends a request to GRR server to cancel the flow via HTTP.
func (*HTTPConnector) CreateClientApproval ¶
func (c *HTTPConnector) CreateClientApproval(_ context.Context, args *aupb.ApiCreateClientApprovalArgs) (*aupb.ApiClientApproval, error)
CreateClientApproval sends a request to GRR server to create a new client approval via HTTP.
func (*HTTPConnector) CreateFlow ¶
func (c *HTTPConnector) CreateFlow(_ context.Context, args *afpb.ApiCreateFlowArgs) (*afpb.ApiFlow, error)
CreateFlow sends a request to GRR server to start a new flow on a given client via HTTP.
func (*HTTPConnector) CreateHunt ¶
func (c *HTTPConnector) CreateHunt(_ context.Context, args *ahpb.ApiCreateHuntArgs) (*ahpb.ApiHunt, error)
CreateHunt sends a request to GRR server to create a new hunt via HTTP.
func (*HTTPConnector) CreateHuntApproval ¶
func (c *HTTPConnector) CreateHuntApproval(_ context.Context, args *aupb.ApiCreateHuntApprovalArgs) (*aupb.ApiHuntApproval, error)
CreateHuntApproval sends a request to GRR server to create a new hunt approval via HTTP.
func (*HTTPConnector) CreateVFSRefreshOperation ¶
func (c *HTTPConnector) CreateVFSRefreshOperation(_ context.Context, args *avpb.ApiCreateVfsRefreshOperationArgs) (*avpb.ApiCreateVfsRefreshOperationResult, error)
CreateVFSRefreshOperation sends a request to GRR server to start a VFS "refresh" operation, that will refresh the stats data about files and directories at a given VFS path on a given client, via HTTP.
func (*HTTPConnector) GetClient ¶
func (c *HTTPConnector) GetClient(_ context.Context, args *acpb.ApiGetClientArgs) (*acpb.ApiClient, error)
GetClient sends a request to GRR server to get client with a given client id via HTTP.
func (*HTTPConnector) GetClientApproval ¶
func (c *HTTPConnector) GetClientApproval(_ context.Context, args *aupb.ApiGetClientApprovalArgs) (*aupb.ApiClientApproval, error)
GetClientApproval sends a request to GRR server to get information for a client approval.
func (*HTTPConnector) GetFileBlob ¶
func (c *HTTPConnector) GetFileBlob(_ context.Context, args *avpb.ApiGetFileBlobArgs) (io.ReadCloser, error)
GetFileBlob sends a request to GRR server to get byte contents of a VFS file on a given client via HTTP. This function starts a goroutine that runs until all data is read, or the readcloser is closed, or an error occurs in the go routine.
func (*HTTPConnector) GetFileDetails ¶
func (c *HTTPConnector) GetFileDetails(_ context.Context, args *avpb.ApiGetFileDetailsArgs) (*avpb.ApiGetFileDetailsResult, error)
GetFileDetails sends a request to GRR server to return file details for the file on a given client at a given VFS path via HTTP.
func (*HTTPConnector) GetFileVersionTimes ¶
func (c *HTTPConnector) GetFileVersionTimes(_ context.Context, args *avpb.ApiGetFileVersionTimesArgs) (*avpb.ApiGetFileVersionTimesResult, error)
GetFileVersionTimes sends a request to GRR server to return a list of timestamps (in microseconds) corresponding to different historic versions of a VFS file via HTTP.
func (*HTTPConnector) GetFlow ¶
func (c *HTTPConnector) GetFlow(_ context.Context, args *afpb.ApiGetFlowArgs) (*afpb.ApiFlow, error)
GetFlow sends a request to GRR server to get information for a flow via HTTP.
func (*HTTPConnector) GetFlowFilesArchive ¶
func (c *HTTPConnector) GetFlowFilesArchive(_ context.Context, args *afpb.ApiGetFlowFilesArchiveArgs) (io.ReadCloser, error)
GetFlowFilesArchive sends a request to GRR server to get files archive of the flow via HTTP. This function starts a goroutine that runs until all data is read, or the readcloser is closed, or an error occurs in the go routine.
func (*HTTPConnector) GetGRRUser ¶
func (c *HTTPConnector) GetGRRUser(_ context.Context) (*aupb.ApiGrrUser, error)
GetGRRUser sends a request to GRR server to return the current user via HTTP.
func (*HTTPConnector) GetHunt ¶
func (c *HTTPConnector) GetHunt(_ context.Context, args *ahpb.ApiGetHuntArgs) (*ahpb.ApiHunt, error)
GetHunt sends a request to GRR server to get a hunt via HTTP.
func (*HTTPConnector) GetHuntApproval ¶
func (c *HTTPConnector) GetHuntApproval(_ context.Context, args *aupb.ApiGetHuntApprovalArgs) (*aupb.ApiHuntApproval, error)
GetHuntApproval sends a request to GRR server to get a hunt approval via HTTP.
func (*HTTPConnector) GetHuntFilesArchive ¶
func (c *HTTPConnector) GetHuntFilesArchive(_ context.Context, args *ahpb.ApiGetHuntFilesArchiveArgs) (io.ReadCloser, error)
GetHuntFilesArchive sends a request to GRR server to get ZIP or TAR.GZ archive with all the files downloaded by the hunt via HTTP. This function starts a goroutine that runs until all data is read, or the readcloser is closed, or an error occurs in the go routine.
func (*HTTPConnector) GetUsername ¶
func (c *HTTPConnector) GetUsername(ctx context.Context) (string, error)
GetUsername returns the username of current user.
func (*HTTPConnector) GetVFSFileContentUpdateState ¶
func (c *HTTPConnector) GetVFSFileContentUpdateState(_ context.Context, args *avpb.ApiGetVfsFileContentUpdateStateArgs) (*avpb.ApiGetVfsFileContentUpdateStateResult, error)
GetVFSFileContentUpdateState sends a request to GRR server to get the state of a long-running operation started by UpdateVFSFileContent via HTTP.
func (*HTTPConnector) GetVFSFilesArchive ¶
func (c *HTTPConnector) GetVFSFilesArchive(_ context.Context, args *avpb.ApiGetVfsFilesArchiveArgs) (io.ReadCloser, error)
GetVFSFilesArchive sends a request to GRR server to stream an archive with files collected and stored in the VFS of a client via HTTP. This function starts a goroutine that runs until all data is read, or the readcloser is closed, or an error occurs in the go routine.
func (*HTTPConnector) GetVFSRefreshOperationState ¶
func (c *HTTPConnector) GetVFSRefreshOperationState(_ context.Context, args *avpb.ApiGetVfsRefreshOperationStateArgs) (*avpb.ApiGetVfsRefreshOperationStateResult, error)
GetVFSRefreshOperationState sends a request to GRR server to return a status of a "VFS refresh" operation started by CreateVFSRefreshOperation via HTTP.
func (*HTTPConnector) GetVFSTimeline ¶
func (c *HTTPConnector) GetVFSTimeline(_ context.Context, args *avpb.ApiGetVfsTimelineArgs) (*avpb.ApiGetVfsTimelineResult, error)
GetVFSTimeline sends a request to GRR server to get event timeline of VFS events for a given VFS path via HTTP.
func (*HTTPConnector) GetVFSTimelineAsCSV ¶
func (c *HTTPConnector) GetVFSTimelineAsCSV(_ context.Context, args *avpb.ApiGetVfsTimelineAsCsvArgs) (io.ReadCloser, error)
GetVFSTimelineAsCSV sends a request to GRR server to stream timeline information for a given VFS path on a given client in a CSV format via HTTP. This function starts a goroutine that runs until all data is read, or the readcloser is closed, or an error occurs in the go routine.
func (*HTTPConnector) GrantClientApproval ¶
func (c *HTTPConnector) GrantClientApproval(_ context.Context, args *aupb.ApiGrantClientApprovalArgs) (*aupb.ApiClientApproval, error)
GrantClientApproval sends a request to GRR server to grant a client approval via HTTP.
func (*HTTPConnector) GrantHuntApproval ¶
func (c *HTTPConnector) GrantHuntApproval(_ context.Context, args *aupb.ApiGrantHuntApprovalArgs) (*aupb.ApiHuntApproval, error)
GrantHuntApproval sends a request to GRR server to grant a hunt approval via HTTP.
func (*HTTPConnector) ListClientApprovals ¶
func (c *HTTPConnector) ListClientApprovals(_ context.Context, args *aupb.ApiListClientApprovalsArgs, fn func(m *aupb.ApiClientApproval) error) error
ListClientApprovals sends a request to GRR server to list all approvals of the client via HTTP and calls fn (a callback function) on each approval.
func (*HTTPConnector) ListFiles ¶
func (c *HTTPConnector) ListFiles(_ context.Context, args *avpb.ApiListFilesArgs, fn func(m *avpb.ApiFile) error) error
ListFiles sends a request to GRR server to list files in a given VFS directory of a given client via HTTP and calls fn (a callback function) on each file.
func (*HTTPConnector) ListFlowResults ¶
func (c *HTTPConnector) ListFlowResults(_ context.Context, args *afpb.ApiListFlowResultsArgs, fn func(m *afpb.ApiFlowResult) error) (int64, error)
ListFlowResults sends a request to GRR server to list all the results returned by a given flow via HTTP and calls fn on each flow result.
func (*HTTPConnector) ListFlows ¶
func (c *HTTPConnector) ListFlows(_ context.Context, args *afpb.ApiListFlowsArgs, fn func(m *afpb.ApiFlow) error) error
ListFlows sends a request to GRR server to list flows in a given VFS directory of a given client via HTTP and calls fn (a callback function) on each flow.
func (*HTTPConnector) ListHuntApprovals ¶
func (c *HTTPConnector) ListHuntApprovals(_ context.Context, args *aupb.ApiListHuntApprovalsArgs, fn func(m *aupb.ApiHuntApproval) error) error
ListHuntApprovals sends a request to GRR server to list all the hunt approvals belonging to requesting user via HTTP and calls fn (a callback function) on each approval.
func (*HTTPConnector) ListHuntResults ¶
func (c *HTTPConnector) ListHuntResults(_ context.Context, args *ahpb.ApiListHuntResultsArgs, fn func(m *ahpb.ApiHuntResult) error) (int64, error)
ListHuntResults sends a request to GRR server to list all the results returned by a given hunt via HTTP and calls fn on each hunt result.
func (*HTTPConnector) ListHunts ¶
func (c *HTTPConnector) ListHunts(_ context.Context, args *ahpb.ApiListHuntsArgs, fn func(m *ahpb.ApiHunt) error) (int64, error)
ListHunts sends a request to GRR server to list all GRR hunts via HTTP and calls fn on each hunt.
func (*HTTPConnector) ModifyHunt ¶
func (c *HTTPConnector) ModifyHunt(_ context.Context, args *ahpb.ApiModifyHuntArgs) (*ahpb.ApiHunt, error)
ModifyHunt sends a request to GRR server to start/stop hunt or modify its attributes via HTTP.
func (*HTTPConnector) RemoveClientsLabels ¶
func (c *HTTPConnector) RemoveClientsLabels(_ context.Context, args *acpb.ApiRemoveClientsLabelsArgs) error
RemoveClientsLabels sends a request to GRR server to remove labels for the client via HTTP.
func (*HTTPConnector) SearchClients ¶
func (c *HTTPConnector) SearchClients(_ context.Context, args *acpb.ApiSearchClientsArgs, fn func(m *acpb.ApiClient) error) error
SearchClients sends a request to GRR server to search for clients using a search query via HTTP.
func (*HTTPConnector) SetPageSize ¶
func (c *HTTPConnector) SetPageSize(pageSize int64)
SetPageSize is a setter for HTTPConnector.pageSize .
func (*HTTPConnector) UpdateVFSFileContent ¶
func (c *HTTPConnector) UpdateVFSFileContent(_ context.Context, args *avpb.ApiUpdateVfsFileContentArgs) (*avpb.ApiUpdateVfsFileContentResult, error)
UpdateVFSFileContent sends a request to GRR server to start a long-running operation that re-downloads the file from the GRR client via HTTP.