ipmi

package
v0.0.0-...-dbc03d7 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: BSD-2-Clause Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdSetSOLConfigParams byte = 0x21
	CmdGetSOLConfigParams byte = 0x22

	CmdMasterWriteRead byte = 0x52
)
View Source
const (
	DefaultPort = 623

	RMCPVersion   byte = 0x06
	RMCPReserved  byte = 0x00
	RMCPSeqNoAck  byte = 0xFF
	RMCPClassIPMI byte = 0x07
	RMCPClassASF  byte = 0x06

	IPMI15AuthNone byte = 0x00
	IPMI15AuthMD2  byte = 0x01
	IPMI15AuthMD5  byte = 0x02
	IPMI15AuthPass byte = 0x04
	IPMI15AuthOEM  byte = 0x05

	IPMI20Format byte = 0x06
)
View Source
const (
	PayloadIPMI           byte = 0x00
	PayloadSOL            byte = 0x01
	PayloadOpenSessionReq byte = 0x10
	PayloadOpenSessionRes byte = 0x11
	PayloadRAKP1          byte = 0x12
	PayloadRAKP2          byte = 0x13
	PayloadRAKP3          byte = 0x14
	PayloadRAKP4          byte = 0x15
)
View Source
const (
	RAKPNone       byte = 0x00
	RAKPHMACSHA1   byte = 0x01
	RAKPHMACMD5    byte = 0x02
	RAKPHMACSHA256 byte = 0x03
)
View Source
const (
	IntegrityNone          byte = 0x00
	IntegrityHMACSHA196    byte = 0x01
	IntegrityHMACMD5128    byte = 0x02
	IntegrityMD5128        byte = 0x03
	IntegrityHMACSHA256128 byte = 0x04
)
View Source
const (
	ConfNone    byte = 0x00
	ConfAESCBC  byte = 0x01
	ConfXRC4128 byte = 0x02
	ConfXRC440  byte = 0x03
)
View Source
const (
	NetFnChassis   byte = 0x00
	NetFnBridge    byte = 0x02
	NetFnSensor    byte = 0x04
	NetFnApp       byte = 0x06
	NetFnFirmware  byte = 0x08
	NetFnStorage   byte = 0x0A
	NetFnTransport byte = 0x0C
	NetFnGroup     byte = 0x2C
	NetFnOEM       byte = 0x2E
)
View Source
const (
	CmdGetChassisStatus       byte = 0x01
	CmdGetDeviceID            byte = 0x01
	CmdGetLANConfigParams     byte = 0x02
	CmdColdReset              byte = 0x02
	CmdWarmReset              byte = 0x03
	CmdGetSelfTestResults     byte = 0x04
	CmdGetDeviceGUID          byte = 0x08
	CmdGetSystemGUID          byte = 0x37
	CmdGetChannelAuthCaps     byte = 0x38
	CmdGetSessionChallenge    byte = 0x39
	CmdActivateSession        byte = 0x3A
	CmdSetSessionPrivilege    byte = 0x3B
	CmdCloseSession           byte = 0x3C
	CmdGetAuthCode            byte = 0x3F
	CmdSetChannelAccess       byte = 0x40
	CmdGetChannelAccess       byte = 0x41
	CmdGetChannelInfo         byte = 0x42
	CmdSetUserAccess          byte = 0x43
	CmdGetUserAccess          byte = 0x44
	CmdSetUserName            byte = 0x45
	CmdGetUserName            byte = 0x46
	CmdSetUserPassword        byte = 0x47
	CmdActivatePayload        byte = 0x48
	CmdDeactivatePayload      byte = 0x49
	CmdGetPayloadStatus       byte = 0x4A
	CmdGetPayloadInfo         byte = 0x4B
	CmdGetChannelCipherSuites byte = 0x54
	CmdGetFRUInventoryInfo    byte = 0x10
	CmdReadFRUData            byte = 0x11
)
View Source
const (
	SOLParamEnable         byte = 0x01
	SOLParamAuthentication byte = 0x02
	SOLParamPayloadChannel byte = 0x07
	SOLParamPayloadPort    byte = 0x08
)
View Source
const (
	DCMIGroupExtID         byte = 0xDC
	CmdDCMIGetCapabilities byte = 0x01
	DCMIParamSupportedCaps byte = 0x01
)
View Source
const (
	PrivUnspecified   byte = 0x00
	PrivCallback      byte = 0x01
	PrivUser          byte = 0x02
	PrivOperator      byte = 0x03
	PrivAdministrator byte = 0x04
	PrivOEM           byte = 0x05
	PrivNoAccess      byte = 0x0f
)
View Source
const (
	NetFnSMCOEM            byte = 0x30
	CmdSMCFileTransactions byte = 0xA0

	SMCFileTypeConfig byte = 0x01
)

Variables

View Source
var OEMNetFnRange = [...]byte{
	0x2E, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E,
}
View Source
var SMCConfigInnerPassword = []byte("CKSAM1SUCKSAM1SUASMUCIKSASMUCIKS")
View Source
var SMCObfuscationIV = []byte{
	0x2e, 0x7b, 0x4c, 0x71, 0xd0, 0x45, 0x2a, 0x6b,
	0x89, 0xb8, 0x9a, 0xf9, 0x6a, 0xb3, 0xc6, 0xca,
}
View Source
var SMCRoleProbeAccountCandidates = []string{"ADMIN", "admin", "root"}

Functions

func ASFPing

func ASFPing(host string, port int, timeout time.Duration) ([]byte, error)

func ASFPingPacket

func ASFPingPacket(msgTag byte) []byte

func AllCmds

func AllCmds() []byte

func AuthAlgosForCiphers

func AuthAlgosForCiphers(ids []int) []byte

func BuildRMCPPlus

func BuildRMCPPlus(payloadType byte, body []byte) []byte

func BuildRMCPPlusWithSID

func BuildRMCPPlusWithSID(payloadType byte, sid uint32, body []byte) []byte

