connector

package
v0.0.0-...-1ab713d Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

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

type Callback func(item proto.Message) error

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

type ErrorWithKind interface {
	error
	Kind() errors.ErrorKind
}

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

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

CreateHuntApproval sends a request to GRR server to create a new hunt approval via HTTP.

func (*HTTPConnector) CreateVFSRefreshOperation

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

GetClient sends a request to GRR server to get client with a given client id via HTTP.

func (*HTTPConnector) GetClientApproval

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

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

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

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

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

GetVFSRefreshOperationState sends a request to GRR server to return a status of a "VFS refresh" operation started by CreateVFSRefreshOperation via HTTP.

func (*HTTPConnector) GetVFSTimeline

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

GrantClientApproval sends a request to GRR server to grant a client approval via HTTP.

func (*HTTPConnector) GrantHuntApproval

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

UpdateVFSFileContent sends a request to GRR server to start a long-running operation that re-downloads the file from the GRR client via HTTP.

Jump to

Keyboard shortcuts

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