server

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCacheMetrics added in v1.0.8

func GetCacheMetrics(options *Options) *storage.CacheMetrics

Types

type CpuStats added in v1.0.8

type CpuStats struct {
	User   uint64 `json:"user"`
	System uint64 `json:"system"`
	Idle   uint64 `json:"idle"`
	Nice   uint64 `json:"nice"`
	Total  uint64 `json:"total"`
}

func GetCpuMetrics added in v1.0.8

func GetCpuMetrics() (cpuStats *CpuStats)

type DNSServer

type DNSServer struct {
	TxtRecord string // used for ACME verification
	// contains filtered or unexported fields
}

DNSServer is a DNS server instance that listens on port 53.

func NewDNSServer

func NewDNSServer(network string, options *Options) *DNSServer

NewDNSServer returns a new DNS server.

func (*DNSServer) ListenAndServe

func (h *DNSServer) ListenAndServe(dnsAlive chan bool)

ListenAndServe listens on dns ports for the server.

func (*DNSServer) ServeDNS

func (h *DNSServer) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS is the default handler for DNS queries.

type FTPServer

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

FTPServer is a ftp server instance

func NewFTPServer

func NewFTPServer(options *Options) (*FTPServer, error)

NewFTPServer returns a new TLS & Non-TLS FTP server.

func (*FTPServer) AfterCurDirChanged

func (h *FTPServer) AfterCurDirChanged(ctx *ftpserver.Context, oldCurDir, newCurDir string, err error)

func (*FTPServer) AfterDirCreated

func (h *FTPServer) AfterDirCreated(ctx *ftpserver.Context, dstPath string, err error)

func (*FTPServer) AfterDirDeleted

func (h *FTPServer) AfterDirDeleted(ctx *ftpserver.Context, dstPath string, err error)

func (*FTPServer) AfterFileDeleted

func (h *FTPServer) AfterFileDeleted(ctx *ftpserver.Context, dstPath string, err error)

func (*FTPServer) AfterFileDownloaded

func (h *FTPServer) AfterFileDownloaded(ctx *ftpserver.Context, dstPath string, size int64, err error)

func (*FTPServer) AfterFilePut

func (h *FTPServer) AfterFilePut(ctx *ftpserver.Context, dstPath string, size int64, err error)

func (*FTPServer) AfterUserLogin

func (h *FTPServer) AfterUserLogin(ctx *ftpserver.Context, userName, password string, passMatched bool, err error)

func (*FTPServer) BeforeChangeCurDir

func (h *FTPServer) BeforeChangeCurDir(ctx *ftpserver.Context, oldCurDir, newCurDir string)

func (*FTPServer) BeforeCreateDir

func (h *FTPServer) BeforeCreateDir(ctx *ftpserver.Context, dstPath string)

func (*FTPServer) BeforeDeleteDir

func (h *FTPServer) BeforeDeleteDir(ctx *ftpserver.Context, dstPath string)

func (*FTPServer) BeforeDeleteFile

func (h *FTPServer) BeforeDeleteFile(ctx *ftpserver.Context, dstPath string)

func (*FTPServer) BeforeDownloadFile

func (h *FTPServer) BeforeDownloadFile(ctx *ftpserver.Context, dstPath string)

func (*FTPServer) BeforeLoginUser

func (h *FTPServer) BeforeLoginUser(ctx *ftpserver.Context, userName string)

func (*FTPServer) BeforePutFile

func (h *FTPServer) BeforePutFile(ctx *ftpserver.Context, dstPath string)

func (*FTPServer) Close

func (h *FTPServer) Close()

func (*FTPServer) ListenAndServe

func (h *FTPServer) ListenAndServe(tlsConfig *tls.Config, ftpAlive chan bool)

ListenAndServe listens on smtp and/or smtps ports for the server.

func (*FTPServer) Print

func (h *FTPServer) Print(sessionID string, message interface{})

func (*FTPServer) PrintCommand

func (h *FTPServer) PrintCommand(sessionID string, command string, params string)

func (*FTPServer) PrintResponse

func (h *FTPServer) PrintResponse(sessionID string, code int, message string)

func (*FTPServer) Printf

func (h *FTPServer) Printf(sessionID string, format string, v ...interface{})

type HTTPServer

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

HTTPServer is a http server instance that listens both TLS and Non-TLS based servers.

func NewHTTPServer

func NewHTTPServer(options *Options) (*HTTPServer, error)

NewHTTPServer returns a new TLS & Non-TLS HTTP server.

func (*HTTPServer) ListenAndServe

func (h *HTTPServer) ListenAndServe(tlsConfig *tls.Config, httpAlive, httpsAlive chan bool)

ListenAndServe listens on http and/or https ports for the server.

type LDAPServer

type LDAPServer struct {
	WithLogger bool
	// contains filtered or unexported fields
}