func CipherSuiteName

func CipherSuiteName(id int) string

func CipherSuiteWeak

func CipherSuiteWeak(id int) bool

func CloseSession15

func CloseSession15(host string, port int, sess *Session15, timeout time.Duration)

func CloseSetupSession

func CloseSetupSession(c *Client, bmcSID uint32) (byte, error)

func CloseSetupSessionAsync

func CloseSetupSessionAsync(c *Client, bmcSID uint32) error

func DefaultBroadCmds

func DefaultBroadCmds() []byte

func DefaultBroadNetFns

func DefaultBroadNetFns() []byte

func EnumCipherSuites15

func EnumCipherSuites15(host string, port int, timeout time.Duration) ([]int, []byte, error)

func ExecClearIPMI

func ExecClearIPMI(c *Client, bmcSID uint32, netfn, cmd byte, data []byte, rqSeq byte) (byte, []byte, error)

func FormatFirmwareRevision

func FormatFirmwareRevision(major, minor byte) string

func FormatFirmwareRevisionFull

func FormatFirmwareRevisionFull(manufacturerID uint32, major, minor byte, aux [4]byte) string

func GetChannelAuthCaps15

func GetChannelAuthCaps15(host string, port int, channel byte, reqPriv byte, timeout time.Duration) ([]byte, error)

func GetChannelAuthCapsPacket

func GetChannelAuthCapsPacket(channel byte, reqPriv byte) []byte

func GetSessionChallenge15

func GetSessionChallenge15(c *Client, authType byte, username string) (cc byte, tempSID uint32, challenge []byte, err error)

func GetSystemGUID15

func GetSystemGUID15(host string, port int, timeout time.Duration) ([]byte, error)

func ILOAlgoZeroControlAccepted

func ILOAlgoZeroControlAccepted(host string, port int, timeout time.Duration) (accepted bool, status byte, err error)

func IPMBChecksum

func IPMBChecksum(b []byte) byte

func ManufacturerNameFor

func ManufacturerNameFor(id uint32) string

func ParseOpenSessionResponse

func ParseOpenSessionResponse(pkt []byte) (uint32, error)

func ParsePrivilege

func ParsePrivilege(v string) (byte, error)

func ParseSystemGUIDReply

func ParseSystemGUIDReply(reply []byte) ([]byte, error)

func PrivilegeName

func PrivilegeName(level byte) string

func RAKP1RoleStatus

func RAKP1RoleStatus(host string, port int, username string, role byte, timeout time.Duration) (byte, error)

func RmcpPlusPayload

func RmcpPlusPayload(pkt []byte) ([]byte, error)

func SMCArchiveMember

func SMCArchiveMember(gz []byte, key string) ([]byte, bool, error)

func SMCArchiveMemberNames

func SMCArchiveMemberNames(gz []byte) ([]string, error)

func SMCContainerUnwrap

func SMCContainerUnwrap(ct, key, iv []byte, cipherKind SMCConfigCipher) ([]byte, bool, error)

func SMCContainerWrap

func SMCContainerWrap(pt, key, iv []byte, cipherKind SMCConfigCipher) ([]byte, error)

func SMCDetectGeneration

func SMCDetectGeneration(host string, port int, timeout time.Duration) (generation, modelPrefix string, err error)

func SMCLooksGzip

func SMCLooksGzip(b []byte) bool

func SMCLooksOpenSSLSalted

func SMCLooksOpenSSLSalted(b []byte) bool

func SMCOpenSSLSaltedUnwrap

func SMCOpenSSLSaltedUnwrap(blob, password []byte) (pt []byte, looksGzip bool, err error)

func SMCOpenSSLSaltedWrap

func SMCOpenSSLSaltedWrap(pt, password []byte) ([]byte, error)

func SampleSessionIDs

func SampleSessionIDs(host string, port, n int, timeout time.Duration) []uint32

func SessionResourceExhausted

func SessionResourceExhausted(inv *PostAuthCollection, err error) bool

func UsernamePrivRank

func UsernamePrivRank(user string) int

func V15OracleUserList

func V15OracleUserList() []string

func WithCommandProgress

func WithCommandProgress(ctx context.Context, fn func(string)) context.Context

func WithPostAuthTrace

func WithPostAuthTrace(ctx context.Context, trace func(string, ...any)) context.Context

Types

type AuthCaps

type AuthCaps struct {
	Channel        byte
	AuthTypeMask   byte
	IPMI20         bool
	AnonLogin      bool
	NullUser       bool
	NonNullUser    bool
	UserLevelAuth  bool
	PerMessageAuth bool
	KG             bool
	OEMID          uint32
	GUID           []byte
	CompletionCode byte
	Raw            []byte
}

func ParseAuthCapsReply

func ParseAuthCapsReply(body []byte) (*AuthCaps, error)

func (*AuthCaps) HasAuthMD2

func (a *AuthCaps) HasAuthMD2() bool

func (*AuthCaps) HasAuthMD5

func (a *AuthCaps) HasAuthMD5() bool

func (*AuthCaps) HasAuthNone

func (a *AuthCaps) HasAuthNone() bool

func (*AuthCaps) HasAuthOEM

func (a *AuthCaps) HasAuthOEM() bool

func (*AuthCaps) HasAuthStraight

func (a *AuthCaps) HasAuthStraight() bool

type AuthFlow

type AuthFlow struct {
	Version  string `json:"version"`
	Mode     string `json:"mode"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`

	RelabelUser string      `json:"relabelUser,omitempty"`
	AuthType    byte        `json:"authType,omitempty"`
	Suite       CipherAlgos `json:"suite"`
	Source      string      `json:"source,omitempty"`
}

func SelectPostAuthFlow

func SelectPostAuthFlow(auth *AuthReport, v15 *V15Report) (AuthFlow, bool)

func SelectPostAuthFlows

func SelectPostAuthFlows(auth *AuthReport, v15 *V15Report) []AuthFlow

type AuthOptions

