context

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: LGPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPullTunnelConfig

func AddPullTunnelConfig(termite *TermiteClient, local_address string, remote_address string)

func AddPushTunnelConfig

func AddPushTunnelConfig(termite *TermiteClient, local_address string, remote_address string)

func CreateContext

func CreateContext()

func CreateDistributorServer

func CreateDistributorServer(host string, port uint16, url string) *gin.Engine

func CreateRESTfulAPIServer

func CreateRESTfulAPIServer() *gin.Engine

func Shutdown

func Shutdown()

func Signal

func Signal()

func StartSocks5Server

func StartSocks5Server(local_address string) error

func TermiteMessageDispatcher

func TermiteMessageDispatcher(client *TermiteClient)

func WriteTunnel

func WriteTunnel(termite *TermiteClient, token string, data []byte)

Types

type Context

type Context struct {
	Servers            map[string](*TCPServer)
	NotifyWebSocket    *melody.Melody
	Current            *TCPClient
	CurrentTermite     *TermiteClient
	CommandPrompt      string
	RLInstance         *readline.Instance
	Interacting        *sync.Mutex
	PullTunnelConfig   map[string]PullTunnelConfig
	PullTunnelInstance map[string]PullTunnelInstance
	PushTunnelConfig   map[string]PushTunnelConfig
	PushTunnelInstance map[string]PushTunnelInstance
	Socks5Servers      map[string](*socks5.Server)
	MessageQueue       map[string](chan message.Message)
	// Set later in platypus.go
	Distributor *Distributor
	RESTful     *gin.Engine
	Config      *config.Config
}
var Ctx *Context

func GetContext

func GetContext() *Context

func (Context) AddServer

func (ctx Context) AddServer(s *TCPServer)

func (Context) DeleteServer

func (ctx Context) DeleteServer(s *TCPServer)

func (Context) DeleteTCPClient

func (ctx Context) DeleteTCPClient(c *TCPClient)

func (Context) DeleteTermiteClient

func (ctx Context) DeleteTermiteClient(c *TermiteClient)

func (Context) FindServerByHash

func (ctx Context) FindServerByHash(hash string) *TCPServer

func (Context) FindServerListeningAddressByRouteKey

func (ctx Context) FindServerListeningAddressByRouteKey(routeKey string) string

func (Context) FindTCPClientByAlias

func (ctx Context) FindTCPClientByAlias(alias string) *TCPClient

func (Context) FindTCPClientByHash

func (ctx Context) FindTCPClientByHash(hash string) *TCPClient

func (Context) FindTermiteClientByAlias

func (ctx Context) FindTermiteClientByAlias(alias string) *TermiteClient

func (Context) FindTermiteClientByHash

func (ctx Context) FindTermiteClientByHash(hash string) *TermiteClient

type Distributor

type Distributor struct {
	Host       string            `json:"host"`
	Port       uint16            `json:"port"`
	Interfaces []string          `json:"interfaces"`
	Route      map[string]string `json:"route"`
	Url        string            `json:"url"`
}

type Process

type Process struct {
	Pid           int
	WindowColumns int
	WindowRows    int
	State         processState
	WebSocket     *melody.Session
}

type PullTunnelConfig

type PullTunnelConfig struct {
	Termite *TermiteClient
	Address string
	Server  *net.Listener
}

type PullTunnelInstance

type PullTunnelInstance struct {
	Termite *TermiteClient
	Conn    *net.Conn
}

type PushTunnelConfig

type PushTunnelConfig struct {
	Termite *TermiteClient
	Address string
}

type PushTunnelInstance

type PushTunnelInstance struct {
	Termite *TermiteClient
	Conn    *net.Conn
}

type TCPClient

