unifi

package
v0.0.0-...-18e6872 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// md5sum of "ubnt"
	MASTER_KEY = []byte{0xba, 0x86, 0xf2, 0xbb, 0xe1, 0x07, 0xc7, 0xc5, 0x7e, 0xb5, 0xf2, 0x69, 0x07, 0x75, 0xc7, 0x12}

	ErrDataLength = fmt.Errorf("Data length is larger than packet size")
)

Functions

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int, after int) []byte

Types

type InformBuilder

type InformBuilder struct {
	Key []byte
	// contains filtered or unexported fields
}

func NewInformBuilder

func NewInformBuilder(packet []byte) (*InformBuilder, error)

func (InformBuilder) BuildResponse

func (p InformBuilder) BuildResponse(r any) ([]byte, error)

func (*InformBuilder) Decrypt

func (p *InformBuilder) Decrypt()

func (*InformBuilder) Encrypt

func (p *InformBuilder) Encrypt(b []byte) error

func (InformBuilder) GetMac

func (p InformBuilder) GetMac() string

func (*InformBuilder) Init

func (p *InformBuilder) Init(ipd InformPD)

func (InformBuilder) String

func (p InformBuilder) String() string

func (InformBuilder) Uncompress

func (p InformBuilder) Uncompress() (io.Reader, error)

type InformCommandResponse

type InformCommandResponse struct {
	// value "cmd"
	Type  string `json:"_type"`
	Admin struct {
		// database id of admin
		ID string `json:"_id"`
		// admin language (en_US)
		Lang     string `json:"lang"`
		Name     string `json:"name"`
		Password string `json:"x_password"`
	} `json:"_admin"`
	// unknown id string (5232701de4b0457a2f2f031f)
	ID            string `json:"_id"`
	DateTime      string `json:"datetime"`
	ServerTimeUTC int64  `json:"server_time_in_utc"`
	Time          int64  `json:"time"`
	// device ID from database
	DeviceID   string `json:"device_id"`
	Command    string `json:"cmd"`
	MAC        string `json:"mac"`
	Model      string `json:"model"`
	Parameters string `json:"-"`
}

InformCommandResponse is a command response

type InformConfigUpdateResponse

type InformConfigUpdateResponse struct {
	// value "setparam"
	Type             string `json:"_type"`
	PortConfig       string `json:"port_cfg"`
	AnalogConfig     string `json:"analog_cfg"`
	AuthorizedGuests string `json:"authorized_guests"`
	BlockedStations  string `json:"blocked_stations"`
	ConfigVersion    string `json:"cfg_version"`
	ManagementConfig string `json:"mgmt_cfg"`
	SystemConfig     string `json:"system_cfg"`
	ServerTimeUTC    int64  `json:"server_time_in_utc"`
}

InformConfigUpdateResponse is a config update command

type InformHeartbeatResponse

type InformHeartbeatResponse struct {
	// value "noop"
	Type          string `json:"_type"`
	Interval      int64  `json:"interval"`
	ServerTimeUTC int64  `json:"server_time_in_utc"`
}

An InformHeartbeatResponse is a heartbeat response to an Inform request.

swagger:response informResponse

type InformLocateResponse

type InformLocateResponse struct {
	// value "cmd"
	Type string `json:"_type"`
	// value "locate"
	Command string `json:"cmd"`
	// rfc3339 formatted date, server time
	DateTime string `json:"datetime"`
	// device ID from database
	DeviceID      string `json:"device_id"`
	ServerTimeUTC int64  `json:"server_time_in_utc"`
	// server time as unix timestamp
	Time int64 `json:"time"`
	// unknown id string (5232701de4b0457a2f2f031f)
	ID string `json:"_id"`
}

InformLocateResponse is a locate command

type InformPD

type InformPD struct {
	// Layout of the packet:
	Magic       int32  // must be 1414414933
	Version     int32  // int32
	Mac         string // 6 bytes
	Flags       int16  // encrypted, compressed, snappy, aesgcm
	InitVector  []byte // 16 bytes
	DataVersion int32  //  must be < 1
	DataLength  int32
	Payload     []byte

	// These fields are used for crypto
	// AAD is the header of the packet
	AAD []byte
	// Tag is the last 16 bytes of the packet
	Tag []byte
}

type InformRebootResponse

type InformRebootResponse struct {
	// value "reboot"
	Type string `json:"_type"`
	// device ID from database
	DeviceID      string `json:"device_id"`
	ServerTimeUTC int64  `json:"server_time_in_utc"`
	// server time as unix timestamp
	Time int64 `json:"time"`
	// unknown id string (5232701de4b0457a2f2f031f)
	ID string `json:"_id"`
}

InformRebootResponse is a reboot command

type InformUpgradeResponse

type InformUpgradeResponse struct {
	// value "upgrade"
	Type string `json:"_type"`
	URL  string `json:"url"`
	// rfc3339 formatted date, server time
	DateTime      string `json:"datetime"`
	ServerTimeUTC int64  `json:"server_time_in_utc"`
	// Firmware version
	Version string `json:"version"`
	// Server time as unix timestamp
	Time int64 `json:"time"`
	// unknown id string (5232701de4b0457a2f2f031f)
	ID string `json:"_id"`
	// device ID from database
	DeviceID string `json:"device_id"`
}

An InformUpgradeResponse is an upgrade command

Jump to

Keyboard shortcuts

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