type AuthOptions struct {
	Usernames      []string
	Vendor         string
	Ciphers        []int
	Online         bool
	OfflineCrack   bool
	Permute        bool
	ExtraPasswords []string
	Timeout        time.Duration
}

type AuthReport

type AuthReport struct {
	Host         string       `json:"host"`
	Port         int          `json:"port"`
	Suite        *CipherAlgos `json:"suite,omitempty"`
	CipherZero   bool         `json:"cipherZero"`
	FakeUsername bool         `json:"fakeUsername"`

	CipherZeroSID   uint32 `json:"cipherZeroSid,omitempty"`
	FakeUsernameSID uint32 `json:"fakeUsernameSid,omitempty"`

	FakeUsernameProbe string        `json:"fakeUsernameProbe,omitempty"`
	Results           []RAKPResult  `json:"results"`
	Cracked           []CrackResult `json:"cracked"`
}

func RunAuth

func RunAuth(ctx context.Context, host string, port int, opts AuthOptions) (*AuthReport, error)

type ChassisStatus

type ChassisStatus struct {
	PowerOn           bool   `json:"powerOn"`
	PowerOverload     bool   `json:"powerOverload"`
	PowerInterlock    bool   `json:"powerInterlock"`
	MainPowerFault    bool   `json:"mainPowerFault"`
	PowerControlFault bool   `json:"powerControlFault"`
	PowerRestore      string `json:"powerRestorePolicy,omitempty"`
	LastEvent         string `json:"lastPowerEvent,omitempty"`
	IdentifyOn        bool   `json:"identifyOn"`
	CoolingFault      bool   `json:"coolingFault"`
	DriveFault        bool   `json:"driveFault"`
	Raw               string `json:"raw,omitempty"`
}

type CipherAlgos

type CipherAlgos struct {
	Suite     int  `json:"suite"`
	Auth      byte `json:"auth"`
	Integrity byte `json:"integrity"`
	Conf      byte `json:"conf"`
}

func CipherAlgosFor

func CipherAlgosFor(id int) (CipherAlgos, bool)

func CipherTriples

func CipherTriples(ids []int) []CipherAlgos

type CipherAttempt

type CipherAttempt struct {
	Suite     int    `json:"suite"`
	Auth      byte   `json:"auth"`
	Integrity byte   `json:"integrity"`
	Conf      byte   `json:"conf"`
	Success   bool   `json:"success"`
	Error     string `json:"error,omitempty"`
}

type Client

type Client struct {
	Host    string
	Port    int
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string, port int, timeout time.Duration) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Send

func (c *Client) Send(pkt []byte) ([]byte, error)

func (*Client) SendRaw

func (c *Client) SendRaw(pkt []byte) error

type CmdSess

type CmdSess struct {
	// contains filtered or unexported fields
}

func OpenCmdSess

func OpenCmdSess(opts CmdSessOptions) (*CmdSess, error)

func (*CmdSess) AdvertisedCiphers

func (s *CmdSess) AdvertisedCiphers() []int

func (*CmdSess) ChassisStatus

func (s *CmdSess) ChassisStatus(ctx context.Context) (*ChassisStatus, error)

func (*CmdSess) Close

func (s *CmdSess) Close()

func (*CmdSess) CommandProtection

func (s *CmdSess) CommandProtection() string

func (*CmdSess) ExecRaw

func (s *CmdSess) ExecRaw(netfn, cmd byte, req []byte) (byte, []byte, error)

func (*CmdSess) FRUPrint

func (s *CmdSess) FRUPrint(ctx context.Context, maxFields int) ([]FRUField, error)

func (*CmdSess) Flow

func (s *CmdSess) Flow() AuthFlow

func (*CmdSess) Host

func (s *CmdSess) Host() string

func (*CmdSess) I2CMasterWriteRead

func (s *CmdSess) I2CMasterWriteRead(channel, slaveAddr, readCount byte, writeData []byte) ([]byte, error)

func (*CmdSess) LANPrint

func (s *CmdSess) LANPrint(ctx context.Context) (map[string]string, map[string]string, error)

func (*CmdSess) MCInfo

func (s *CmdSess) MCInfo(ctx context.Context) (*MCInfo, error)

func (*CmdSess) MCReset

func (s *CmdSess) MCReset(cold bool) error

func (*CmdSess) SMCGeneration

func (s *CmdSess) SMCGeneration(ctx context.Context) (*SMCGenerationResult, error)

func (*CmdSess) SMCRAKPDetected

func (s *CmdSess) SMCRAKPDetected() bool

func (*CmdSess) SOLActivate

func (s *CmdSess) SOLActivate() ([]byte, error)

func (*CmdSess) SOLDeactivate

func (s *CmdSess) SOLDeactivate() error

func (*CmdSess) SOLGetConfigParam

func (s *CmdSess) SOLGetConfigParam(ctx context.Context, param byte) ([]byte, error)

func (*CmdSess) SOLSetConfigParam

func (s *CmdSess) SOLSetConfigParam(ctx context.Context, param byte, value []byte) error

func (*CmdSess) SPDRead

func (s *CmdSess) SPDRead(slaveAddr, offset, length byte) ([]byte, error)

func (*CmdSess) UserClear

func (s *CmdSess) UserClear(ctx context.Context, id int) error

func (*CmdSess) UserDisable

func (s *CmdSess) UserDisable(id int) error

func (*CmdSess) UserEnable

func (s *CmdSess) UserEnable(id int) error

func (*CmdSess) UserList

func (s *CmdSess) UserList(ctx context.Context) ([]UserEntry, error)

func (*CmdSess) UserSetName

func (s *CmdSess) UserSetName(id int, name string) error

func (*CmdSess) UserSetPassword

func (s *CmdSess) UserSetPassword(id int, password string) error

func (*CmdSess) UserSetPrivilege

func (s *CmdSess) UserSetPrivilege(ctx context.Context, id int, priv byte) error

type CmdSessOptions