LDAPServer is a ldap server instance

func NewLDAPServer

func NewLDAPServer(options *Options, withLogger bool) (*LDAPServer, error)

NewLDAPServer returns a new LDAP server.

func (*LDAPServer) Close

func (ldapServer *LDAPServer) Close() error

func (*LDAPServer) Fatal

func (ldapServer *LDAPServer) Fatal(v ...interface{})

func (*LDAPServer) Fatalf

func (ldapServer *LDAPServer) Fatalf(format string, v ...interface{})

func (*LDAPServer) Fatalln

func (ldapServer *LDAPServer) Fatalln(v ...interface{})

func (*LDAPServer) ListenAndServe

func (ldapServer *LDAPServer) ListenAndServe(tlsConfig *tls.Config, ldapAlive chan bool)

ListenAndServe listens on ldap ports for the server.

func (*LDAPServer) Panic

func (ldapServer *LDAPServer) Panic(v ...interface{})

func (*LDAPServer) Panicf

func (ldapServer *LDAPServer) Panicf(format string, v ...interface{})

func (*LDAPServer) Panicln

func (ldapServer *LDAPServer) Panicln(v ...interface{})

func (*LDAPServer) Print

func (ldapServer *LDAPServer) Print(v ...interface{})

func (*LDAPServer) Printf

func (ldapServer *LDAPServer) Printf(format string, v ...interface{})

func (*LDAPServer) Println

func (ldapServer *LDAPServer) Println(v ...interface{})

type MemoryMetrics added in v1.0.8

type MemoryMetrics struct {
	Alloc        string `json:"alloc"`
	TotalAlloc   string `json:"total_alloc"`
	Sys          string `json:"sys"`
	Lookups      uint64 `json:"lookups"`
	Mallocs      uint64 `json:"mallocs"`
	Frees        uint64 `json:"frees"`
	HeapAlloc    string `json:"heap_allo"`
	HeapSys      string `json:"heap_sys"`
	HeapIdle     string `json:"head_idle"`
	HeapInuse    string `json:"heap_in_use"`
	HeapReleased string `json:"heap_released"`
	HeapObjects  uint64 `json:"heap_objects"`
	StackInuse   string `json:"stack_in_use"`
	StackSys     string `json:"stack_sys"`
	MSpanInuse   string `json:"mspan_in_use"`
	MSpanSys     string `json:"mspan_sys"`
	MCacheInuse  string `json:"mcache_in_use"`
	MCacheSys    string `json:"mcache_sys"`
}

func GetMemoryMetrics added in v1.0.8

func GetMemoryMetrics() *MemoryMetrics

type Metrics added in v1.0.8

type Metrics struct {
	Dns      uint64                `json:"dns"`
	Ftp      uint64                `json:"ftp"`
	Http     uint64                `json:"http"`
	Ldap     uint64                `json:"ldap"`
	Smb      uint64                `json:"smb"`
	Smtp     uint64                `json:"smtp"`
	Sessions int64                 `json:"sessions"`
	Cache    *storage.CacheMetrics `json:"cache"`
	Memory   *MemoryMetrics        `json:"memory"`
	Cpu      *CpuStats             `json:"cpu"`
	Network  *NetworkStats         `json:"network"`
}

type NetworkStats added in v1.0.8

type NetworkStats struct {
	Rx string `json:"received"`

	Tx string `json:"transmitted"`
	// contains filtered or unexported fields
}

func GetNetworkMetrics added in v1.0.8

func GetNetworkMetrics() *NetworkStats

type NopAuth

type NopAuth struct{}

func (*NopAuth) CheckPasswd

func (a *NopAuth) CheckPasswd(ctx *ftpserver.Context, name, pass string) (bool, error)

type NopDriver

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

func NewNopDriver

func NewNopDriver(driver ftpserver.Driver) *NopDriver

func (*NopDriver) DeleteDir

func (n *NopDriver) DeleteDir(c *ftpserver.Context, s string) error

func (*NopDriver) DeleteFile

func (n *NopDriver) DeleteFile(c *ftpserver.Context, s string) error

func (*NopDriver) GetFile

func (n *NopDriver) GetFile(c *ftpserver.Context, s1 string, k int64) (int64, io.ReadCloser, error)

func (*NopDriver) ListDir

func (n *NopDriver) ListDir(c *ftpserver.Context, s string, f func(os.FileInfo) error) error

func (*NopDriver) MakeDir

func (n *NopDriver) MakeDir(c *ftpserver.Context, s string) error

func (*NopDriver) PutFile

func (n *NopDriver) PutFile(c *ftpserver.Context, s string, r io.Reader, k int64) (int64, error)

func (*NopDriver) Rename

func (n *NopDriver) Rename(c *ftpserver.Context, s1 string, s2 string) error

