session

package
v0.0.0-...-6d7c776 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

*

## ## ######## ## ## ####### ######## ######## ######## ######## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ## ## ######## ## ## ###### ######## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######## ### ### ####### ## ## ######## ######## ## ##

"NewOrder" - Reverse Proxy SE
    "CHANGE THE WORLD..."

Copyright 2022 (C) NEMESIS. neworder@tutamail.com. All rights reserved.

*

Package session contains code to manage the interactive session, modules, environment, etc.

*

## ## ######## ## ## ####### ######## ######## ######## ######## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ## ## ######## ## ## ###### ######## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######## ### ### ####### ## ## ######## ######## ## ##

"NewOrder" - Reverse Proxy SE
    "CHANGE THE WORLD..."

Copyright 2022 (C) NEMESIS. neworder@tutamail.com. All rights reserved.

*

*

## ## ######## ## ## ####### ######## ######## ######## ######## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ## ## ######## ## ## ###### ######## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######## ### ### ####### ## ## ######## ######## ## ##

"NewOrder" - Reverse Proxy SE
    "CHANGE THE WORLD..."

Copyright 2022 (C) NEMESIS. neworder@tutamail.com. All rights reserved.

*

Index

Constants

View Source
const (
	DefaultIP        = "127.0.0.1"
	DefaultListener  = "tcp"
	DefaultHTTPPort  = 80
	DefaultHTTPSPort = 443
)
View Source
const (
	InvalidCommand = "invalid option, enter help for assistance"
)

Variables

View Source
var (
	RedisPool *redis.Pool
)

Functions

func AsTag

func AsTag(name string) string

func DoModulePrompt

func DoModulePrompt(module string, items []string) (result string, err error)

DoModulePrompt generates a prompt for a specific module

func Prompt

func Prompt(s *Session)

Types

type Configuration