type TCPClient struct {
	GroupDispatch     bool                `json:"group_dispatch"`
	Hash              string              `json:"hash"`
	Host              string              `json:"host"`
	Port              uint16              `json:"port"`
	Alias             string              `json:"alias"`
	User              string              `json:"user"`
	OS                oss.OperatingSystem `json:"os"`
	NetworkInterfaces map[string]string   `json:"network_interfaces"`
	Python2           string              `json:"python2"`
	Python3           string              `json:"python3"`
	TimeStamp         time.Time           `json:"timestamp"`
	// contains filtered or unexported fields
}

func CreateTCPClient

func CreateTCPClient(conn net.Conn, server *TCPServer) *TCPClient

func (*TCPClient) AsTable

func (c *TCPClient) AsTable()

func (*TCPClient) Close

func (c *TCPClient) Close()

func (*TCPClient) EstablishPTY

func (c *TCPClient) EstablishPTY() error

func (*TCPClient) FileExists

func (c *TCPClient) FileExists(path string) (bool, error)

func (*TCPClient) FileSize

func (c *TCPClient) FileSize(filename string) (int, error)

func (*TCPClient) FullDesc

func (c *TCPClient) FullDesc() string

func (*TCPClient) GatherClientInfo

func (c *TCPClient) GatherClientInfo(hashFormat string)

func (*TCPClient) GetConn

func (c *TCPClient) GetConn() net.Conn

func (*TCPClient) GetConnString

func (c *TCPClient) GetConnString() string

func (*TCPClient) GetHashFormat

func (c *TCPClient) GetHashFormat() string

func (*TCPClient) GetInteractingLock

func (c *TCPClient) GetInteractingLock() *sync.Mutex

func (*TCPClient) GetInteractive

func (c *TCPClient) GetInteractive() bool

func (*TCPClient) GetPrompt

func (c *TCPClient) GetPrompt() string

func (*TCPClient) GetPtyEstablished

func (c *TCPClient) GetPtyEstablished() bool

func (*TCPClient) GetShellPath

func (c *TCPClient) GetShellPath() string

func (*TCPClient) GetUsername

func (c *TCPClient) GetUsername() string

func (*TCPClient) NotifyWebSocketCompilingTermite

func (client *TCPClient) NotifyWebSocketCompilingTermite(progress int)

func (*TCPClient) NotifyWebSocketCompressingTermite

func (client *TCPClient) NotifyWebSocketCompressingTermite(progress int)

func (*TCPClient) NotifyWebSocketUploadingTermite

func (client *TCPClient) NotifyWebSocketUploadingTermite(bytesSent int, bytesTotal int)

func (*TCPClient) OnelineDesc

func (c *TCPClient) OnelineDesc() string

func (*TCPClient) Read

func (c *TCPClient) Read(timeout time.Duration) (string, bool)

func (*TCPClient) ReadConnLock

func (c *TCPClient) ReadConnLock(b []byte) (int, error)

func (*TCPClient) ReadFile

func (c *TCPClient) ReadFile(filename string) (string, error)

func (*TCPClient) ReadFileEx

func (c *TCPClient) ReadFileEx(filename string, start int, length int) (string, error)

func (*TCPClient) ReadSize

func (c *TCPClient) ReadSize(size int) string

func (*TCPClient) ReadUntil

func (c *TCPClient) ReadUntil(token string) (string, bool)

func (*TCPClient) ReadUntilClean

func (c *TCPClient) ReadUntilClean(token string) string

func (*TCPClient) SelectPython

func (c *TCPClient) SelectPython() string

func (*TCPClient) SetInteractive

func (c *TCPClient) SetInteractive(new bool) bool

func (*TCPClient) SetPtyEstablished

func (c *TCPClient) SetPtyEstablished(new bool) bool

func (*TCPClient) SetWindowSize

func (c *TCPClient) SetWindowSize(ws *WindowSize)

func (*TCPClient) System

func (c *TCPClient) System(command string)

func (*TCPClient) SystemToken

func (c *TCPClient) SystemToken(command string) string

func (*TCPClient) UpgradeToTermite

