websockets

package
v0.0.0-...-9d62925 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllClients = &Clients{Mutex: sync.RWMutex{}, List: make(map[*websocket.Conn]*Client)}

AllClients that are currently connected

View Source
var RShellClients = &RShellClient{Mutex: sync.RWMutex{}, Channel: make(map[string]chan string)}

RShellClients holds the channel for each RShell

Functions

func AlertRegisteredUsers

func AlertRegisteredUsers(m SendMessage, name string)

AlertRegisteredUsers sends data onto the the interested users

func AlertSingleUser

func AlertSingleUser(m SendMessage, ws *websocket.Conn)

AlertSingleUser sends data back to a single user

func AlertUsers

func AlertUsers(m SendMessage)

AlertUsers will send data to all front end users that needs to be known. Data can include listeners being spun up, agents connecting etc.. Message is expected to already be formatted when set

func DeregisterAgent

func DeregisterAgent(ws *websocket.Conn, name string)

DeregisterAgent removes the agent from the defined clients interested list

func RegisterAgent

func RegisterAgent(ws *websocket.Conn, name string)

RegisterAgent registers an agent for the webserver to send data back too

Types

type Client

type Client struct {
	Agents []string
	Alive  bool
}

Client is a struct holding data the clients are interested in

type Clients

type Clients struct {
	Mutex sync.RWMutex
	List  map[*websocket.Conn]*Client
}

Clients is a struct for syncing client operations

type RShellClient

type RShellClient struct {
	Mutex   sync.RWMutex
	Channel map[string]chan string
}

RShellClient hows the structure of Reverse Shell Clients

type SendMessage

type SendMessage struct {
	Type         string //Type of message to send to the front end
	FunctionName string //Holds the function names
	Data         string //data to be sent
	Success      bool   //If it succeed or not
}

SendMessage defines the structure of the message to the frontend

Jump to

Keyboard shortcuts

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