chshare

package
v0.0.0-...-7578c0e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnixShell  = "/bin/sh"
	CmdShell   = "cmd"
	PowerShell = "powershell"
	Tacoscript = "tacoscript"
)
View Source
const DetermRandIter = 2048
View Source
const IPAddressesVersion = 1

IPAddressesVersion represents the current version of IPAddresses fetching. 0 means no IPAddress fetching available.

View Source
const MonitoringVersion = 1

MonitoringVersion represents the current version of monitoring capability. 0 means no monitoring available.

View Source
const ProtocolVersion = "rport-v1"

ProtocolVersion of neo-rport. When backwards incompatible changes are made, this will be incremented to signify a protocol mismatch.

Variables

View Source
var BuildVersion = "0.0.0-src"

BuildVersion represents a current build version. It can be overridden by CI workflow.

View Source
var SourceVersion = "0.0.0-src"

SourceVersion represents a default build version that is used for binaries built from sources.

Functions

func DecodeViperConfig

func DecodeViperConfig(v *viper.Viper, cfg interface{}, cfgReader io.Reader) error

DecodeViperConfig tries to load viper config from either a file or reader and env variables then decodes all values into given cfg variable. cfg must be a pointer.

func EncodeConnectionRequest

func EncodeConnectionRequest(c *ConnectionRequest) ([]byte, error)

func FingerprintKey

func FingerprintKey(k ssh.PublicKey) string

func GenerateKey

func GenerateKey(seed string) ([]byte, error)

GenerateKey tries to stay compatible with go1.19 key generation

func GetCurrentUserAndGroup

func GetCurrentUserAndGroup() (*user.User, *user.Group, error)

func GoStats

func GoStats()

GoStats prints statistics to stdout on SIGUSR2 (posix-only)

func HandleServiceCommand

func HandleServiceCommand(svc service.Service, command string) error

HandleServiceCommand handles string command and executes appropriate method. We do not use service.Control, because on uninstall it leaves the service running.

func HandleTCPStream

func HandleTCPStream(l *logger.Logger, connStats *ConnStats, src io.ReadWriteCloser, remote string)

func IsRunningAsRoot

func IsRunningAsRoot() bool

func NewDetermRand

func NewDetermRand(seed []byte) io.Reader

func NewRWCConn

func NewRWCConn(rwc io.ReadWriteCloser) net.Conn

func NewWebSocketConn

func NewWebSocketConn(websocketConn *websocket.Conn) net.Conn

func ParseAuth

func ParseAuth(auth string) (string, string)

func Pipe

func Pipe(src io.ReadWriteCloser, dst io.ReadWriteCloser) (int64, int64)

func RemoteIP

func RemoteIP(r *http.Request) string

func SetFromRange

func SetFromRange(start, end int) mapset.Set

func SleepSignal

func SleepSignal(d time.Duration)

SleepSignal sleeps for the given duration, or until a SIGHUP is received

Types

type ConnStats

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

func (*ConnStats) Close

func (c *ConnStats) Close()

func (*ConnStats) New

func (c *ConnStats) New() int32

func (*ConnStats) Open

func (c *ConnStats) Open()

func (*ConnStats) String

func (c *ConnStats) String() string

type ConnectionRequest

type ConnectionRequest struct {
	ID                     string
	Name                   string
	SessionID              string
	OS                     string
	OSFullName             string
	OSVersion              string
	OSVirtualizationSystem string
	OSVirtualizationRole   string
	OSArch                 string
	OSFamily               string
	OSKernel               string
	Version                string
	Hostname               string
	CPUFamily              string
	CPUModel               string
	CPUModelName           string
	CPUVendor              string
	NumCPUs                int
	MemoryTotal            uint64
	Timezone               string
	IPv4                   []string
	IPv6                   []string
	Tags                   []string
	Labels                 map[string]string
	Remotes                []*models.Remote
	ClientConfiguration    *clientconfig.Config
}

ConnectionRequest represents configuration options when initiating client-server connection

func DecodeConnectionRequest

func DecodeConnectionRequest(b []byte) (*ConnectionRequest, error)

type DetermRand

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

func (*DetermRand) Read

func (d *DetermRand) Read(b []byte) (int, error)

type HTTPServer

type HTTPServer struct {
	*http.Server
	// contains filtered or unexported fields
}

HTTPServer extends net/http Server and adds graceful shutdowns

func NewHTTPServer

func NewHTTPServer(maxHeaderBytes int, l *logger.Logger, options ...ServerOption) *HTTPServer

NewHTTPServer creates a new HTTPServer

func (*HTTPServer) Close

func (h *HTTPServer) Close() error

func (*HTTPServer) GoListenAndServe

func (h *HTTPServer) GoListenAndServe(ctx context.Context, addr string, handler http.Handler) error

func (*HTTPServer) Wait

func (h *HTTPServer) Wait() error

type ServerOption

type ServerOption func(*HTTPServer)

func WithTLS

func WithTLS(certFile string, keyFile string, tlsConfig *tls.Config) ServerOption

Directories

Path Synopsis
Package comm is responsible for sharing logic to handle communication between a server and clients.
Package comm is responsible for sharing logic to handle communication between a server and clients.

Jump to

Keyboard shortcuts

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