type CmdSessOptions struct {
	Host           string
	Port           int
	Username       string
	Password       string
	Timeout        time.Duration
	MaxRetries     int
	IPMIVersion    string
	Auth           string
	Cipher         int
	DisableSMCRAKP bool

	CommandProtection string
}

type CrackOptions

type CrackOptions struct {
	Vendor         string
	ExtraPasswords []string
	Permute        bool
}

type CrackResult

type CrackResult struct {
	Username       string `json:"username"`
	Password       string `json:"password"`
	PasswordType   string `json:"passwordType"`
	Vendor         string `json:"vendor,omitempty"`
	Attempts       int    `json:"attempts"`
	Verified       bool   `json:"verified"`
	LoginTested    bool   `json:"loginTested"`
	AcceptsAny     bool   `json:"acceptsAny,omitempty"`
	CommandCapable bool   `json:"commandCapable,omitempty"`
	Proof          string `json:"proof,omitempty"`
}

func CrackRAKP

func CrackRAKP(r *RAKPResult, opts CrackOptions) *CrackResult

type DCMICapabilities

type DCMICapabilities struct {
	MajorVersion  byte
	MinorVersion  byte
	ParamRevision byte
	ParamData     []byte
}

func GetDCMICapabilities15

func GetDCMICapabilities15(host string, port int, timeout time.Duration) (*DCMICapabilities, error)

func ParseDCMICapabilitiesReply

func ParseDCMICapabilitiesReply(reply []byte) (*DCMICapabilities, error)

func (*DCMICapabilities) SupportedCapsHex

func (d *DCMICapabilities) SupportedCapsHex() string

func (*DCMICapabilities) Version

func (d *DCMICapabilities) Version() string

type DeviceID

type DeviceID struct {
	ID                 byte
	Revision           byte
	FirmwareMajor      byte
	FirmwareMinor      byte
	IPMIVersion        byte
	AdditionalSupport  byte
	ManufacturerID     uint32
	ProductID          uint16
	AuxFirmwareVersion [4]byte
}

func GetDeviceID15

func GetDeviceID15(host string, port int, timeout time.Duration) (*DeviceID, error)

func ParseDeviceIDReply

func ParseDeviceIDReply(reply []byte) (*DeviceID, error)

func (*DeviceID) Attributes

func (d *DeviceID) Attributes() map[string]string

func (*DeviceID) FirmwareRevisionFull

func (d *DeviceID) FirmwareRevisionFull() string

func (*DeviceID) ManufacturerName

func (d *DeviceID) ManufacturerName() string

func (*DeviceID) Summary

func (d *DeviceID) Summary() string

type FRUField

type FRUField struct {
	DeviceID int    `json:"deviceId,omitempty"`
	Area     string `json:"area"`
	Index    int    `json:"index"`
	Name     string `json:"name,omitempty"`
	Value    string `json:"value"`
}

type IPMBSweepEntry

type IPMBSweepEntry struct {
	TargetAddr     byte
	CompletionCode byte
	Acked          bool
	InnerCC        byte
	HasInnerResp   bool
	RawReply       []byte
	Err            string
}

type IPMBSweepResult

type IPMBSweepResult struct {
	Host    string
	Entries []IPMBSweepEntry

	Reachable []IPMBSweepEntry
}

func SweepIPMBBridge

func SweepIPMBBridge(host string, port int, timeout time.Duration, logf func(string)) (*IPMBSweepResult, error)

func (*IPMBSweepResult) IPMBSweepSummary

func (r *IPMBSweepResult) IPMBSweepSummary() string

type MCInfo

type MCInfo struct {
	DeviceID             byte   `json:"deviceId"`
	DeviceRevision       byte   `json:"deviceRevision"`
	FirmwareRevision     string `json:"firmwareVersion"`
	FirmwareRevisionFull string `json:"firmwareVersionFull,omitempty"`
	IPMIVersion          string `json:"ipmiVersion"`
	ManufacturerID       uint32 `json:"manufacturerId"`
	ManufacturerName     string `json:"manufacturerName,omitempty"`
	ProductID            uint16 `json:"productId"`
	AuxFirmwareHex       string `json:"auxFirmwareHex,omitempty"`
	AdditionalSupport    byte   `json:"additionalSupport"`
}

type NetFnSweepEntry

type NetFnSweepEntry struct {
	NetFn          byte
	Cmd            byte
	CompletionCode byte
	Accepted       bool
	AuthRequired   bool
	Unsupported    bool
	RawReply       []byte
	Err            string
}

type NetFnSweepMode

type NetFnSweepMode uint8
const (
	SweepPreSession NetFnSweepMode = iota

	SweepSessionZero
)

type NetFnSweepResult

type NetFnSweepResult struct {
	Host    string
	Mode    NetFnSweepMode
	Entries []NetFnSweepEntry

	Accepted []NetFnSweepEntry

	WriteReachable []NetFnSweepEntry
}

func SweepOEMNetFns

func SweepOEMNetFns(host string, port int, mode NetFnSweepMode, sweepAllCmds bool, timeout time.Duration) (*NetFnSweepResult, error)

func SweepOEMNetFnsSample

func SweepOEMNetFnsSample(host string, port int, mode NetFnSweepMode, cmds []byte, timeout time.Duration, logf func(string)) (*NetFnSweepResult, error)

func (*NetFnSweepResult) SweepResultSummary

func (r *NetFnSweepResult) SweepResultSummary() string

type NullUserPrivProbe

type NullUserPrivProbe struct {
	Username string `json:"username"`

	Suite int `json:"suite"`

	Activated bool   `json:"activated"`
	Error     string `json:"error,omitempty"`

	OpenSessionMaxPriv byte `json:"openSessionMaxPriv"`

	Privilege   byte `json:"privilege"`
	PrivilegeOK bool `json:"privilegeOk"`
	PrivilegeCC byte `json:"privilegeCc,omitempty"`

	Protection string `json:"protection,omitempty"`

	DeviceIDCC   byte `json:"deviceIdCc"`
	DeviceIDOK   bool `json:"deviceIdOk"`
	DeviceIDSeen bool `json:"deviceIdSeen"`

	SOL *SOLConfig `json:"sol,omitempty"`
}

