transports

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AESKeySize - Always use 256 bit keys
	AESKeySize = 16

	// GCMNonceSize - 96 bit nonces for GCM
	GCMNonceSize = 12
)

Variables

This section is empty.

Functions

func GCMDecrypt

func GCMDecrypt(key AESKey, ciphertext []byte) ([]byte, error)

GCMDecrypt - Decrypt GCM ciphertext

func GCMEncrypt

func GCMEncrypt(key AESKey, plaintext []byte) ([]byte, error)

GCMEncrypt - Encrypt using AES GCM

func GetActiveC2

func GetActiveC2() string

GetActiveC2 returns the URL of the C2 in use

func LookupDomainKey

func LookupDomainKey(selector string, parentDomain string) ([]byte, error)

LookupDomainKey - Attempt to get the server's RSA public key

func RSADecrypt

func RSADecrypt(ciphertext []byte, privateKey *rsa.PrivateKey) ([]byte, error)

RSADecrypt - Decrypt ciphertext with rsa private key

func RSAEncrypt

func RSAEncrypt(msg []byte, pub *rsa.PublicKey) ([]byte, error)

RSAEncrypt - Encrypt a msg with a public rsa key

Types

type AESIV

type AESIV [aes.BlockSize]byte

AESIV - 128 bit IV

func RandomAESIV

func RandomAESIV() AESIV

RandomAESIV - 128 bit Random IV

type AESKey

type AESKey [AESKeySize]byte

AESKey - 128 bit key

func RandomAESKey

func RandomAESKey() AESKey

RandomAESKey - Generate random ID of randomIDSize bytes

func (AESKey) FromBytes

func (AESKey) FromBytes(data []byte) AESKey

FromBytes - Creates an AESKey from bytes

type BlockReassembler

type BlockReassembler struct {
	ID   string
	Size int
	Recv chan *RecvBlock
}

BlockReassembler - Data is encoded and split into `Blocks`

type Connection

type Connection struct {
	Send chan *pb.Envelope
	Recv chan *pb.Envelope
	// contains filtered or unexported fields
}

Connection - Abstract connection to the server

func StartConnectionLoop

func StartConnectionLoop() *Connection

StartConnectionLoop - Starts the main connection loop

func (*Connection) AddTunnel

func (c *Connection) AddTunnel(tun *Tunnel)

AddTunnel - Add tunnel to mapping

func (*Connection) Cleanup

func (c *Connection) Cleanup()

Cleanup - Execute cleanup once

func (*Connection) RemoveTunnel

func (c *Connection) RemoveTunnel(ID uint64)

RemoveTunnel - Add tunnel to mapping

func (*Connection) Tunnel

func (c *Connection) Tunnel(ID uint64) *Tunnel

Tunnel - Add tunnel to mapping

type Jar

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

Jar - CookieJar implementation that ignores domains/origins

func NewJar

func NewJar() *Jar

NewJar - Get a new instance of a cookie jar

func (*Jar) Cookies

func (jar *Jar) Cookies(u *url.URL) []*http.Cookie

Cookies returns the cookies to send in a request for the given URL. It is up to the implementation to honor the standard cookie use restrictions such as in RFC 6265 (which we do not).

func (*Jar) SetCookies

func (jar *Jar) SetCookies(u *url.URL, cookies []*http.Cookie)

SetCookies handles the receipt of the cookies in a reply for the given URL (which is ignored).

type RecvBlock

type RecvBlock struct {
	Index int
	Data  string
}

RecvBlock - Single block from server

type SliverHTTPClient

type SliverHTTPClient struct {
	Origin     string
	Client     *http.Client
	SessionKey *AESKey
	SessionID  string
}

SliverHTTPClient - Helper struct to keep everything together

func HTTPStartSession

func HTTPStartSession(address string) (*SliverHTTPClient, error)

HTTPStartSession - Attempts to start a session with a given address

func (*SliverHTTPClient) Poll

func (s *SliverHTTPClient) Poll() ([]byte, error)

Poll - Perform an HTTP GET request

func (*SliverHTTPClient) Send

func (s *SliverHTTPClient) Send(data []byte) error

Send - Perform an HTTP POST request

func (*SliverHTTPClient) SessionInit

func (s *SliverHTTPClient) SessionInit() error

SessionInit - Initailize the session

type Tunnel

type Tunnel struct {
	ID     uint64
	Reader io.ReadCloser
	Writer io.WriteCloser
}

Tunnel - Duplex byte read/write

Jump to

Keyboard shortcuts

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