session

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Username string   `json:"u,omitempty"`
	Hostname string   `json:"h,omitempty"`
	Domain   string   `json:"d,omitempty"`
	IPs      []string `json:"i,omitempty"`
	OSMeta   string   `json:"om,omitempty"`
	ProcName string   `json:"pn,omitempty"`
	IsPriv   bool     `json:"ip,omitempty"`
	Extra    string   `json:"e,omitempty"`
}

Agent metadata

type Session

type Session struct {
	ID         string
	AgentID    string
	CreatedAt  time.Time
	Metadata   Metadata
	RemoteAddr string
	SSHConn    *ssh.ServerConn
}

func NewSession

func NewSession(encMetadata string, sshConn *ssh.ServerConn) (*Session, error)

type SessionManager

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

func NewSessionManager

func NewSessionManager(ctx context.Context, db *database.Database) *SessionManager

func (*SessionManager) AddSession

func (s *SessionManager) AddSession(encMetadata string, sshConn *ssh.ServerConn) (*Session, error)

func (*SessionManager) CountSessions

func (s *SessionManager) CountSessions() int

func (*SessionManager) GetSession

func (s *SessionManager) GetSession(id string) *Session

GetSession returns session if it exists by agent ID

func (*SessionManager) ListComments added in v0.2.2

func (s *SessionManager) ListComments() map[string]string

func (*SessionManager) ListSessions

func (s *SessionManager) ListSessions() []*Session

func (*SessionManager) RemoveSession

func (s *SessionManager) RemoveSession(session *Session)

Jump to

Keyboard shortcuts

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