Documentation ¶
Index ¶
- Constants
- Variables
- func StartDNSListenerJob(bindIface string, lport uint16, domains []string, canaries bool, ...) (*core.Job, error)
- func StartHTTPListenerJob(conf *HTTPServerConfig) (*core.Job, error)
- func StartHTTPStagerListenerJob(conf *HTTPServerConfig, data []byte) (*core.Job, error)
- func StartMTLSListenerJob(host string, listenPort uint16) (*core.Job, error)
- func StartMutualTLSListener(bindIface string, port uint16) (net.Listener, error)
- func StartPersistentJobs(cfg *configs.ServerConfig) error
- func StartTCPListener(bindIface string, port uint16, data []byte) (net.Listener, error)
- func StartTCPStagerListenerJob(host string, port uint16, shellcode []byte) (*core.Job, error)
- func StartWGListener(port uint16, netstackPort uint16, keyExchangeListenPort uint16) (net.Listener, *device.Device, *bytes.Buffer, error)
- func StartWGListenerJob(listenPort uint16, nListenPort uint16, keyExchangeListenPort uint16) (*core.Job, error)
- type DNSSession
- func (s *DNSSession) ClearOutgoingEnvelope(msgID uint32)
- func (s *DNSSession) ForwardCompletedEnvelope(msgID uint32, pending *PendingEnvelope)
- func (s *DNSSession) IncomingPendingEnvelope(msgID uint32, size uint32) *PendingEnvelope
- func (s *DNSSession) OutgoingRead(msgID uint32, start uint32, stop uint32) ([]byte, error)
- func (s *DNSSession) PopOutgoingMsgID() (uint32, uint32, error)
- func (s *DNSSession) StageOutgoingEnvelope(envelope *sliverpb.Envelope) error
- type HTTPHandler
- type HTTPServerConfig
- type HTTPSession
- type HTTPSessions
- type PendingEnvelope
- type SliverDNSServer
- type SliverHTTPC2
Constants ¶
Variables ¶
var ( ErrInvalidMsg = errors.New("invalid dns message") ErrNoOutgoingMessages = errors.New("no outgoing messages") )
var ( ErrMissingNonce = errors.New("nonce not found in request") ErrMissingOTP = errors.New("otp code not found in request") ErrInvalidEncoder = errors.New("invalid request encoder") ErrDecodeFailed = errors.New("failed to decode request") ErrDecryptFailed = errors.New("failed to decrypt request") )
Functions ¶
func StartDNSListenerJob ¶
func StartDNSListenerJob(bindIface string, lport uint16, domains []string, canaries bool, enforceOTP bool) (*core.Job, error)
StartDNSListenerJob - Start a DNS listener as a job
func StartHTTPListenerJob ¶
func StartHTTPListenerJob(conf *HTTPServerConfig) (*core.Job, error)
StartHTTPListenerJob - Start a HTTP listener as a job
func StartHTTPStagerListenerJob ¶
func StartHTTPStagerListenerJob(conf *HTTPServerConfig, data []byte) (*core.Job, error)
StartHTTPStagerListenerJob - Start an HTTP(S) stager payload listener
func StartMTLSListenerJob ¶
StartMTLSListenerJob - Start an mTLS listener as a job
func StartMutualTLSListener ¶
StartMutualTLSListener - Start a mutual TLS listener
func StartPersistentJobs ¶
func StartPersistentJobs(cfg *configs.ServerConfig) error
StartPersistentJobs - Start persistent jobs
func StartTCPListener ¶
StartTCPListener - Start a TCP listener
func StartTCPStagerListenerJob ¶
StartTCPStagerListenerJob - Start a TCP staging payload listener
func StartWGListener ¶
func StartWGListener(port uint16, netstackPort uint16, keyExchangeListenPort uint16) (net.Listener, *device.Device, *bytes.Buffer, error)
StartWGListener - First creates an inet.af network stack. then creates a Wireguard device/interface and applies configuration. Go routines are spun up to handle key exchange connections, as well as c2 comms connections.
Types ¶
type DNSSession ¶
type DNSSession struct { ID uint32 ImplanConn *core.ImplantConnection CipherCtx *cryptography.CipherContext // contains filtered or unexported fields }
DNSSession - Holds DNS session information
func (*DNSSession) ClearOutgoingEnvelope ¶
func (s *DNSSession) ClearOutgoingEnvelope(msgID uint32)
ClearOutgoingEnvelope - Clear an outgoing envelope this will generally, but not always, be the first value in the list
func (*DNSSession) ForwardCompletedEnvelope ¶
func (s *DNSSession) ForwardCompletedEnvelope(msgID uint32, pending *PendingEnvelope)
ForwardCompletedEnvelope - Reassembles and forwards envelopes to core
func (*DNSSession) IncomingPendingEnvelope ¶
func (s *DNSSession) IncomingPendingEnvelope(msgID uint32, size uint32) *PendingEnvelope
IncomingPendingEnvelope - Get a pending message linked list, creates one if it doesn't exist
func (*DNSSession) OutgoingRead ¶
OutgoingRead - Read request from implant
func (*DNSSession) PopOutgoingMsgID ¶
func (s *DNSSession) PopOutgoingMsgID() (uint32, uint32, error)
PopOutgoingMsgID - Pop the next outgoing message ID, FIFO returns msgID, len, err
func (*DNSSession) StageOutgoingEnvelope ¶
func (s *DNSSession) StageOutgoingEnvelope(envelope *sliverpb.Envelope) error
StageOutgoingEnvelope - Stage an outgoing envelope
type HTTPHandler ¶
type HTTPHandler func(resp http.ResponseWriter, req *http.Request)
HTTPHandler - Path mapped to a handler function
type HTTPServerConfig ¶
type HTTPServerConfig struct { Addr string LPort uint16 Domain string Website string Secure bool Cert []byte Key []byte ACME bool MaxRequestLength int EnforceOTP bool LongPollTimeout time.Duration LongPollJitter time.Duration RandomizeJARM bool }
HTTPServerConfig - Config data for servers
type HTTPSession ¶
type HTTPSession struct { ID string ImplantConn *core.ImplantConnection CipherCtx *cryptography.CipherContext Started time.Time }
HTTPSession - Holds data related to a sliver c2 session
type HTTPSessions ¶
type HTTPSessions struct {
// contains filtered or unexported fields
}
HTTPSessions - All currently open HTTP sessions
func (*HTTPSessions) Add ¶
func (s *HTTPSessions) Add(session *HTTPSession)
Add - Add an HTTP session
func (*HTTPSessions) Get ¶
func (s *HTTPSessions) Get(sessionID string) *HTTPSession
Get - Get an HTTP session
func (*HTTPSessions) Remove ¶
func (s *HTTPSessions) Remove(sessionID string)
Remove - Remove an HTTP session
type PendingEnvelope ¶
type PendingEnvelope struct { Size uint32 // contains filtered or unexported fields }
PendingEnvelope - Holds data related to a pending incoming message
func (*PendingEnvelope) Insert ¶
func (p *PendingEnvelope) Insert(dnsMsg *dnspb.DNSMessage) bool
Insert - Pending message, returns true if message is complete
func (*PendingEnvelope) Reassemble ¶
func (p *PendingEnvelope) Reassemble() ([]byte, error)
Reassemble - Reassemble a completed message
type SliverDNSServer ¶
type SliverDNSServer struct { TTL uint32 MaxTXTLength int EnforceOTP bool // contains filtered or unexported fields }
SliverDNSServer - DNS server implementation
func StartDNSListener ¶
func StartDNSListener(bindIface string, lport uint16, domains []string, canaries bool, enforceOTP bool) *SliverDNSServer
StartDNSListener - Start a DNS listener
func (*SliverDNSServer) HandleDNSRequest ¶
func (s *SliverDNSServer) HandleDNSRequest(domains []string, canaries bool, writer dns.ResponseWriter, req *dns.Msg)
--------------------------- DNS Handler --------------------------- Handles all DNS queries, first we determine if the query is C2 or a canary
func (*SliverDNSServer) ListenAndServe ¶
func (s *SliverDNSServer) ListenAndServe() error
ListenAndServe - Listen for DNS requests and respond
func (*SliverDNSServer) Shutdown ¶
func (s *SliverDNSServer) Shutdown() error
Shutdown - Shutdown the DNS server
type SliverHTTPC2 ¶
type SliverHTTPC2 struct { HTTPServer *http.Server ServerConf *HTTPServerConfig // Server config (user args) HTTPSessions *HTTPSessions SliverStage []byte // Sliver shellcode to serve during staging process Cleanup func() // contains filtered or unexported fields }
SliverHTTPC2 - Holds refs to all the C2 objects
func StartHTTPListener ¶
func StartHTTPListener(conf *HTTPServerConfig) (*SliverHTTPC2, error)
StartHTTPListener - Start an HTTP(S) listener, this can be used to start both
HTTP/HTTPS depending on the caller's conf
TODO: Better error handling, configurable ACME host/port
func (*SliverHTTPC2) DefaultRespHeaders ¶
func (s *SliverHTTPC2) DefaultRespHeaders(next http.Handler) http.Handler
DefaultRespHeaders - Configures default response headers
func (*SliverHTTPC2) LoadC2Config ¶
func (s *SliverHTTPC2) LoadC2Config() *configs.HTTPC2Config