func ProbeNullUserPrivilege

func ProbeNullUserPrivilege(host string, port int, username string, suiteIDs []int, timeout time.Duration, logf func(string)) *NullUserPrivProbe

func (*NullUserPrivProbe) Status

func (p *NullUserPrivProbe) Status() string

func (*NullUserPrivProbe) UsableAccess

func (p *NullUserPrivProbe) UsableAccess() bool

type OpenBMCDisabledSetupOverwriteProbe

type OpenBMCDisabledSetupOverwriteProbe struct {
	DisabledUsername           string `json:"disabledUsername"`
	AdminUsername              string `json:"adminUsername"`
	Suite                      int    `json:"suite,omitempty"`
	BMCSID                     uint32 `json:"bmcSid"`
	DisabledRAKPStatus         byte   `json:"disabledRakpStatus"`
	DisabledRAKPHMACLen        int    `json:"disabledRakpHmacLen"`
	DisabledPrivQueryCC        byte   `json:"disabledPrivQueryCc,omitempty"`
	DisabledSetPrivAdminCC     byte   `json:"disabledSetPrivAdminCc,omitempty"`
	DisabledCommandsWork       bool   `json:"disabledCommandsWork"`
	AdminRAKPStatus            byte   `json:"adminRakpStatus"`
	AdminRAKPHMACLen           int    `json:"adminRakpHmacLen"`
	AfterPrivQueryCC           byte   `json:"afterPrivQueryCc,omitempty"`
	AfterPrivQueryData         []byte `json:"afterPrivQueryData,omitempty"`
	AfterSetPrivAdminCC        byte   `json:"afterSetPrivAdminCc,omitempty"`
	AfterSetPrivAdminData      []byte `json:"afterSetPrivAdminData,omitempty"`
	SetupOverwriteCommandsWork bool   `json:"setupOverwriteCommandsWork"`
	CloseSetupCC               byte   `json:"closeSetupCc,omitempty"`
	CloseSetupError            string `json:"closeSetupError,omitempty"`
	Error                      string `json:"error,omitempty"`
}

func ProbeOpenBMCDisabledSetupOverwrite

func ProbeOpenBMCDisabledSetupOverwrite(host string, port int, disabledUsername, adminUsername string, suite CipherAlgos, timeout time.Duration) (*OpenBMCDisabledSetupOverwriteProbe, error)

type OpenBMCSetupData

type OpenBMCSetupData struct {
	PrivilegeQueryCC       byte   `json:"privilegeQueryCc"`
	PrivilegeQueryDataHex  string `json:"privilegeQueryDataHex,omitempty"`
	PayloadStatusCC        byte   `json:"payloadStatusCc"`
	PayloadStatusDataHex   string `json:"payloadStatusDataHex,omitempty"`
	PayloadInfoCC          byte   `json:"payloadInfoCc,omitempty"`
	PayloadInfoDataHex     string `json:"payloadInfoDataHex,omitempty"`
	ProviderGetDeviceIDCC  byte   `json:"providerGetDeviceIdCc,omitempty"`
	ProviderGetDeviceIDHex string `json:"providerGetDeviceIdHex,omitempty"`
	ProviderBlocked        bool   `json:"providerBlocked"`
	Error                  string `json:"error,omitempty"`
}

type OpenBMCSetupProbe

type OpenBMCSetupProbe struct {
	Username                     string `json:"username"`
	Suite                        int    `json:"suite,omitempty"`
	AuthAlgo                     byte   `json:"authAlgo,omitempty"`
	IntegrityAlgo                byte   `json:"integrityAlgo,omitempty"`
	ConfAlgo                     byte   `json:"confAlgo,omitempty"`
	BMCSID                       uint32 `json:"bmcSid"`
	RAKPStatus                   byte   `json:"rakpStatus"`
	RAKPHMACLen                  int    `json:"rakpHmacLen"`
	OpenSessionOnlyRejected      bool   `json:"openSessionOnlyRejected"`
	OpenSessionOnlyPrivQueryCC   byte   `json:"openSessionOnlyPrivQueryCc,omitempty"`
	OpenSessionOnlyError         string `json:"openSessionOnlyError,omitempty"`
	PrePrivQueryCC               byte   `json:"prePrivQueryCc,omitempty"`
	PrePrivQueryData             []byte `json:"prePrivQueryData,omitempty"`
	SetPrivAdminCC               byte   `json:"setPrivAdminCc,omitempty"`
	SetPrivAdminData             []byte `json:"setPrivAdminData,omitempty"`
	PayloadStatusCC              byte   `json:"payloadStatusCc,omitempty"`
	PayloadStatusData            []byte `json:"payloadStatusData,omitempty"`
	PayloadInfoCC                byte   `json:"payloadInfoCc,omitempty"`
	PayloadInfoData              []byte `json:"payloadInfoData,omitempty"`
	SetupCommandsWork            bool   `json:"setupCommandsWork"`
	AdminPrivAccepted            bool   `json:"adminPrivAccepted"`
	CrossSocketRAKPStatus        byte   `json:"crossSocketRakpStatus,omitempty"`
	CrossSocketRAKPHMACLen       int    `json:"crossSocketRakpHmacLen,omitempty"`
	CrossSocketPrivQueryCC       byte   `json:"crossSocketPrivQueryCc,omitempty"`
	CrossSocketPrivQueryData     []byte `json:"crossSocketPrivQueryData,omitempty"`
	CrossSocketSetPrivAdminCC    byte   `json:"crossSocketSetPrivAdminCc,omitempty"`
	CrossSocketSetPrivAdminData  []byte `json:"crossSocketSetPrivAdminData,omitempty"`
	CrossSocketSetupCommandsWork bool   `json:"crossSocketSetupCommandsWork"`
	CrossSocketError             string `json:"crossSocketError,omitempty"`
	CloseSetupCC                 byte   `json:"closeSetupCc,omitempty"`
	CloseSetupError              string `json:"closeSetupError,omitempty"`
	Error                        string `json:"error,omitempty"`
}

