cirrus

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

Package cirrus is the primary package container for the Cirrus ReST service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmdline

func Cmdline()

Cmdline will attempt to build and run a Cirrus instance. This function will block until completion.

func Listen

func Listen(s *c2.Server, log logx.Log, key, addr string) error

Listen is a quick utility function that allows for creation of a new Cirrus REST service and will start it immediately.

This function will block until the server is closed.

Quick version of "NewContext(context.Background(), s, log, key).Listen(addr)".

func ListenContext

func ListenContext(x context.Context, s *c2.Server, log logx.Log, key, addr string) error

ListenContext is a quick utility function that allows for creation of a new Cirrus REST service and will start it immediately.

This function will block until the server is closed.

Quick version of "NewContext(x, s, log, key).Listen(addr)".

This function allows specifying a Context to aid in cancellation.

Types

type Cirrus

type Cirrus struct {
	Auth string

	Timeout time.Duration
	// contains filtered or unexported fields
}

Cirrus is a struct that enables and hosts the ReST API that controls a ThunderStorm C2 server able to control clients.

Cirrus also supplies a stats module that can be used to log and track event counts.

func New

func New(s *c2.Server, log logx.Log, key string) *Cirrus

New creates a new Cirrus REST server instance using the supplied C2 Server.

The provided key can be used to authenticate to the Rest service with the 'X-CirrusAuth' HTTP header containing the supplied key.

If empty, authentication is disabled.

func NewContext

func NewContext(x context.Context, s *c2.Server, log logx.Log, key string) *Cirrus

NewContext creates a new Cirrus REST server instance using the supplied C2 Server instance.

This function allows specifying a Context to aid in cancellation.

func (*Cirrus) Close

func (c *Cirrus) Close() error

Close stops all Cirrus instances and listening endpoints.

This will NOT close any Sessions or Listeners created.

func (*Cirrus) Listen

func (c *Cirrus) Listen(addr string) error

Listen will bind to the specified address and begin serving requests. This function will return when the server is closed.

func (*Cirrus) ListenTLS

func (c *Cirrus) ListenTLS(addr, cert, key string) error

ListenTLS will bind to the specified address and use the provided certificate and key file paths to listen using a secure TLS tunnel. This function will return when the server is closed.

func (*Cirrus) Load

func (c *Cirrus) Load(s string) error

Load will attempt to load in a previously saved Cirrus state from the provided JSON file. If the path does not exist, this function will return without an error (allows loading from an empty state file).

Any environment variables will be parsed and expanded before loading.

This function will bail and return any encoding or reading errors that may occur during the operation.

func (*Cirrus) Save

func (c *Cirrus) Save(s string) error

Save will attempt to save the current state of Cirrus (Listeners, Scripts and Profiles) to the supplied file path as pretty JSON. If successful, the file will be truncated (if it exists) and overwritten.

Any environment variables will be parsed and expanded before writing.

This function will bail and return any encoding or writing errors that may occur during the operation.

func (*Cirrus) TrackStats

func (c *Cirrus) TrackStats(csv, tracker string) error

TrackStats will enable the CSV and Tracker files. This function can enable Cirrus to log every event (Job/Session/Packet Actions) to a CSV formatted file (if not-empty) and a tracking file (if not-empty) that will be updated every minute in UNIX fashion (cleared and rewritten) with statistics about current Job and Session info.

Returns an error if setting up any of the supplied files fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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