Documentation ¶
Index ¶
- func ClientPassphrase(s string)
- func FindHomedir() string
- func MakeConfiguration(file string) (err error)
- func PrintCommandResults(cmd mig.Command, onlyFound, showAgent bool) (err error)
- func PrintMap(locs []CommandLocation, title string) (err error)
- func ValueToAction(v interface{}) (a mig.Action, err error)
- func ValueToAgent(v interface{}) (agt mig.Agent, err error)
- func ValueToCommand(v interface{}) (cmd mig.Command, err error)
- func ValueToInvestigator(v interface{}) (inv mig.Investigator, err error)
- func ValueToLoaderEntry(v interface{}) (l mig.LoaderEntry, err error)
- func ValueToManifestRecord(v interface{}) (m mig.ManifestRecord, err error)
- type ApiConf
- type Client
- func (cli Client) CompressAction(a mig.Action) (comp_action mig.Action, err error)
- func (cli *Client) DisableDebug()
- func (cli Client) Do(r *http.Request) (resp *http.Response, err error)
- func (cli *Client) EnableDebug()
- func (cli Client) EvaluateAgentTarget(target string) (agents []mig.Agent, err error)
- func (cli Client) FetchActionResults(a mig.Action) (ret []mig.Command, err error)
- func (cli Client) FollowAction(a mig.Action, total int) (err error)
- func (cli Client) GetAPIResource(target string) (resource *cljs.Resource, err error)
- func (cli Client) GetAction(aid float64) (a mig.Action, links []cljs.Link, err error)
- func (cli Client) GetAgent(agtid float64) (agt mig.Agent, err error)
- func (cli Client) GetCommand(cmdid float64) (cmd mig.Command, err error)
- func (cli Client) GetInvestigator(iid float64) (inv mig.Investigator, err error)
- func (cli Client) GetLoaderEntry(lid float64) (le mig.LoaderEntry, err error)
- func (cli Client) GetManifestLoaders(mid float64) (ldrs []mig.LoaderEntry, err error)
- func (cli Client) GetManifestRecord(mid float64) (mr mig.ManifestRecord, err error)
- func (cli Client) LoaderEntryKey(le mig.LoaderEntry, key string) (err error)
- func (cli Client) LoaderEntryStatus(le mig.LoaderEntry, status bool) (err error)
- func (cli Client) MakeSignedToken() (token string, err error)
- func (cli Client) ManifestRecordStatus(mr mig.ManifestRecord, status string) (err error)
- func (cli Client) PostAction(a mig.Action) (a2 mig.Action, err error)
- func (cli Client) PostInvestigator(name string, pubkey []byte) (inv mig.Investigator, err error)
- func (cli Client) PostInvestigatorStatus(iid float64, newstatus string) (err error)
- func (cli Client) PostManifestSignature(mr mig.ManifestRecord, sig string) (err error)
- func (cli Client) PostNewLoader(le mig.LoaderEntry) (err error)
- func (cli Client) PostNewManifest(mr mig.ManifestRecord) (err error)
- func (cli Client) PrintActionResults(a mig.Action, show, render string) (err error)
- func (cli Client) SignAction(a mig.Action) (signed_action mig.Action, err error)
- func (cli Client) SignManifest(m mig.ManifestRecord) (ret string, err error)
- type CommandLocation
- type Configuration
- type GpgConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientPassphrase ¶
func ClientPassphrase(s string)
Set the GPG passphrase to be used by the client for secret key operations.
func FindHomedir ¶
func FindHomedir() string
func MakeConfiguration ¶
MakeConfiguration generates a new configuration file for the current user
func PrintCommandResults ¶
func PrintMap ¶
func PrintMap(locs []CommandLocation, title string) (err error)
func ValueToAction ¶
func ValueToAgent ¶
func ValueToCommand ¶
func ValueToInvestigator ¶
func ValueToInvestigator(v interface{}) (inv mig.Investigator, err error)
func ValueToLoaderEntry ¶
func ValueToLoaderEntry(v interface{}) (l mig.LoaderEntry, err error)
func ValueToManifestRecord ¶
func ValueToManifestRecord(v interface{}) (m mig.ManifestRecord, err error)
Types ¶
type Client ¶
type Client struct { API *http.Client Token string Conf Configuration Version string // contains filtered or unexported fields }
A Client provides all the needed functionalities to interact with the MIG API. It should be initialized with a proper configuration file.
func NewClient ¶
func NewClient(conf Configuration, version string) (cli Client, err error)
NewClient initiates a new instance of a Client
func (Client) CompressAction ¶
CompressAction takens a MIG action, and applies compression to any operations within the action for which compression is requested.
This function should be called on the action prior to signing it for submission to the API.
func (*Client) DisableDebug ¶
func (cli *Client) DisableDebug()
DisableDebug() disables the printing of debug messages to stdout
func (Client) Do ¶
Do is a thin wrapper around http.Client.Do() that inserts an authentication header to the outgoing request
func (*Client) EnableDebug ¶
func (cli *Client) EnableDebug()
EnableDebug() prints debug messages to stdout
func (Client) EvaluateAgentTarget ¶
EvaluateAgentTarget runs a search against the api to find all agents that match an action target string
func (Client) FetchActionResults ¶
FetchActionResults retrieves mig command results associated with a particular action. This function differs from PrintActionResults in that it returns a slice of mig.Command structs, rather then printing results to stdout.
XXX Note in the future it may be worth refactoring the action print functions to make use of this, but it would require additional work.
func (Client) FollowAction ¶
FollowAction continuously loops over an action and prints its completion status in os.Stderr. when the action reaches its expiration date, FollowAction prints its final status and returns.
func (Client) GetAPIResource ¶
GetAPIResource retrieves a cljs resource from a target endpoint. The target must be the relative to the API URL passed in the configuration. For example, if the API URL is `http://localhost:12345/api/v1/` then target could only be set to `dashboard` to retrieve `http://localhost:12345/api/v1/dashboard`
func (Client) GetInvestigator ¶
func (cli Client) GetInvestigator(iid float64) (inv mig.Investigator, err error)
func (Client) GetLoaderEntry ¶
func (cli Client) GetLoaderEntry(lid float64) (le mig.LoaderEntry, err error)
GetLoaderEntry retrieves a MIG loader entry from the API using the record ID
func (Client) GetManifestLoaders ¶
func (cli Client) GetManifestLoaders(mid float64) (ldrs []mig.LoaderEntry, err error)
Retrieve list of known loader entries that will match manifest mid
func (Client) GetManifestRecord ¶
func (cli Client) GetManifestRecord(mid float64) (mr mig.ManifestRecord, err error)
GetManifestRecord retrieves a MIG manifest record from the API using the record ID
func (Client) LoaderEntryKey ¶
func (cli Client) LoaderEntryKey(le mig.LoaderEntry, key string) (err error)
Change the key on an existing loader entry
func (Client) LoaderEntryStatus ¶
func (cli Client) LoaderEntryStatus(le mig.LoaderEntry, status bool) (err error)
Change the status of an existing loader entry
func (Client) MakeSignedToken ¶
MakeSignedToken encrypts a timestamp and a random number with the users GPG key to use as an auth token with the API
func (Client) ManifestRecordStatus ¶
func (cli Client) ManifestRecordStatus(mr mig.ManifestRecord, status string) (err error)
Change the status of an existing manifest record
func (Client) PostAction ¶
PostAction submits a MIG Action to the API and returns the reflected action with API ID
func (Client) PostInvestigator ¶
PostInvestigator creates an Investigator and returns the reflected investigator
func (Client) PostInvestigatorStatus ¶
PostInvestigatorStatus updates the status of an Investigator
func (Client) PostManifestSignature ¶
func (cli Client) PostManifestSignature(mr mig.ManifestRecord, sig string) (err error)
Add a new signature to an existing manifest known to the API
func (Client) PostNewLoader ¶
func (cli Client) PostNewLoader(le mig.LoaderEntry) (err error)
Post a new loader entry for storage through the API
func (Client) PostNewManifest ¶
func (cli Client) PostNewManifest(mr mig.ManifestRecord) (err error)
Post a new manifest record for storage through the API
func (Client) PrintActionResults ¶
func (Client) SignAction ¶
SignAction takes a MIG Action, signs it with the key identified in the configuration and returns the signed action
func (Client) SignManifest ¶
func (cli Client) SignManifest(m mig.ManifestRecord) (ret string, err error)
SignManifest takes a MIG manifest record, signs it with the key identified in the configuration and returns the signature
type CommandLocation ¶
type CommandLocation struct { Endpoint string `json:"endpoint"` CommandID float64 `json:"commandid"` ActionID float64 `json:"actionid"` FoundAnything bool `json:"foundanything"` ConnectionsTo []string `json:"connections_to"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` City string `json:"city"` Country string `json:"country"` }
func ValueToLocation ¶
func ValueToLocation(v interface{}) (cl CommandLocation, err error)
type Configuration ¶
type Configuration struct { API ApiConf // location of the MIG API Homedir string // location of the user's home directory GPG GpgConf // location of the user's secring }
Configuration stores the live configuration and global parameters of a client
func ReadConfiguration ¶
func ReadConfiguration(file string) (conf Configuration, err error)
ReadConfiguration loads a client configuration from a local configuration file and verifies that GnuPG's secring is available
Directories ¶
Path | Synopsis |
---|---|
This Source Code Form is subject to the terms of the Mozilla Public License, v.
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. |
This Source Code Form is subject to the terms of the Mozilla Public License, v.
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. |
This Source Code Form is subject to the terms of the Mozilla Public License, v.
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. |
This Source Code Form is subject to the terms of the Mozilla Public License, v.
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. |