Documentation
¶
Overview ¶
Package gomsf provides a Go client for Metasploit's RPC API.
The package is organized around a Client plus manager types for each RPC domain, including core operations, modules, consoles, sessions, jobs, plugins, authentication, and database access.
Typical usage starts with NewClient or NewClientWithToken, then accesses managers from the client:
client, err := gomsf.NewClient("password", gomsf.WithSSL(false))
if err != nil {
return err
}
version, err := client.Core().Version(ctx)
if err != nil {
return err
}
The package prefers explicit failures over silent coercion. Malformed RPC payloads return ErrUnexpectedResponse. Structured Metasploit RPC failures return *RPCError and match ErrRPC. Command helper methods for consoles and sessions return ErrCommandTimeout. Module option validation errors match ErrInvalidOption.
Clients created with NewClient recover automatically when msfrpcd rejects their token (after a restart or token removal): the call re-authenticates once and retries. Clients created with NewClientWithToken have no stored password and surface the RPC error instead.
Client.Events starts an EventMonitor that polls session.list, job.list and any watched session or console output streams, and emits state changes on a channel. It is the intended foundation for UIs and automation:
monitor := client.Events(ctx)
for event := range monitor.C() {
switch event.Type {
case gomsf.EventSessionOpened:
monitor.WatchSession(event.SessionID)
case gomsf.EventSessionOutput:
fmt.Print(event.Data)
}
}
Note that the monitor consumes output: watching a session or console transfers ownership of its output stream, because the underlying RPC reads drain the server-side buffer.
Live Metasploit integration tests are opt-in through RUN_MSF_INTEGRATION=1.
Index ¶
- Variables
- type AuthManager
- type Client
- func (c *Client) Auth() *AuthManager
- func (c *Client) Call(ctx context.Context, method MsfRpcMethod, args ...interface{}) (interface{}, error)
- func (c *Client) Consoles() *ConsoleManager
- func (c *Client) Core() *CoreManager
- func (c *Client) DB() *DbManager
- func (c *Client) Events(ctx context.Context, opts ...EventOption) *EventMonitor
- func (c *Client) IsAuthenticated() bool
- func (c *Client) Jobs() *JobManager
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) Modules() *ModuleManager
- func (c *Client) Plugins() *PluginManager
- func (c *Client) Sessions() *SessionManager
- func (c *Client) Token() string
- type ClientOption
- func WithConsolePollInterval(interval time.Duration) ClientOption
- func WithHTTPClient(client *http.Client) ClientOption
- func WithHost(host string) ClientOption
- func WithPort(port int) ClientOption
- func WithSSL(ssl bool) ClientOption
- func WithSessionPollInterval(interval time.Duration) ClientOption
- func WithURI(uri string) ClientOption
- func WithUsername(username string) ClientOption
- type Console
- type ConsoleManager
- func (m *ConsoleManager) Create(ctx context.Context) (*Console, error)
- func (m *ConsoleManager) Destroy(ctx context.Context, cid string) error
- func (m *ConsoleManager) GetConsole(ctx context.Context, cid string) (*MsfConsole, error)
- func (m *ConsoleManager) List(ctx context.Context) ([]*Console, error)
- type ConsoleReadResult
- type CoreManager
- func (m *CoreManager) AddModulePath(ctx context.Context, path string) error
- func (m *CoreManager) KillThread(ctx context.Context, threadID string) error
- func (m *CoreManager) ModuleStats(ctx context.Context) (map[string]interface{}, error)
- func (m *CoreManager) ReloadModules(ctx context.Context) error
- func (m *CoreManager) Save(ctx context.Context) error
- func (m *CoreManager) SetGlobal(ctx context.Context, key, value string) error
- func (m *CoreManager) Stop(ctx context.Context) error
- func (m *CoreManager) ThreadList(ctx context.Context) (map[string]interface{}, error)
- func (m *CoreManager) UnsetGlobal(ctx context.Context, key string) error
- func (m *CoreManager) Version(ctx context.Context) (*VersionInfo, error)
- type Credential
- type DbManager
- func (m *DbManager) Connect(ctx context.Context, opts map[string]interface{}) error
- func (m *DbManager) Creds(ctx context.Context, opts map[string]interface{}) ([]*Credential, error)
- func (m *DbManager) CurrentWorkspace(ctx context.Context) (string, error)
- func (m *DbManager) Disconnect(ctx context.Context) error
- func (m *DbManager) Driver(ctx context.Context) (string, error)
- func (m *DbManager) Hosts(ctx context.Context, opts map[string]interface{}) ([]*Host, error)
- func (m *DbManager) Loots(ctx context.Context, opts map[string]interface{}) ([]*Loot, error)
- func (m *DbManager) Services(ctx context.Context, opts map[string]interface{}) ([]*Service, error)
- func (m *DbManager) SetWorkspace(ctx context.Context, name string) error
- func (m *DbManager) Status(ctx context.Context) (map[string]interface{}, error)
- func (m *DbManager) Vulns(ctx context.Context, opts map[string]interface{}) ([]*Vuln, error)
- func (m *DbManager) Workspaces() *WorkspaceManager
- type Event
- type EventMonitor
- type EventOption
- type EventType
- type Host
- type Job
- type JobManager
- type Loot
- type MeterpreterSession
- func (s *MeterpreterSession) Detach(ctx context.Context) error
- func (s *MeterpreterSession) DirectorySeparator(ctx context.Context) (string, error)
- func (s *MeterpreterSession) Kill(ctx context.Context) error
- func (s *MeterpreterSession) Read(ctx context.Context) (string, error)
- func (s *MeterpreterSession) RunScript(ctx context.Context, path string) (string, error)
- func (s *MeterpreterSession) RunSingle(ctx context.Context, cmd string) (string, error)
- func (s *MeterpreterSession) RunWithOutput(ctx context.Context, cmd string, endStrings []string, timeout time.Duration) (string, error)
- func (s *MeterpreterSession) Tabs(ctx context.Context, line string) ([]string, error)
- func (s *MeterpreterSession) Write(ctx context.Context, data string) error
- type Module
- func (m *Module) CompatiblePayloads(ctx context.Context) ([]string, error)
- func (m *Module) CompatibleSessions(ctx context.Context) ([]string, error)
- func (m *Module) Execute(ctx context.Context) (*ModuleExecuteResult, error)
- func (m *Module) ExecuteWithPayload(ctx context.Context, payload *Module) (*ModuleExecuteResult, error)
- func (m *Module) GetOption(option string) (interface{}, error)
- func (m *Module) MissingRequired() []string
- func (m *Module) OptionInfo(option string) (*MsfModuleOption, error)
- func (m *Module) Options() []string
- func (m *Module) RequiredOptions() []string
- func (m *Module) RunOptions() map[string]interface{}
- func (m *Module) SetOption(option string, value interface{}) error
- func (m *Module) Targets() []string
- type ModuleExecuteResult
- type ModuleManager
- func (m *ModuleManager) Auxiliary(ctx context.Context) ([]string, error)
- func (m *ModuleManager) CompatiblePayloads(ctx context.Context, name string) ([]string, error)
- func (m *ModuleManager) CompatibleSessions(ctx context.Context, name string) ([]string, error)
- func (m *ModuleManager) Encoders(ctx context.Context) ([]string, error)
- func (m *ModuleManager) Evasion(ctx context.Context) ([]string, error)
- func (m *ModuleManager) Execute(ctx context.Context, modType ModuleType, name string, ...) (*ModuleExecuteResult, error)
- func (m *ModuleManager) Exploits(ctx context.Context) ([]string, error)
- func (m *ModuleManager) Info(ctx context.Context, modType ModuleType, name string) (*MsfModuleInfo, error)
- func (m *ModuleManager) Nops(ctx context.Context) ([]string, error)
- func (m *ModuleManager) Payloads(ctx context.Context) ([]string, error)
- func (m *ModuleManager) Post(ctx context.Context) ([]string, error)
- func (m *ModuleManager) Use(ctx context.Context, modType ModuleType, name string) (*Module, error)
- type ModuleReference
- type ModuleType
- type MsfConsole
- func (c *MsfConsole) IsBusy(ctx context.Context) (bool, error)
- func (c *MsfConsole) Read(ctx context.Context) (*ConsoleReadResult, error)
- func (c *MsfConsole) RunCommand(ctx context.Context, command string, timeout time.Duration) (string, error)
- func (c *MsfConsole) SessionDetach(ctx context.Context) error
- func (c *MsfConsole) SessionKill(ctx context.Context) error
- func (c *MsfConsole) Tabs(ctx context.Context, line string) ([]string, error)
- func (c *MsfConsole) Write(ctx context.Context, command string) error
- type MsfModuleInfo
- type MsfModuleOption
- type MsfRpcMethod
- type PluginManager
- type RPCCaller
- type RPCError
- type Service
- type Session
- type SessionManager
- func (m *SessionManager) CompatibleModules(ctx context.Context, sid string) ([]string, error)
- func (m *SessionManager) Get(ctx context.Context, sid string) (*Session, error)
- func (m *SessionManager) List(ctx context.Context) (map[string]*Session, error)
- func (m *SessionManager) Stop(ctx context.Context, sid string) error
- type ShellSession
- func (s *ShellSession) Read(ctx context.Context) (string, error)
- func (s *ShellSession) RunWithOutput(ctx context.Context, cmd string, endStrings []string, timeout time.Duration) (string, error)
- func (s *ShellSession) Upgrade(ctx context.Context, lhost string, lport int) error
- func (s *ShellSession) Write(ctx context.Context, data string) error
- type VersionInfo
- type Vuln
- type Workspace
- type WorkspaceManager
- func (m *WorkspaceManager) Add(ctx context.Context, name string) error
- func (m *WorkspaceManager) Current(ctx context.Context) (*Workspace, error)
- func (m *WorkspaceManager) Get(ctx context.Context, name string) (*Workspace, error)
- func (m *WorkspaceManager) List(ctx context.Context) ([]string, error)
- func (m *WorkspaceManager) Remove(ctx context.Context, name string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotAuthenticated = errors.New("not authenticated") ErrInvalidOption = errors.New("invalid module option") ErrSessionNotFound = errors.New("session not found") ErrConsoleNotFound = errors.New("console not found") ErrJobNotFound = errors.New("job not found") ErrUnexpectedResponse = errors.New("unexpected rpc response") ErrCommandTimeout = errors.New("command timeout") ErrRPC = errors.New("rpc error") )
Functions ¶
This section is empty.
Types ¶
type AuthManager ¶
type AuthManager struct {
// contains filtered or unexported fields
}
func NewAuthManager ¶
func NewAuthManager(rpc RPCCaller) *AuthManager
func (*AuthManager) TokenAdd ¶
func (m *AuthManager) TokenAdd(ctx context.Context, token string) error
func (*AuthManager) TokenGenerate ¶
func (m *AuthManager) TokenGenerate(ctx context.Context) (string, error)
func (*AuthManager) TokenList ¶
func (m *AuthManager) TokenList(ctx context.Context) ([]string, error)
func (*AuthManager) TokenRemove ¶
func (m *AuthManager) TokenRemove(ctx context.Context, token string) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithToken ¶
func NewClientWithToken(token string, opts ...ClientOption) (*Client, error)
func (*Client) Auth ¶
func (c *Client) Auth() *AuthManager
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, method MsfRpcMethod, args ...interface{}) (interface{}, error)
Call performs an RPC round trip. If the server rejects the token and the client was constructed with NewClient, it re-authenticates once and retries. Logout is exempt: a rejected token there only ends the local session.
func (*Client) Consoles ¶
func (c *Client) Consoles() *ConsoleManager
func (*Client) Core ¶
func (c *Client) Core() *CoreManager
func (*Client) Events ¶
func (c *Client) Events(ctx context.Context, opts ...EventOption) *EventMonitor
Events starts an EventMonitor against the connected msfrpcd. Cancel ctx to stop it; the returned channel is closed after the monitor stops.
func (*Client) IsAuthenticated ¶
func (*Client) Jobs ¶
func (c *Client) Jobs() *JobManager
func (*Client) Modules ¶
func (c *Client) Modules() *ModuleManager
func (*Client) Plugins ¶
func (c *Client) Plugins() *PluginManager
func (*Client) Sessions ¶
func (c *Client) Sessions() *SessionManager
type ClientOption ¶
type ClientOption func(*Client)
func WithConsolePollInterval ¶
func WithConsolePollInterval(interval time.Duration) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
func WithHost ¶
func WithHost(host string) ClientOption
func WithPort ¶
func WithPort(port int) ClientOption
func WithSSL ¶
func WithSSL(ssl bool) ClientOption
func WithSessionPollInterval ¶
func WithSessionPollInterval(interval time.Duration) ClientOption
func WithURI ¶
func WithURI(uri string) ClientOption
func WithUsername ¶
func WithUsername(username string) ClientOption
type ConsoleManager ¶
type ConsoleManager struct {
// contains filtered or unexported fields
}
func NewConsoleManager ¶
func NewConsoleManager(rpc RPCCaller) *ConsoleManager
func (*ConsoleManager) Create ¶
func (m *ConsoleManager) Create(ctx context.Context) (*Console, error)
func (*ConsoleManager) Destroy ¶
func (m *ConsoleManager) Destroy(ctx context.Context, cid string) error
func (*ConsoleManager) GetConsole ¶
func (m *ConsoleManager) GetConsole(ctx context.Context, cid string) (*MsfConsole, error)
type ConsoleReadResult ¶
type CoreManager ¶
type CoreManager struct {
// contains filtered or unexported fields
}
func NewCoreManager ¶
func NewCoreManager(rpc RPCCaller) *CoreManager
func (*CoreManager) AddModulePath ¶
func (m *CoreManager) AddModulePath(ctx context.Context, path string) error
func (*CoreManager) KillThread ¶
func (m *CoreManager) KillThread(ctx context.Context, threadID string) error
func (*CoreManager) ModuleStats ¶
func (m *CoreManager) ModuleStats(ctx context.Context) (map[string]interface{}, error)
func (*CoreManager) ReloadModules ¶
func (m *CoreManager) ReloadModules(ctx context.Context) error
func (*CoreManager) SetGlobal ¶
func (m *CoreManager) SetGlobal(ctx context.Context, key, value string) error
func (*CoreManager) ThreadList ¶
func (m *CoreManager) ThreadList(ctx context.Context) (map[string]interface{}, error)
func (*CoreManager) UnsetGlobal ¶
func (m *CoreManager) UnsetGlobal(ctx context.Context, key string) error
func (*CoreManager) Version ¶
func (m *CoreManager) Version(ctx context.Context) (*VersionInfo, error)
type Credential ¶
type Credential struct {
Host string `msgpack:"host" json:"host"`
Port int `msgpack:"port" json:"port"`
Proto string `msgpack:"proto" json:"proto"`
Service string `msgpack:"sname" json:"sname"`
User string `msgpack:"user" json:"user"`
Pass string `msgpack:"pass" json:"pass"`
Type string `msgpack:"type" json:"type"`
}
type DbManager ¶
type DbManager struct {
// contains filtered or unexported fields
}
func NewDbManager ¶
func (*DbManager) CurrentWorkspace ¶
func (*DbManager) SetWorkspace ¶
func (*DbManager) Workspaces ¶
func (m *DbManager) Workspaces() *WorkspaceManager
type Event ¶
type Event struct {
Type EventType
Timestamp time.Time
Session *Session
SessionID string
ConsoleID string
Job *Job
Data string
Err error
}
Event is one state change observed by an EventMonitor. Which fields are set depends on Type: SessionID and Session for session_opened/session_closed, SessionID and Data for session_output, ConsoleID and Data for console_output, Job for job_started/job_stopped, Err for error.
type EventMonitor ¶
type EventMonitor struct {
// contains filtered or unexported fields
}
EventMonitor polls session.list, job.list and watched output streams, and emits the resulting state changes on a channel. Sessions already open when the monitor starts are reported as session_opened, so a late-attaching UI receives the full current state.
Event delivery applies backpressure: when the consumer falls behind and the channel is full, polling pauses until the consumer drains it, so events are never dropped but a slow consumer slows the monitor down with it. Size the buffer with WithEventBuffer if consumers may stall.
Watching a session or console transfers ownership of its output to the monitor: session.shell_read / session.meterpreter_read / console.read drain the server-side buffer, so a watched stream must only be read through the monitor's events.
func NewEventMonitor ¶
func NewEventMonitor(ctx context.Context, rpc RPCCaller, opts ...EventOption) *EventMonitor
func (*EventMonitor) C ¶
func (m *EventMonitor) C() <-chan Event
C returns the event channel. It is closed when the monitor stops.
func (*EventMonitor) UnwatchConsole ¶
func (m *EventMonitor) UnwatchConsole(cid string)
UnwatchConsole removes a console from the polled output streams.
func (*EventMonitor) UnwatchSession ¶
func (m *EventMonitor) UnwatchSession(sid string)
UnwatchSession removes a session from the polled output streams.
func (*EventMonitor) WatchConsole ¶
func (m *EventMonitor) WatchConsole(cid string)
WatchConsole adds a console to the polled output streams.
func (*EventMonitor) WatchSession ¶
func (m *EventMonitor) WatchSession(sid string)
WatchSession adds a session to the polled output streams.
type EventOption ¶
type EventOption func(*EventMonitor)
func WithEventBuffer ¶
func WithEventBuffer(size int) EventOption
func WithEventJobInterval ¶
func WithEventJobInterval(interval time.Duration) EventOption
func WithEventOutputInterval ¶
func WithEventOutputInterval(interval time.Duration) EventOption
func WithEventSessionInterval ¶
func WithEventSessionInterval(interval time.Duration) EventOption
type EventType ¶
type EventType string
const ( EventSessionOpened EventType = "session_opened" EventSessionClosed EventType = "session_closed" EventSessionOutput EventType = "session_output" EventConsoleOutput EventType = "console_output" EventJobStarted EventType = "job_started" EventJobStopped EventType = "job_stopped" EventError EventType = "error" )
type Host ¶
type Host struct {
Address string `msgpack:"address" json:"address"`
Mac string `msgpack:"mac" json:"mac"`
Name string `msgpack:"name" json:"name"`
State string `msgpack:"state" json:"state"`
OSName string `msgpack:"os_name" json:"os_name"`
OSFlavor string `msgpack:"os_flavor" json:"os_flavor"`
OSVersion string `msgpack:"os_version" json:"os_version"`
OSSP string `msgpack:"os_sp" json:"os_sp"`
OSLang string `msgpack:"os_lang" json:"os_lang"`
Purpose string `msgpack:"purpose" json:"purpose"`
Info string `msgpack:"info" json:"info"`
Comments string `msgpack:"comments" json:"comments"`
Scope string `msgpack:"scope" json:"scope"`
VirtualHost string `msgpack:"virtual_host" json:"virtual_host"`
Arch string `msgpack:"arch" json:"arch"`
}
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
func NewJobManager ¶
func NewJobManager(rpc RPCCaller) *JobManager
type MeterpreterSession ¶
type MeterpreterSession struct {
SID string
// contains filtered or unexported fields
}
func NewMeterpreterSession ¶
func NewMeterpreterSession(rpc RPCCaller, sid string) *MeterpreterSession
func (*MeterpreterSession) DirectorySeparator ¶
func (s *MeterpreterSession) DirectorySeparator(ctx context.Context) (string, error)
func (*MeterpreterSession) Read ¶
func (s *MeterpreterSession) Read(ctx context.Context) (string, error)
func (*MeterpreterSession) RunWithOutput ¶
type Module ¶
type Module struct {
ModuleType ModuleType
Name string
Info *MsfModuleInfo
// contains filtered or unexported fields
}
func NewModuleWithContext ¶
func (*Module) CompatiblePayloads ¶
func (*Module) CompatibleSessions ¶
func (*Module) Execute ¶
func (m *Module) Execute(ctx context.Context) (*ModuleExecuteResult, error)
func (*Module) ExecuteWithPayload ¶
func (*Module) MissingRequired ¶
func (*Module) OptionInfo ¶
func (m *Module) OptionInfo(option string) (*MsfModuleOption, error)
func (*Module) RequiredOptions ¶
func (*Module) RunOptions ¶
type ModuleExecuteResult ¶
type ModuleManager ¶
type ModuleManager struct {
// contains filtered or unexported fields
}
func NewModuleManager ¶
func NewModuleManager(rpc RPCCaller) *ModuleManager
func (*ModuleManager) Auxiliary ¶
func (m *ModuleManager) Auxiliary(ctx context.Context) ([]string, error)
func (*ModuleManager) CompatiblePayloads ¶
CompatiblePayloads returns the payloads compatible with an exploit. The RPC takes the full module name only; the type is implied.
func (*ModuleManager) CompatibleSessions ¶
CompatibleSessions returns the sessions an exploit, auxiliary or post module can run against. The RPC infers the module type from the name prefix, so name must be the full module path.
func (*ModuleManager) Encoders ¶
func (m *ModuleManager) Encoders(ctx context.Context) ([]string, error)
func (*ModuleManager) Evasion ¶
func (m *ModuleManager) Evasion(ctx context.Context) ([]string, error)
func (*ModuleManager) Execute ¶
func (m *ModuleManager) Execute(ctx context.Context, modType ModuleType, name string, options map[string]interface{}) (*ModuleExecuteResult, error)
func (*ModuleManager) Exploits ¶
func (m *ModuleManager) Exploits(ctx context.Context) ([]string, error)
func (*ModuleManager) Info ¶
func (m *ModuleManager) Info(ctx context.Context, modType ModuleType, name string) (*MsfModuleInfo, error)
func (*ModuleManager) Payloads ¶
func (m *ModuleManager) Payloads(ctx context.Context) ([]string, error)
func (*ModuleManager) Use ¶
func (m *ModuleManager) Use(ctx context.Context, modType ModuleType, name string) (*Module, error)
type ModuleReference ¶
type ModuleType ¶
type ModuleType string
const ( ExploitModuleType ModuleType = "exploit" PayloadModuleType ModuleType = "payload" AuxiliaryModuleType ModuleType = "auxiliary" PostModuleType ModuleType = "post" EncoderModuleType ModuleType = "encoder" NopModuleType ModuleType = "nop" EvasionModuleType ModuleType = "evasion" )
type MsfConsole ¶
type MsfConsole struct {
CID string
// contains filtered or unexported fields
}
func NewMsfConsole ¶
func NewMsfConsole(rpc RPCCaller, cid string) *MsfConsole
func (*MsfConsole) Read ¶
func (c *MsfConsole) Read(ctx context.Context) (*ConsoleReadResult, error)
func (*MsfConsole) RunCommand ¶
func (*MsfConsole) SessionDetach ¶
func (c *MsfConsole) SessionDetach(ctx context.Context) error
func (*MsfConsole) SessionKill ¶
func (c *MsfConsole) SessionKill(ctx context.Context) error
type MsfModuleInfo ¶
type MsfModuleInfo struct {
Name string `msgpack:"name" json:"name"`
Description string `msgpack:"description" json:"description"`
License string `msgpack:"license" json:"license"`
FilePath string `msgpack:"filepath" json:"filepath"`
Version string `msgpack:"version" json:"version"`
Rank string `msgpack:"rank" json:"rank"`
Targets []string `msgpack:"targets" json:"targets"`
References []ModuleReference `msgpack:"references" json:"references"`
Authors []string `msgpack:"authors" json:"authors"`
}
type MsfModuleOption ¶
type MsfModuleOption struct {
Type string `msgpack:"type" json:"type"`
Required bool `msgpack:"required" json:"required"`
Advanced bool `msgpack:"advanced" json:"advanced"`
Evasion bool `msgpack:"evasion" json:"evasion"`
Desc string `msgpack:"desc" json:"desc"`
Default interface{} `msgpack:"default,omitempty" json:"default,omitempty"`
Enums []string `msgpack:"enums,omitempty" json:"enums,omitempty"`
}
type MsfRpcMethod ¶
type MsfRpcMethod string
const ( AuthLogin MsfRpcMethod = "auth.login" AuthLogout MsfRpcMethod = "auth.logout" AuthTokenList MsfRpcMethod = "auth.token_list" AuthTokenAdd MsfRpcMethod = "auth.token_add" AuthTokenGenerate MsfRpcMethod = "auth.token_generate" AuthTokenRemove MsfRpcMethod = "auth.token_remove" ConsoleCreate MsfRpcMethod = "console.create" ConsoleList MsfRpcMethod = "console.list" ConsoleDestroy MsfRpcMethod = "console.destroy" ConsoleRead MsfRpcMethod = "console.read" ConsoleWrite MsfRpcMethod = "console.write" ConsoleTabs MsfRpcMethod = "console.tabs" ConsoleSessionKill MsfRpcMethod = "console.session_kill" ConsoleSessionDetach MsfRpcMethod = "console.session_detach" CoreVersion MsfRpcMethod = "core.version" CoreStop MsfRpcMethod = "core.stop" CoreSetG MsfRpcMethod = "core.setg" CoreUnsetG MsfRpcMethod = "core.unsetg" CoreSave MsfRpcMethod = "core.save" CoreReloadModules MsfRpcMethod = "core.reload_modules" CoreModuleStats MsfRpcMethod = "core.module_stats" CoreAddModulePath MsfRpcMethod = "core.add_module_path" CoreThreadList MsfRpcMethod = "core.thread_list" CoreThreadKill MsfRpcMethod = "core.thread_kill" DbHosts MsfRpcMethod = "db.hosts" DbServices MsfRpcMethod = "db.services" DbVulns MsfRpcMethod = "db.vulns" DbWorkspaces MsfRpcMethod = "db.workspaces" DbCurrentWorkspace MsfRpcMethod = "db.current_workspace" DbGetWorkspace MsfRpcMethod = "db.get_workspace" DbSetWorkspace MsfRpcMethod = "db.set_workspace" DbDelWorkspace MsfRpcMethod = "db.del_workspace" DbAddWorkspace MsfRpcMethod = "db.add_workspace" DbGetHost MsfRpcMethod = "db.get_host" DbReportHost MsfRpcMethod = "db.report_host" DbReportService MsfRpcMethod = "db.report_service" DbGetService MsfRpcMethod = "db.get_service" DbGetNote MsfRpcMethod = "db.get_note" DbGetClient MsfRpcMethod = "db.get_client" DbReportClient MsfRpcMethod = "db.report_client" DbReportNote MsfRpcMethod = "db.report_note" DbNotes MsfRpcMethod = "db.notes" DbGetRef MsfRpcMethod = "db.get_ref" DbDelVuln MsfRpcMethod = "db.del_vuln" DbDelNote MsfRpcMethod = "db.del_note" DbDelService MsfRpcMethod = "db.del_service" DbDelHost MsfRpcMethod = "db.del_host" DbReportVuln MsfRpcMethod = "db.report_vuln" DbEvents MsfRpcMethod = "db.events" DbReportEvent MsfRpcMethod = "db.report_event" DbReportLoot MsfRpcMethod = "db.report_loot" DbLoots MsfRpcMethod = "db.loots" DbReportCred MsfRpcMethod = "db.report_cred" DbCreds MsfRpcMethod = "db.creds" DbImportData MsfRpcMethod = "db.import_data" DbGetVuln MsfRpcMethod = "db.get_vuln" DbClients MsfRpcMethod = "db.clients" DbDelClient MsfRpcMethod = "db.del_client" DbDriver MsfRpcMethod = "db.driver" DbConnect MsfRpcMethod = "db.connect" DbStatus MsfRpcMethod = "db.status" DbDisconnect MsfRpcMethod = "db.disconnect" JobList MsfRpcMethod = "job.list" JobStop MsfRpcMethod = "job.stop" JobInfo MsfRpcMethod = "job.info" ModuleExploits MsfRpcMethod = "module.exploits" ModuleEvasion MsfRpcMethod = "module.evasion" ModuleAuxiliary MsfRpcMethod = "module.auxiliary" ModulePayloads MsfRpcMethod = "module.payloads" ModuleEncoders MsfRpcMethod = "module.encoders" ModuleNops MsfRpcMethod = "module.nops" ModulePost MsfRpcMethod = "module.post" ModuleOptions MsfRpcMethod = "module.options" ModuleInfo MsfRpcMethod = "module.info" ModuleCompatiblePayloads MsfRpcMethod = "module.compatible_payloads" ModuleCompatibleSessions MsfRpcMethod = "module.compatible_sessions" ModuleExecute MsfRpcMethod = "module.execute" ModuleEncodeFormats MsfRpcMethod = "module.encode_formats" ModuleEncode MsfRpcMethod = "module.encode" PluginLoad MsfRpcMethod = "plugin.load" PluginUnload MsfRpcMethod = "plugin.unload" PluginLoaded MsfRpcMethod = "plugin.loaded" SessionList MsfRpcMethod = "session.list" SessionStop MsfRpcMethod = "session.stop" SessionShellRead MsfRpcMethod = "session.shell_read" SessionShellWrite MsfRpcMethod = "session.shell_write" SessionShellUpgrade MsfRpcMethod = "session.shell_upgrade" SessionMeterpreterRead MsfRpcMethod = "session.meterpreter_read" SessionRingRead MsfRpcMethod = "session.ring_read" SessionRingPut MsfRpcMethod = "session.ring_put" SessionRingLast MsfRpcMethod = "session.ring_last" SessionRingClear MsfRpcMethod = "session.ring_clear" SessionMeterpreterWrite MsfRpcMethod = "session.meterpreter_write" SessionMeterpreterSessionDetach MsfRpcMethod = "session.meterpreter_session_detach" SessionMeterpreterSessionKill MsfRpcMethod = "session.meterpreter_session_kill" SessionMeterpreterTabs MsfRpcMethod = "session.meterpreter_tabs" SessionMeterpreterRunSingle MsfRpcMethod = "session.meterpreter_run_single" SessionMeterpreterScript MsfRpcMethod = "session.meterpreter_script" SessionMeterpreterDirectorySeparator MsfRpcMethod = "session.meterpreter_directory_separator" SessionCompatibleModules MsfRpcMethod = "session.compatible_modules" )
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
func NewPluginManager ¶
func NewPluginManager(rpc RPCCaller) *PluginManager
type RPCCaller ¶
type RPCCaller interface {
Call(ctx context.Context, method MsfRpcMethod, args ...interface{}) (interface{}, error)
}
type Session ¶
type Session struct {
Type string `msgpack:"type" json:"type"`
TunnelLocal string `msgpack:"tunnel_local" json:"tunnel_local"`
TunnelPeer string `msgpack:"tunnel_peer" json:"tunnel_peer"`
ViaExploit string `msgpack:"via_exploit" json:"via_exploit"`
ViaPayload string `msgpack:"via_payload" json:"via_payload"`
Desc string `msgpack:"desc" json:"desc"`
Info string `msgpack:"info" json:"info"`
Workspace string `msgpack:"workspace" json:"workspace"`
SessionHost string `msgpack:"session_host" json:"session_host"`
SessionPort int `msgpack:"session_port" json:"session_port"`
TargetHost string `msgpack:"target_host" json:"target_host"`
Username string `msgpack:"username" json:"username"`
UUID string `msgpack:"uuid" json:"uuid"`
ExploitUUID string `msgpack:"exploit_uuid" json:"exploit_uuid"`
}
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager(rpc RPCCaller) *SessionManager
func (*SessionManager) CompatibleModules ¶
type ShellSession ¶
type ShellSession struct {
SID string
// contains filtered or unexported fields
}
func NewShellSession ¶
func NewShellSession(rpc RPCCaller, sid string) *ShellSession
func (*ShellSession) RunWithOutput ¶
type VersionInfo ¶
type WorkspaceManager ¶
type WorkspaceManager struct {
// contains filtered or unexported fields
}
func NewWorkspaceManager ¶
func NewWorkspaceManager(rpc RPCCaller) *WorkspaceManager
func (*WorkspaceManager) Add ¶
func (m *WorkspaceManager) Add(ctx context.Context, name string) error
func (*WorkspaceManager) Current ¶
func (m *WorkspaceManager) Current(ctx context.Context) (*Workspace, error)