func ProbeOpenBMCSetupState

func ProbeOpenBMCSetupState(host string, port int, username string, suite CipherAlgos, timeout time.Duration) (*OpenBMCSetupProbe, error)

type OpenBMCSetupSession

type OpenBMCSetupSession struct {
	// contains filtered or unexported fields
}

func OpenOpenBMCSetupSession

func OpenOpenBMCSetupSession(host string, port int, username string, suite CipherAlgos, timeout time.Duration) (*OpenBMCSetupSession, error)

func (*OpenBMCSetupSession) Close

func (s *OpenBMCSetupSession) Close()

func (*OpenBMCSetupSession) Exec

func (s *OpenBMCSetupSession) Exec(netfn, cmd byte, data []byte) (byte, []byte, error)

func (*OpenBMCSetupSession) RequestSessionPrivilege

func (s *OpenBMCSetupSession) RequestSessionPrivilege(requested byte) (SetPrivAttempt, error)

func (*OpenBMCSetupSession) SetPrivilegeAttempts

func (s *OpenBMCSetupSession) SetPrivilegeAttempts() []SetPrivAttempt

type PostAuthCollection

type PostAuthCollection struct {
	Flow            AuthFlow          `json:"flow"`
	CipherMatrix    []CipherAttempt   `json:"cipherMatrix,omitempty"`
	SetPrivAttempts []SetPrivAttempt  `json:"setPrivAttempts,omitempty"`
	OpenBMCSetup    *OpenBMCSetupData `json:"openbmcSetup,omitempty"`
	MCInfo          *MCInfo           `json:"mcInfo,omitempty"`
	Chassis         *ChassisStatus    `json:"chassis,omitempty"`
	Users           []UserEntry       `json:"users,omitempty"`
	LAN             map[string]string `json:"lan,omitempty"`
	LAN6            map[string]string `json:"lan6,omitempty"`
	FRU             []FRUField        `json:"fru,omitempty"`

	CommandProtection string `json:"commandProtection,omitempty"`

	Error string `json:"-"`

	Completed    []string `json:"completed,omitempty"`
	Empty        []string `json:"empty,omitempty"`
	IncompleteAt string   `json:"incompleteAt,omitempty"`
}

func CollectPostAuthInventory

func CollectPostAuthInventory(ctx context.Context, host string, port int, flow AuthFlow, timeout time.Duration) (*PostAuthCollection, error)

func (PostAuthCollection) MarshalJSON

func (p PostAuthCollection) MarshalJSON() ([]byte, error)

type PreAuthMapConfig

type PreAuthMapConfig struct {
	NetFns              []byte
	Cmds                []byte
	RunSessionZeroCheck bool
	RunIPMBSweep        bool
	RunRAKPChecks       bool
	RAKPUsers           []string
	Timeout             time.Duration
	LeakLenThreshold    int
	RepeatCount         int
	Concurrency         int
	Logf                func(string)
}

type PreAuthMapResult

type PreAuthMapResult struct {
	Host string `json:"host"`
	Port int    `json:"port"`

	StartedAt  time.Time `json:"startedAt"`
	FinishedAt time.Time `json:"finishedAt"`

	Requests []PreAuthRequestResult `json:"requests"`
	RAKP     []RAKPPreAuthResult    `json:"rakp,omitempty"`

	ResponseCount        int `json:"responseCount"`
	AcceptedCount        int `json:"acceptedCount"`
	PotentialLeakCount   int `json:"potentialLeakCount"`
	PotentialBypassCount int `json:"potentialBypassCount"`
}

func MapPreAuthSurface

func MapPreAuthSurface(host string, port int, cfg PreAuthMapConfig) (*PreAuthMapResult, error)

type PreAuthRequestResult

type PreAuthRequestResult struct {
	Mode           string `json:"mode"`
	NetFn          byte   `json:"netfn,omitempty"`
	Cmd            byte   `json:"cmd,omitempty"`
	IPMBAddr       byte   `json:"ipmbAddr,omitempty"`
	ResponseSeen   bool   `json:"responseSeen"`
	CompletionCode byte   `json:"completionCode,omitempty"`
	ParsedCC       bool   `json:"parsedCc"`
	ResponseLen    int    `json:"responseLen,omitempty"`
	ResponsePrefix string `json:"responsePrefix,omitempty"`
	Error          string `json:"error,omitempty"`

	PotentialMemoryLeak bool   `json:"potentialMemoryLeak"`
	LeakReason          string `json:"leakReason,omitempty"`

	PotentialAuthBypass bool   `json:"potentialAuthBypass"`
	BypassReason        string `json:"bypassReason,omitempty"`
}

type RAKPPreAuthResult

type RAKPPreAuthResult struct {
	Username            string `json:"username"`
	ErrorCode           byte   `json:"errorCode"`
	HashLen             int    `json:"hashLen"`
	GUIDPrefix          string `json:"guidPrefix,omitempty"`
	PotentialHashLeak   bool   `json:"potentialHashLeak"`
	PotentialUserOracle bool   `json:"potentialUserOracle"`
	Error               string `json:"error,omitempty"`
}

type RAKPResult

type RAKPResult struct {
	Host           string
	Username       string
	AuthAlgo       byte
	IntegrityAlgo  byte
	ConfAlgo       byte
	ClientSID      uint32
	BMCSID         uint32
	ClientRand     []byte
	BMCRand        []byte
	BMCGUID        []byte
	RAKPHash       []byte
	ErrorCode      byte
	OpenSessionRaw []byte
	RAKP2Raw       []byte

	Crack *CrackResult
}

func DoRAKP12