type Configuration struct {
	Protocol       string   `toml:"-"`
	SkipExtensions []string `toml:"-"`

	//
	// 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:"enabled"`
			HTTPport int  `toml:"HTTPport"`
		} `toml:"HTTPtoHTTPS"`
	} `toml:"proxy"`

	//
	// Transforming rules
	//
	Transform struct {
		Base64 struct {
			Enabled bool     `toml:"enabled"`
			Padding []string `toml:"padding"`
		} `toml:"base64"`

		SkipContentType []string `toml:"skipContentType"`

		Request struct {
			Headers []string `toml:"headers"`
		} `toml:"request"`

		Response struct {
			Headers []string   `toml:"headers"`
			Custom  [][]string `toml:"content"`
		} `toml:"response"`
	} `toml:"transform"`

	//
	// Wiping rules
	//
	Remove struct {
		Request struct {
			Headers []string `toml:"headers"`
		} `toml:"request"`

		Response struct {
			Headers []string `toml:"headers"`
		} `toml:"response"`
	} `toml:"remove"`

	//
	// Crafting rules
	// TODO: Merge this with Wiping rule in some standard approach
	//
	Craft struct {
		Add struct {
			Request struct {
				Headers []struct {
					Name  string `toml:"name"`
					Value string `toml:"value"`
				} `toml:"headers"`
			} `toml:"request"`

			Response struct {
				Headers []struct {
					Name  string `toml:"name"`
					Value string `toml:"value"`
				} `toml:"headers"`
			} `toml:"response"`
		} `toml:"add"`
	} `toml:"craft"`

	//
	// Redirection rules
	//
	Drop []struct {
		Path       string `toml:"path"`
		RedirectTo string `toml:"redirectTo"`
	} `toml:"drop"`

	//
	// Logging
	//
	Log struct {
		Enabled  bool   `toml:"enabled"`
		FilePath string `toml:"filePath"`
	} `toml:"log"`

	//
	// DB (Redis)
	//
	Redis struct {
		Host     string `toml:"host"`
		Port     int    `toml:"port"`
		Password string `toml:"password"`
	} `toml:"redis"`

	//
	// TLS
	//
	TLS struct {
		Enabled     bool   `toml:"enabled"`
		Expand      bool   `toml:"expand"`
		Certificate string `toml:"certificate"`
		Key         string `toml:"key"`
		Root        string `toml:"root"`

		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"`
		PreferServerCipherSuites bool   `toml:"preferServerCipherSuites"`
		SessionTicketsDisabled   bool   `toml:"SessionTicketsDisabled"`
		InsecureSkipVerify       bool   `toml:"insecureSkipVerify"`
		RenegotiationSupport     string `toml:"renegotiationSupport"`
	} `toml:"tls"`

	Crawler struct {
		Enabled bool `toml:"enabled"`
		Depth   int  `toml:"depth"`
		UpTo    int  `toml:"upto"`

		ExternalOriginPrefix string            `toml:"externalOriginPrefix"`
		ExternalOrigins      []string          `toml:"externalOrigins"`
		OriginsMapping       map[string]string `toml:"-"`
	} `toml:"crawler"`

	//
	// Necrobrowser
	//
	NecroBrowser struct {
		Enabled  bool   `toml:"enabled"`
		Endpoint string `toml:"endpoint"`
		Profile  string `toml:"profile"`

		Keepalive struct {
			Enabled bool `toml:"enabled"`
			Minutes int  `toml:"minutes"`
		} `toml:"keepalive"`

		Trigger struct {
			Type   string   `toml:"type"`
			Values []string `toml:"values"`
			Delay  int      `toml:"delay"`
		} `toml:"trigger"`
	} `toml:"necrobrowser"`

	//
	// Static Server
	//
	StaticServer struct {
		Enabled   bool   `toml:"enabled"`
		Port      int    `toml:"port"`
		LocalPath string `toml:"localPath"`
		URLPath   string `toml:"urlPath"`
	} `toml:"staticServer"`

	//
	// Watchdog
	//
	Watchdog struct {
		Enabled bool   `toml:"enabled"`
		Dynamic bool   `toml:"dynamic"`
		Rules   string `toml:"rules"`
		GeoDB   string `toml:"geoDB"`
	} `toml:"watchdog"`

	//
	// Tracking
	//
	Tracking struct {
		Enabled    bool   `toml:"enabled"`
		Type       string `toml:"type"`
		Identifier string `toml:"identifier"`
		Header     string `toml:"header"`
		Landing    string `toml:"landing"`
		Domain     string `toml:"domain"`
		IPSource   string `toml:"ipSource"`
		Regex      string `toml:"regex"`
		RedirectTo string `toml:"redirectTo"`

		Urls struct {
			Credentials []string `toml:"credentials"`
			AuthSession []string `toml:"authSession"`
		} `toml:"urls"`

		Patterns []struct {
			Label    string `toml:"label"`
			Matching string `toml:"matching"`
			Start    string `toml:"start"`
			End      string `toml:"end"`
		} `toml:"patterns"`
	} `toml:"tracking"`
}

Configuration

type Module

type Module interface {
	Name() string
	Description() string
	Author() string
	Prompt()
}

type Session

type Session struct {
	Options core.Options
	Config  *Configuration
	Modules moduleList
}

Session structure

func New

func New() (*Session, error)

New session

func (*Session) GetConfiguration

func (s *Session) GetConfiguration() (err error)

GetConfiguration returns the configuration object

func (*Session) GetModuleNames

func (s *Session) GetModuleNames() (mods []string)

GetModuleNames returns a list of available modules

func (*Session) InitRedis

func (s *Session) InitRedis() error

InitRedis initialize the connection to a Redis database

func (*Session) Module

func (s *Session) Module(name string) (mod Module, err error)

Module retrieves a module from session modules

func (*Session) Register

func (s *Session) Register(mod Module, err error)

Register appends the provided module to the session

func (*Session) UpdateConfiguration

func (s *Session) UpdateConfiguration(domains *[]string) (err error)

type SessionModule

type SessionModule struct {
	Session *Session
	Name    string
	// 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

func (m *SessionModule) Err(error error)

func (*SessionModule) Error

func (m *SessionModule) Error(format string, args ...interface{})

func (*SessionModule) Fatal

func (m *SessionModule) Fatal(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

func (m *SessionModule) Raw(format string, args ...interface{})

func (*SessionModule) Warning

func (m *SessionModule) Warning(format string, args ...interface{})

Jump to

Keyboard shortcuts

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