Documentation ¶
Overview ¶
Package session contains code to manage the interactive session, modules, environment, etc.
Index ¶
- Constants
- Variables
- func AsTag(name string) string
- func DoModulePrompt(module string, items []string) (result string, err error)
- func Prompt(s *Session)
- type Configuration
- type Module
- type Redirect
- type Session
- func (s *Session) CheckLog() (err error)
- func (s *Session) CheckRedirect()
- func (s *Session) CheckStaticServer() (err error)
- func (s *Session) CheckTracking() (err error)
- func (s *Session) DoChecks() (err error)
- func (s *Session) GetConfiguration() (err error)
- func (s *Session) GetModuleNames() (mods []string)
- func (s *Session) GetTLSClientConfig() *tls.Config
- func (s *Session) InitRedis() error
- func (s *Session) Module(name string) (mod Module, err error)
- func (s *Session) Register(mod Module, err error)
- func (s *Session) UpdateConfiguration(domains *[]string) (err error)
- type SessionModule
- func (m *SessionModule) Debug(format string, args ...interface{})
- func (m *SessionModule) Err(error error)
- func (m *SessionModule) Error(format string, args ...interface{})
- func (m *SessionModule) Important(format string, args ...interface{})
- func (m *SessionModule) Info(format string, args ...interface{})
- func (m *SessionModule) Raw(format string, args ...interface{})
- func (m *SessionModule) Verbose(format string, args ...interface{})
- func (m *SessionModule) Warning(format string, args ...interface{})
- type StaticHTTPConfig
Constants ¶
const (
InvalidCommand = "invalid option, enter help for assistance"
)
Variables ¶
var ( DefaultIP = "0.0.0.0" DefaultListener = "tcp" DefaultHTTPPort = 80 DefaultHTTPSPort = 443 DefaultBase64Padding = []string{"=", "."} DefaultSkipContentType = []string{"font/*", "image/*"} )
var (
RedisPool *redis.Pool
)
Functions ¶
func DoModulePrompt ¶ added in v1.21.1
DoModulePrompt generates a prompt for a specific module
Types ¶
type Configuration ¶
type Configuration struct { // // Proxy rules // Proxy struct { Phishing string `toml:"phishing"` Target string `toml:"destination"` IP string `toml:"IP"` Listener string `toml:"listener"` Port int `toml:"port"` PortMap string `toml:"portmapping"` HTTPtoHTTPS struct { Enabled bool `toml:"enable"` HTTPport int `toml:"port"` } `toml:"HTTPtoHTTPS"` Protocol string `toml:"-"` } `toml:"proxy"` // // Origins // Origins struct { ExternalOriginPrefix string `toml:"externalOriginPrefix"` ExternalOrigins []string `toml:"externalOrigins"` OriginsMapping map[string]string `toml:"-"` SubdomainMap [][]string `toml:"subdomainMap"` } `toml:"origins"` // // Transforming rules // Transform struct { Base64 struct { Enabled bool `toml:"enable"` Padding []string `toml:"padding"` } `toml:"base64"` Request struct { SkipExtensions []string `toml:"-"` UserAgent string `toml:"userAgent"` // Headers list to consider for the transformation Headers []string `toml:"headers"` Remove struct { Headers []string `toml:"headers"` } `toml:"remove"` Add struct { Headers []struct { Name string `toml:"name"` Value string `toml:"value"` } `toml:"headers"` } `toml:"add"` } `toml:"request"` Response struct { SkipContentType []string `toml:"skipContentType"` Headers []string `toml:"headers"` // CustomContent Transformations CustomContent [][]string `toml:"customContent"` Cookie struct { SameSite string `toml:"sameSite"` } `toml:"cookie"` Remove struct { Headers []string `toml:"headers"` } `toml:"remove"` Add struct { Headers []struct { Name string `toml:"name"` Value string `toml:"value"` } `toml:"headers"` } `toml:"add"` } `toml:"response"` } `toml:"transform"` Redirects []Redirect `toml:"redirect"` // // Logging // Log struct { Enabled bool `toml:"enable"` FilePath string `toml:"filePath"` } `toml:"log"` // // DB (Redis) // Redis struct { Host string `toml:"host"` // default: 127.0.0.1 Port int `toml:"port"` // default: 6379 Password string `toml:"password"` // default: "" } `toml:"redis"` // // TLS // TLS struct { Enabled bool `toml:"enable"` Expand bool `toml:"expand"` Certificate string `toml:"certificate"` Key string `toml:"key"` Root string `toml:"root"` SSLKeyLog string `toml:"sslKeyLog"` CertificateContent string `toml:"-"` KeyContent string `toml:"-"` RootContent string `toml:"-"` // Minimum supported TLS version: SSL3, TLS1, TLS1.1, TLS1.2, TLS1.3 MinVersion string `toml:"minVersion"` MaxVersion string `toml:"maxVersion"` PreferServerCipherSuites bool `toml:"preferServerCipherSuites"` SessionTicketsDisabled bool `toml:"SessionTicketsDisabled"` InsecureSkipVerify bool `toml:"insecureSkipVerify"` RenegotiationSupport string `toml:"renegotiationSupport"` } `toml:"tls"` // // Tracking // Tracking struct { Enabled bool `toml:"enable"` TrackRequestCookies bool `toml:"trackRequestCookies"` Trace struct { Identifier string `toml:"identifier"` Header string `toml:"header"` Domain string `toml:"domain"` ValidatorRegex string `toml:"validator"` Landing struct { Type string `toml:"type"` // path or query Header string `toml:"header"` RedirectTo string `toml:"redirectTo"` // redirect url once the landing is detected (applicable only if type is path) } `toml:"landing"` } `toml:"trace"` Secrets struct { Paths []string `toml:"paths"` Patterns []struct { Label string `toml:"label"` Matching string `toml:"matching"` Start string `toml:"start"` End string `toml:"end"` } `toml:"patterns"` } `toml:"secrets"` } `toml:"tracking"` // Crawler Crawler struct { Enabled bool `toml:"enable"` Depth int `toml:"depth"` UpTo int `toml:"upto"` } // `toml:"crawler"` TODO: Temporarily disabled // // Necrobrowser // Necrobrowser struct { Enabled bool `toml:"enable"` SensitiveLocations struct { AuthSession []string `toml:"authSession"` AuthSessionResponse []string `toml:"authSessionResponse"` } `toml:"urls"` Endpoint string `toml:"endpoint"` Profile string `toml:"profile"` // Keepalive struct { // Enabled bool `toml:"enable"` // Minutes int `toml:"minutes"` // } `toml:"keepalive"` Trigger struct { Type string `toml:"type"` Values []string `toml:"values"` Delay int `toml:"delay"` } `toml:"trigger"` } `toml:"necrobrowser"` StaticServer StaticHTTPConfig `toml:"staticServer"` // // Watchdog // Watchdog struct { Enabled bool `toml:"enable"` Dynamic bool `toml:"dynamic"` Rules string `toml:"rules"` GeoDB string `toml:"geoDB"` } `toml:"watchdog"` // // Telegram // Telegram struct { Enabled bool `toml:"enable"` BotToken string `toml:"botToken"` ChatIDs []string `toml:"chatIDs"` } `toml:"telegram"` }
Configuration struct
type Session ¶
type Session struct { Options core.Options Config *Configuration Modules moduleList }
Session structure
func (*Session) CheckLog ¶ added in v1.21.1
CheckLog checks the log configuration and disables it if the file is not accessible.
func (*Session) CheckRedirect ¶ added in v1.21.1
func (s *Session) CheckRedirect()
CheckRedirect checks the redirect rules and removes invalid ones.
func (*Session) CheckStaticServer ¶ added in v1.21.1
CheckStaticServer checks the static server configuration and disables it if the file is not accessible.
func (*Session) CheckTracking ¶ added in v1.21.1
CheckTracking checks the tracking configuration and disables it if the file is not accessible.
func (*Session) GetConfiguration ¶
GetConfiguration returns the configuration object
func (*Session) GetModuleNames ¶ added in v1.21.1
GetModuleNames returns a list of available modules
func (*Session) GetTLSClientConfig ¶ added in v1.21.1
func (*Session) InitRedis ¶ added in v1.21.1
InitRedis initialize the connection to a Redis database
func (*Session) UpdateConfiguration ¶
type SessionModule ¶
type SessionModule struct { Session *Session `toml:"-"` Name string `toml:"-"` // contains filtered or unexported fields }
func NewSessionModule ¶
func NewSessionModule(name string, s *Session) SessionModule
func (*SessionModule) Debug ¶
func (m *SessionModule) Debug(format string, args ...interface{})
func (*SessionModule) Err ¶ added in v1.21.1
func (m *SessionModule) Err(error error)
func (*SessionModule) Error ¶
func (m *SessionModule) Error(format string, args ...interface{})
func (*SessionModule) Important ¶
func (m *SessionModule) Important(format string, args ...interface{})
func (*SessionModule) Info ¶
func (m *SessionModule) Info(format string, args ...interface{})
func (*SessionModule) Raw ¶ added in v1.21.1
func (m *SessionModule) Raw(format string, args ...interface{})
func (*SessionModule) Verbose ¶ added in v1.21.1
func (m *SessionModule) Verbose(format string, args ...interface{})
func (*SessionModule) Warning ¶
func (m *SessionModule) Warning(format string, args ...interface{})