amt

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2017 License: MIT Imports: 12 Imported by: 6

Documentation

Overview

Package amt provides Intel AMT interaction methods.

Index

Constants

View Source
const (
	CmdBootcfgPxe  = "BOOTCFGPXE" // https://github.com/golang/lint/issues/274
	CmdBootcfgHdd  = "BOOTCFGHDD"
	CmdInfo        = "INFO"
	CmdUp          = "UP"
	CmdDown        = "DOWN"
	CmdReset       = "RESET"
	CmdReboot      = "REBOOT"
	CmdShutdown    = "SHUTDOWN"
	CmdPingEnable  = "PINGENABLE"
	CmdPingDisable = "PINGDISABLE"
	CmdWebEnable   = "WEBENABLE"
	CmdWebDisable  = "WEBDISABLE"
	CmdSolEnable   = "SOLENABLE"
	CmdSolDisable  = "SOLDISABLE"
)

Variables

View Source
var ShortCommandMap = map[string]string{

	"X": CmdBootcfgPxe,
	"H": CmdBootcfgHdd,
	"U": CmdUp,
	"D": CmdDown,
	"R": CmdReset,
	"B": CmdReboot,
	"S": CmdShutdown,
}

ShortCommandMap as used by jobs / scheduled jobs via GUI / in DB

View Source
var Verbose bool

Verbose bool controls verbosity

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func CliCommand

func CliCommand(cmd string, hosts []string, options Optionset)

CliCommand executes a single AMT command on a list of hosts.

func LoadCaCertFile

func LoadCaCertFile(filename string) []byte

LoadCaCertFile loads a certificate from file and returns it as []byte

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func ProbeHostPorts

func ProbeHostPorts(host string, ports []int) (openPort int)

ProbeHostPorts probes for given host ports. If none are open, 0 is returned.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SequentialCommand

func SequentialCommand(cmd string, hosts []string, opt Optionset, delay float64)

SequentialCommand executes a command on hosts in sequential/non-parallel fashion.

Types

type Laststate

type Laststate struct {
	ID          int    `json:"id"`
	HostID      int    `json:"host_id"`
	Hostname    string `json:"hostname"`
	StateBegin  int    `json:"state_begin"`
	OpenPort    int    `json:"open_port"`
	StateAMT    int    `json:"state_amt"`
	StateHTTP   int    `json:"state_http"`
	Usermessage string `json:"usermessage"` // amtgo only
}

Laststate represents state reported by AMT, plus open TCP port

func Command

func Command(host Laststate, cmd string, options Optionset) (result Laststate)

Command executes a AMT command on a single host and returns execution result

type Laststates

type Laststates struct {
	Laststates []Laststate `json:"laststates"`
}

Laststates is array of Laststate -- for ember

type Optionset

type Optionset struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	SwV5           int    `json:"sw_v5" db:"sw_v5"`
	SwDash         int    `json:"sw_dash" db:"sw_dash"`
	SwScan22       int    `json:"sw_scan22" db:"sw_scan22"`
	SwScan3389     int    `json:"sw_scan3389" db:"sw_scan3389"`
	SwUseTLS       int    `json:"sw_usetls" db:"sw_usetls"`
	SwSkipcertchk  int    `json:"sw_skipcertchk" db:"sw_skipcertchk"`
	OptTimeout     int    `json:"opt_timeout" db:"opt_timeout"`
	OptPassfile    string `json:"opt_passfile" db:"opt_passfile"`
	OptCacertfile  string `json:"opt_cacertfile" db:"opt_cacertfile"`
	Username       string `json:"username"` // amtgo only
	Password       string `json:"-"`        // amtgo only
	CliDelay       int    `json:"-" db:"-"`
	CliUseTLS      bool   `json:"-" db:"-"` // amtgo cli (bool) vs db (int) hack
	CliSkipcertchk bool   `json:"-" db:"-"` // amtgo cli (bool) vs db (int) hack
	CaCertData     []byte `json:"-" db:"-"` // loaded contents of OptCacertfile
}

Optionset for AMT queries (TLS yes/no, CertCheck, timeout...)

type Optionsets

type Optionsets struct {
	Optionsets []Optionset `json:"optionsets"`
}

Optionsets is ember array of Optionset

Directories

Path Synopsis
Package digestAuthClient implements HTTP digest auth for AMT.
Package digestAuthClient implements HTTP digest auth for AMT.

Jump to

Keyboard shortcuts

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