func (c *TCPClient) UpgradeToTermite(connectBackHostPort string)

func (*TCPClient) Upload

func (c *TCPClient) Upload(src string, dst string, broadcast bool) bool

func (*TCPClient) Write

func (c *TCPClient) Write(data []byte) int

type TCPServer

type TCPServer struct {
	Host           string                      `json:"host"`
	GroupDispatch  bool                        `json:"group_dispatch"`
	Port           uint16                      `json:"port"`
	Clients        map[string](*TCPClient)     `json:"clients"`
	TermiteClients map[string](*TermiteClient) `json:"termite_clients"`
	TimeStamp      time.Time                   `json:"timestamp"`
	Interfaces     []string                    `json:"interfaces"`
	Hash           string                      `json:"hash"`
	Encrypted      bool                        `json:"encrypted"`
	DisableHistory bool                        `json:"disable_history"`
	PublicIP       string                      `json:"public_ip"`
	ShellPath      string                      `json:"shell_path"`
	// contains filtered or unexported fields
}

func CreateTCPServer

func CreateTCPServer(host string, port uint16, hashFormat string, encrypted bool, disableHistory bool, PublicIP string, ShellPath string) *TCPServer

func (*TCPServer) AddTCPClient

func (s *TCPServer) AddTCPClient(client *TCPClient)

func (*TCPServer) AddTermiteClient

func (s *TCPServer) AddTermiteClient(client *TermiteClient)

Encrypted clients

func (*TCPServer) AsTable

func (s *TCPServer) AsTable()

func (*TCPServer) DeleteTCPClient

func (s *TCPServer) DeleteTCPClient(client *TCPClient)

func (*TCPServer) DeleteTermiteClient

func (s *TCPServer) DeleteTermiteClient(client *TermiteClient)

func (*TCPServer) FullDesc

func (s *TCPServer) FullDesc() string

func (*TCPServer) GetAllTCPClients

func (s *TCPServer) GetAllTCPClients() map[string](*TCPClient)

func (*TCPServer) GetAllTermiteClients

func (s *TCPServer) GetAllTermiteClients() map[string](*TermiteClient)

func (*TCPServer) Handle

func (s *TCPServer) Handle(conn net.Conn)

func (*TCPServer) NotifyWebSocketDuplicateTCPClient

func (s *TCPServer) NotifyWebSocketDuplicateTCPClient(client *TCPClient)

func (*TCPServer) NotifyWebSocketDuplicateTermiteClient

func (s *TCPServer) NotifyWebSocketDuplicateTermiteClient(client *TermiteClient)

func (*TCPServer) NotifyWebSocketOnlineTCPClient

func (s *TCPServer) NotifyWebSocketOnlineTCPClient(client *TCPClient)

func (*TCPServer) NotifyWebSocketOnlineTermiteClient

func (s *TCPServer) NotifyWebSocketOnlineTermiteClient(client *TermiteClient)

func (*TCPServer) OnelineDesc

func (s *TCPServer) OnelineDesc() string

func (*TCPServer) Run

func (s *TCPServer) Run()

func (*TCPServer) Stop

func (s *TCPServer) Stop()

type TermiteClient

type TermiteClient struct {
	Hash              string              `json:"hash"`
	Host              string              `json:"host"`
	Port              uint16              `json:"port"`
	Alias             string              `json:"alias"`
	User              string              `json:"user"`
	OS                oss.OperatingSystem `json:"os"`
	Version           string              `json:"version"`
	NetworkInterfaces map[string]string   `json:"network_interfaces"`
	Python2           string              `json:"python2"`
	Python3           string              `json:"python3"`
	TimeStamp         time.Time           `json:"timestamp"`
	DisableHistory    bool                `json:"disable_hisory"`
	GroupDispatch     bool                `json:"group_dispatch"`
	// contains filtered or unexported fields
}

func CreateTermiteClient