func DoRAKP12(host string, port int, username string, authAlgo, intAlgo, confAlgo byte, timeout time.Duration) (*RAKPResult, error)

func SendRAKP1ToSession

func SendRAKP1ToSession(c *Client, bmcSID uint32, cRand []byte, username string, role byte) (*RAKPResult, error)

func (*RAKPResult) Hashcat

func (r *RAKPResult) Hashcat() string

func (*RAKPResult) Salt

func (r *RAKPResult) Salt() []byte

func (*RAKPResult) SaltHashLine

func (r *RAKPResult) SaltHashLine() string

func (*RAKPResult) UsesSMCRAKPFixedKey

func (r *RAKPResult) UsesSMCRAKPFixedKey() bool

func (*RAKPResult) VerifyRAKPKey

func (r *RAKPResult) VerifyRAKPKey(key []byte) bool

func (*RAKPResult) VerifyRAKPPassword

func (r *RAKPResult) VerifyRAKPPassword(password string) bool

type SIDClass

type SIDClass struct {
	Pattern string
	Detail  string
	Delta   uint32
	Lo, Hi  uint32
}

func ClassifySessionIDs

func ClassifySessionIDs(sids []uint32) (SIDClass, bool)

func (SIDClass) CheckID

func (c SIDClass) CheckID() string

type SIDCorrelationConfig

type SIDCorrelationConfig struct {
	RandomizeInputOrder bool

	Seed int64

	ConfidenceLevel float64

	Logf func(string)
}

type SIDCorrelationResult

type SIDCorrelationResult struct {
	Host string

	Trials int

	ClientSIDs  []uint32
	ManagedSIDs []uint32

	MutualInfoBits float64

	BitCorrelation [32]float64

	MaxBitCorr float64

	PerBitPValue [32]float64

	PerBitCILow  [32]float64
	PerBitCIHigh [32]float64

	ConfidenceLevel float64

	SignificantBits []int

	Finding string
}

func MeasureSIDClientCorrelation

func MeasureSIDClientCorrelation(host string, port int, trials int, timeout time.Duration) (*SIDCorrelationResult, error)

func MeasureSIDClientCorrelationWithConfig

func MeasureSIDClientCorrelationWithConfig(host string, port int, trials int, timeout time.Duration, cfg *SIDCorrelationConfig) (*SIDCorrelationResult, error)

type SMCConfigCipher

type SMCConfigCipher string
const (
	SMCCipherAES128CBC SMCConfigCipher = "aes-128-cbc"
	SMCCipher3DESCBC   SMCConfigCipher = "3des-ede3-cbc"
)

type SMCConfigXfer

type SMCConfigXfer struct {
	UploadChunk   int
	DownloadChunk int
	PollInterval  time.Duration
	PollDeadline  time.Duration
	// contains filtered or unexported fields
}

func NewSMCConfigXfer

func NewSMCConfigXfer(sess *CmdSess) *SMCConfigXfer

func (*SMCConfigXfer) Export

func (x *SMCConfigXfer) Export(ctx context.Context, ftype byte) ([]byte, error)

type SMCCryptoProfile

type SMCCryptoProfile struct {
	Cipher SMCConfigCipher
	Key    []byte
	IV     []byte
}

func SMCCryptoProfileForGeneration

func SMCCryptoProfileForGeneration(gen string) (SMCCryptoProfile, bool)

type SMCGenerationResult

type SMCGenerationResult struct {
	Generation  string `json:"generation"`
	ModelPrefix string `json:"modelPrefix"`
	GUIDHex     string `json:"guidHex"`
}

type SMCRAKPOnlinePasswordReport

type SMCRAKPOnlinePasswordReport struct {
	Attempted  bool         `json:"attempted"`
	Usernames  []string     `json:"usernames,omitempty"`
	Suites     []int        `json:"suites,omitempty"`
	Candidates int          `json:"candidates"`
	Attempts   int          `json:"attempts"`
	SessionOK  bool         `json:"sessionOk"`
	Credential *CrackResult `json:"credential,omitempty"`
}

func RunSMCRAKPOnlinePasswordEnum

func RunSMCRAKPOnlinePasswordEnum(ctx context.Context, host string, port int, auth *AuthReport, opts AuthOptions, progressEvery int, onProgress func(attempts int, sessionAlive bool)) *SMCRAKPOnlinePasswordReport

type SMCRAKPOrderProbe

type SMCRAKPOrderProbe struct {
	Host       string `json:"host"`
	Port       int    `json:"port"`
	ConsoleSID uint32 `json:"consoleSid"`
	BMCSID     uint32 `json:"bmcSid"`

	CipherSuite int `json:"cipherSuite"`

	Answered        bool   `json:"answered"`
	RAKP4Status     byte   `json:"rakp4Status"`
	RAKP4StatusText string `json:"rakp4StatusText,omitempty"`

	SIDEchoed bool   `json:"sidEchoed"`
	EchoedSID uint32 `json:"echoedSid,omitempty"`

	Defect bool `json:"defect"`

	SpecConformant bool `json:"specConformant"`

	Activated bool   `json:"activated"`
	Error     string `json:"error,omitempty"`
}

func ProbeSMCRAKPOrder

func ProbeSMCRAKPOrder(host string, port int, timeout time.Duration) (*SMCRAKPOrderProbe, error)

func (*SMCRAKPOrderProbe) Summary

func (p *SMCRAKPOrderProbe) Summary() string

type SMCRoleClampProbe

type SMCRoleClampProbe struct {
	Host string `json:"host"`
	Port int    `json:"port"`

	Username string `json:"username"`

	UsernameCandidates []string `json:"usernameCandidates,omitempty"`

	BaselineRole     byte `json:"baselineRole"`
	BaselineStatus   byte `json:"baselineStatus"`
	BaselineAccepted bool `json:"baselineAccepted"`

	ConformantRole     byte `json:"conformantRole"`
	ConformantStatus   byte `json:"conformantStatus"`
	ConformantAccepted bool `json:"conformantAccepted"`
	ReservedRole       byte `json:"probeRole"`
	ReservedStatus     byte `json:"probeRoleStatus"`
	ReservedAccepted   bool `json:"probeRoleAccepted"`

	ProbeRejectedConformantly bool `json:"probeRoleRejectedConformantly"`

	Defect bool   `json:"defect"`
	Error  string `json:"error,omitempty"`
}