func (*NopDriver) Stat

func (n *NopDriver) Stat(c *ftpserver.Context, s string) (os.FileInfo, error)

type Options

type Options struct {
	// Domains is the list domains for the instance.
	Domains []string
	// IPAddress is the IP address of the current server.
	IPAddress string
	// ListenIP is the IP address to listen servers on
	ListenIP string
	// DomainPort is the port to listen DNS servers on
	DnsPort int
	// HttpPort is the port to listen HTTP server on
	HttpPort int
	// HttpsPort is the port to listen HTTPS server on
	HttpsPort int
	// SmbPort is the port to listen Smb server on
	SmbPort int
	// SmtpPort is the port to listen Smtp server on
	SmtpPort int
	// SmtpsPort is the port to listen Smtps server on
	SmtpsPort int
	// SmtpAutoTLSPort is the port to listen Smtp autoTLS server on
	SmtpAutoTLSPort int
	// FtpPort is the port to listen Ftp server on
	FtpPort int
	// FtpPort is the port to listen Ftp server on
	LdapPort int
	// Hostmaster is the hostmaster email for the server.
	Hostmasters []string
	// Storage is a storage for interaction data storage
	Storage storage.Storage
	// Auth requires client to authenticate
	Auth bool
	// HTTPIndex is the http index file for server
	HTTPIndex string
	// HTTPDirectory is the directory for interact server
	HTTPDirectory string
	// Token required to retrieve interactions
	Token string
	// Enable root tld interactions
	RootTLD bool
	// OriginURL for the HTTP Server
	OriginURL string
	// FTPDirectory or temporary one
	FTPDirectory string
	// ScanEverywhere for potential correlation id
	ScanEverywhere bool
	// CorrelationIdLength of preamble
	CorrelationIdLength int
	// CorrelationIdNonceLength of the unique identifier
	CorrelationIdNonceLength int
	// Certificate Path
	CertificatePath string
	// Private Key Path
	PrivateKeyPath string
	// CustomRecords is a file containing custom DNS records
	CustomRecords string
	// HTTP header containing origin IP
	OriginIPHeader string
	// Version is the version of interactsh server
	Version string
	// DiskStorage enables storing interactions on disk
	DiskStorage bool
	// DiskStoragePath defines the disk storage location
	DiskStoragePath string
	// DynamicResp enables dynamic HTTP response
	DynamicResp bool
	// EnableMetrics enables metrics endpoint
	EnableMetrics bool

	ACMEStore *acme.Provider
	Stats     *Metrics
}

Options contains configuration options for the servers

func (*Options) GetIdLength

func (options *Options) GetIdLength() int

func (*Options) URLReflection

func (options *Options) URLReflection(URL string) string

URLReflection returns a reversed part of the URL payload which is checked in the response.

type ResponderServer

type ResponderServer struct {
	LogFile string
	// contains filtered or unexported fields
}

ResponderServer is a Responder wrapper server instance

func NewResponderServer

func NewResponderServer(options *Options) (*ResponderServer, error)

NewResponderServer returns a new SMB server.

func (*ResponderServer) Close

func (h *ResponderServer) Close()

func (*ResponderServer) ListenAndServe

func (h *ResponderServer) ListenAndServe(responderAlive chan bool) error

ListenAndServe listens on various responder ports

type SMBServer

type SMBServer struct {
	LogFile string
	// contains filtered or unexported fields
}

SMBServer is a smb wrapper server instance

func NewSMBServer

func NewSMBServer(options *Options) (*SMBServer, error)

NewSMBServer returns a new SMB server.

func (*SMBServer) Close

func (h *SMBServer) Close()

func (*SMBServer) ListenAndServe

func (h *SMBServer) ListenAndServe(smbAlive chan bool) error

ListenAndServe listens on smb port

type SMTPServer

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

SMTPServer is a smtp server instance that listens both TLS and Non-TLS based servers.

func NewSMTPServer

func NewSMTPServer(options *Options) (*SMTPServer, error)

NewSMTPServer returns a new TLS & Non-TLS SMTP server.

func (*SMTPServer) ListenAndServe

func (h *SMTPServer) ListenAndServe(tlsConfig *tls.Config, smtpAlive, smtpsAlive chan bool)

ListenAndServe listens on smtp and/or smtps ports for the server.

Directories

Path Synopsis
Taken from https://github.com/chinzhiweiblank/coredns-acme/blob/e0cdfbdd78adfcc6c2d098255902f64ec60daecb/provider.go Copyright @chinzhiweiblank under Apache License 2.0
Taken from https://github.com/chinzhiweiblank/coredns-acme/blob/e0cdfbdd78adfcc6c2d098255902f64ec60daecb/provider.go Copyright @chinzhiweiblank under Apache License 2.0

Jump to

Keyboard shortcuts

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