func CreateTermiteClient(conn net.Conn, server *TCPServer, disableHistory bool) *TermiteClient

func (*TermiteClient) AddProcess

func (c *TermiteClient) AddProcess(key string, process *Process)

func (*TermiteClient) AsTable

func (c *TermiteClient) AsTable()

func (*TermiteClient) Close

func (c *TermiteClient) Close()

func (*TermiteClient) FileSize

func (c *TermiteClient) FileSize(path string) (int64, error)

func (*TermiteClient) FullDesc

func (c *TermiteClient) FullDesc() string

func (*TermiteClient) GatherClientInfo

func (c *TermiteClient) GatherClientInfo(hashFormat string) bool

func (*TermiteClient) GetConn

func (c *TermiteClient) GetConn() net.Conn

func (*TermiteClient) GetConnString

func (c *TermiteClient) GetConnString() string

func (*TermiteClient) GetHashFormat

func (c *TermiteClient) GetHashFormat() string

func (*TermiteClient) GetPrompt

func (c *TermiteClient) GetPrompt() string

func (*TermiteClient) GetShellPath

func (c *TermiteClient) GetShellPath() string

func (*TermiteClient) GetUsername

func (c *TermiteClient) GetUsername() string

func (*TermiteClient) InteractWith

func (c *TermiteClient) InteractWith(key string)

func (*TermiteClient) LockAtom

func (c *TermiteClient) LockAtom()

func (*TermiteClient) LockDecoder

func (c *TermiteClient) LockDecoder()

func (*TermiteClient) LockEncoder

func (c *TermiteClient) LockEncoder()

func (*TermiteClient) NotifyPlatypusWindowSize

func (c *TermiteClient) NotifyPlatypusWindowSize(columns int, rows int)

func (*TermiteClient) OnelineDesc

func (c *TermiteClient) OnelineDesc() string

func (*TermiteClient) ReadFile

func (c *TermiteClient) ReadFile(path string) ([]byte, error)

func (*TermiteClient) ReadFileEx

func (c *TermiteClient) ReadFileEx(path string, start int64, size int64) ([]byte, error)

func (*TermiteClient) Recv

func (c *TermiteClient) Recv(msg *message.Message) error

func (*TermiteClient) RequestStartProcess

func (c *TermiteClient) RequestStartProcess(path string, columns int, rows int, key string)

func (*TermiteClient) RequestTerminate

func (c *TermiteClient) RequestTerminate(key string)

func (*TermiteClient) Send

func (c *TermiteClient) Send(message message.Message) error

func (*TermiteClient) StartShell

func (c *TermiteClient) StartShell()

func (*TermiteClient) StartSocks5Server

func (c *TermiteClient) StartSocks5Server()

func (*TermiteClient) System

func (c *TermiteClient) System(command string) string

func (*TermiteClient) UnlockAtom

func (c *TermiteClient) UnlockAtom()

func (*TermiteClient) UnlockDecoder

func (c *TermiteClient) UnlockDecoder()

func (*TermiteClient) UnlockEncoder

func (c *TermiteClient) UnlockEncoder()

func (*TermiteClient) WriteFile

func (c *TermiteClient) WriteFile(path string, content []byte) (int, error)

func (*TermiteClient) WriteFileEx

func (c *TermiteClient) WriteFileEx(path string, content []byte) (int, error)

type WebSocketMessage

type WebSocketMessage struct {
	Type WebSocketMessageType
	Data interface{}
}

type WebSocketMessageType

type WebSocketMessageType int
const (
	CLIENT_CONNECTED WebSocketMessageType = iota
	CLIENT_DUPLICATED
	SERVER_DUPLICATED
	COMPILING_TERMITE
	COMPRESSING_TERMITE
	UPLOADING_TERMITE
)

type WindowSize

type WindowSize struct {
	Columns int
	Rows    int
}

Jump to

Keyboard shortcuts

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