Documentation ¶
Index ¶
- Constants
- Variables
- func SetupDefaultC2Profiles()
- func StartDNSListenerJob(dnsListener *clientpb.DNSListenerReq) (*core.Job, error)
- func StartHTTPListenerJob(req *clientpb.HTTPListenerReq) (*core.Job, error)
- func StartMTLSListenerJob(mtlsListener *clientpb.MTLSListenerReq) (*core.Job, error)
- func StartMutualTLSListener(bindIface string, port uint16) (net.Listener, error)
- func StartTCPListener(bindIface string, port uint16, data []byte) (net.Listener, error)
- func StartTCPStagerListenerJob(host string, port uint16, profileName string, shellcode []byte) (*core.Job, error)
- func StartWGListener(port uint16, netstackPort uint16, keyExchangeListenPort uint16) (net.Listener, *device.Device, *bytes.Buffer, error)
- func StartWGListenerJob(wgListener *clientpb.WGListenerReq) (*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(msg *dnspb.DNSMessage) (uint32, uint32, error)
- func (s *DNSSession) StageOutgoingEnvelope(envelope *sliverpb.Envelope) error
- type HTTPHandler
- type HTTPSession
- type HTTPSessions
- type PendingEnvelope
- type SliverDNSServer
- type SliverHTTPC2
Constants ¶
const ( DefaultMaxBodyLength = 2 * 1024 * 1024 * 1024 // 2Gb DefaultHTTPTimeout = time.Minute DefaultLongPollTimeout = time.Second DefaultLongPollJitter = time.Second )
const (
// ServerMaxMessageSize - Server-side max GRPC message size
ServerMaxMessageSize = (2 * 1024 * 1024 * 1024) - 1
)
Variables ¶
Functions ¶
func SetupDefaultC2Profiles ¶
func SetupDefaultC2Profiles()
func StartDNSListenerJob ¶
func StartDNSListenerJob(dnsListener *clientpb.DNSListenerReq) (*core.Job, error)
StartDNSListenerJob - Start a DNS listener as a job
func StartHTTPListenerJob ¶
func StartHTTPListenerJob(req *clientpb.HTTPListenerReq) (*core.Job, error)
StartHTTPListenerJob - Start a HTTP listener as a job
func StartMTLSListenerJob ¶
func StartMTLSListenerJob(mtlsListener *clientpb.MTLSListenerReq) (*core.Job, error)
StartMTLSListenerJob - Start an mTLS listener as a job
func StartMutualTLSListener ¶
StartMutualTLSListener - Start a mutual TLS listener
func StartTCPListener ¶
StartTCPListener - Start a TCP listener
func StartTCPStagerListenerJob ¶
func StartTCPStagerListenerJob(host string, port uint16, profileName string, shellcode []byte) (*core.Job, error)
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.
func StartWGListenerJob ¶
func StartWGListenerJob(wgListener *clientpb.WGListenerReq) (*core.Job, error)
StartWGListenerJob - Start a WireGuard listener as a job
Types ¶
type DNSSession ¶
type DNSSession struct { ID uint32 ImplantConn *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(msg *dnspb.DNSMessage) (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 HTTPSession ¶
type HTTPSession struct { ID string ImplantConn *core.ImplantConnection CipherCtx *cryptography.CipherContext Started time.Time C2Profile string }
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 *clientpb.HTTPListenerReq // Server config (user args) HTTPSessions *HTTPSessions Cleanup func() // contains filtered or unexported fields }
SliverHTTPC2 - Holds refs to all the C2 objects
func StartHTTPListener ¶
func StartHTTPListener(req *clientpb.HTTPListenerReq) (*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