func ProbeSMCRoleClamp

func ProbeSMCRoleClamp(host string, port int, preferredUser string, timeout time.Duration) (*SMCRoleClampProbe, error)

func (*SMCRoleClampProbe) Summary

func (p *SMCRoleClampProbe) Summary() string

type SOLConfig

type SOLConfig struct {
	ParamRevision byte `json:"paramRevision,omitempty"`

	Enabled   bool `json:"enabled"`
	EnabledOK bool `json:"enabledOk"`

	RequiredPrivilege   byte `json:"requiredPrivilege,omitempty"`
	RequiredPrivilegeOK bool `json:"requiredPrivilegeOk"`

	PayloadChannel   byte   `json:"payloadChannel,omitempty"`
	PayloadChannelOK bool   `json:"payloadChannelOk"`
	PayloadPort      uint16 `json:"payloadPort,omitempty"`
	PayloadPortOK    bool   `json:"payloadPortOk"`

	Params map[byte]string `json:"params,omitempty"`
}

func (*SOLConfig) Readable

func (s *SOLConfig) Readable() bool

func (*SOLConfig) Summary

func (s *SOLConfig) Summary() string

type Session15

type Session15 struct {
	AuthType   byte
	Password   string
	SessionID  uint32
	InboundSeq uint32
	MaxPriv    byte
}

func Login15

func Login15(host string, port int, authType byte, username, password string, timeout time.Duration) (*Session15, byte, error)

type Session20

type Session20 struct {
	// contains filtered or unexported fields
}

func OpenSession20

func OpenSession20(host string, port int, username, password string, suite CipherAlgos, timeout time.Duration) (*Session20, error)

func OpenSession20NullUser

func OpenSession20NullUser(host string, port int, username string, suite CipherAlgos, timeout time.Duration) (*Session20, byte, error)

func OpenSession20User

func OpenSession20User(host string, port int, username, password string, suite CipherAlgos, timeout time.Duration) (*Session20, error)

func OpenSession20WithKey

func OpenSession20WithKey(host string, port int, username string, key []byte, suite CipherAlgos, timeout time.Duration) (*Session20, error)

func (*Session20) Close

func (s *Session20) Close()

func (*Session20) CommandProtectionUsed

func (s *Session20) CommandProtectionUsed() string

func (*Session20) Exec

func (s *Session20) Exec(netfn, cmd byte, data []byte) (byte, []byte, error)

func (*Session20) PresentPrivilege

func (s *Session20) PresentPrivilege() (level byte, cc byte, err error)

func (*Session20) ReadSOLConfig

func (s *Session20) ReadSOLConfig(channel byte) *SOLConfig

func (*Session20) RequestSessionPrivilege

func (s *Session20) RequestSessionPrivilege(requested byte) (SetPrivAttempt, error)

func (*Session20) SetCommandProtection

func (s *Session20) SetCommandProtection(mode commandProtection)

func (*Session20) SetPrivilegeAttempts

func (s *Session20) SetPrivilegeAttempts() []SetPrivAttempt

type SetPrivAttempt

type SetPrivAttempt struct {
	Requested byte   `json:"requested"`
	Name      string `json:"name,omitempty"`
	Success   bool   `json:"success"`
	CC        byte   `json:"cc,omitempty"`
	Granted   byte   `json:"granted,omitempty"`
	Error     string `json:"error,omitempty"`
}

type UserEntry

type UserEntry struct {
	ID       int    `json:"id"`
	Name     string `json:"name,omitempty"`
	Priv     string `json:"priv"`
	Enabled  bool   `json:"enabled"`
	LinkAuth bool   `json:"linkAuth"`
	IPMIAuth bool   `json:"ipmiAuth"`
	Callin   bool   `json:"callin"`
	Raw      string `json:"raw,omitempty"`
}

type V15Capabilities

type V15Capabilities struct {
	ConfirmedPriv byte `json:"confirmedPriv"`

	SetPrivOK bool `json:"setPrivOk"`

	SetPrivCC byte `json:"setPrivCc"`

	ReadOK bool `json:"readOk"`

	ReadCC byte `json:"readCc"`

	Detail string `json:"detail,omitempty"`
}

func (*V15Capabilities) Proof

func (c *V15Capabilities) Proof() string

type V15CredResult

type V15CredResult struct {
	Username string           `json:"username"`
	Password string           `json:"password"`
	Via      string           `json:"via"`
	Priv     byte             `json:"priv"`
	Caps     *V15Capabilities `json:"caps,omitempty"`
}

type V15Options

type V15Options struct {
	Vendor  string
	Caps    *AuthCaps
	Online  bool
	Timeout time.Duration
}

type V15OracleEntry

type V15OracleEntry struct {
	Username string `json:"username"`
	CC       byte   `json:"cc"`
}

type V15Report

type V15Report struct {
	Host           string           `json:"host"`
	Port           int              `json:"port"`
	AuthNoneOK     bool             `json:"authNoneSession"`
	AuthNonePriv   byte             `json:"authNonePriv"`
	AuthNoneCaps   *V15Capabilities `json:"authNoneCaps,omitempty"`
	DefaultCred    *V15CredResult   `json:"defaultCred,omitempty"`
	ValidUsernames []V15OracleEntry `json:"validUsernames,omitempty"`

	OracleInvalidUser string `json:"oracleInvalidUser,omitempty"`
	OracleInvalidCC   byte   `json:"oracleInvalidCc,omitempty"`
}

func RunSession15

func RunSession15(ctx context.Context, host string, port int, opts V15Options) *V15Report

Jump to

Keyboard shortcuts

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