Documentation ¶
Overview ¶
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Contributor: Julien Vehent jvehent@mozilla.com [:ulfr]
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Contributor: Julien Vehent jvehent@mozilla.com [:ulfr]
Index ¶
- 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)
- type ApiConf
- type Client
- 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) FollowAction(a mig.Action) (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) MakeSignedToken() (token 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) PrintActionResults(a mig.Action, show, render string) (err error)
- func (cli Client) SignAction(a mig.Action) (signed_action mig.Action, err error)
- type CommandLocation
- type Configuration
- type GpgConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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)
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) 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) 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) 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) 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) PrintActionResults ¶
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. |