core

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name    = "aquatone"
	Version = "1.7.0"
	Author  = "Michael Henriksen"
	Website = "https://github.com/michenriksen/aquatone"
)
View Source
const (
	SessionStart  = "session:start"
	SessionEnd    = "session:end"
	Host          = "host"
	URL           = "url"
	URLResponsive = "url:responsive"
	TCPPort       = "port:tcp"
)
View Source
const (
	FATAL     = 5
	ERROR     = 4
	WARN      = 3
	IMPORTANT = 2
	INFO      = 1
	DEBUG     = 0
)

Variables

View Source
var (
	SmallPortList = []int{80, 443}

	MediumPortList = []int{80, 443, 8000, 8080, 8443}

	LargePortList = []int{80, 81, 443, 591, 2082, 2087, 2095, 2096, 3000, 8000, 8001,
		8008, 8080, 8083, 8443, 8834, 8888}

	XLargePortList = []int{80, 81, 300, 443, 591, 593, 832, 981, 1010, 1311,
		2082, 2087, 2095, 2096, 2480, 3000, 3128, 3333, 4243, 4567,
		4711, 4712, 4993, 5000, 5104, 5108, 5800, 6543, 7000, 7396,
		7474, 8000, 8001, 8008, 8014, 8042, 8069, 8080, 8081, 8088,
		8090, 8091, 8118, 8123, 8172, 8222, 8243, 8280, 8281, 8333,
		8443, 8500, 8834, 8880, 8888, 8983, 9000, 9043, 9060, 9080,
		9090, 9091, 9200, 9443, 9800, 9981, 12443, 16080, 18091, 18092,
		20720, 28017}
)

Functions

func Asset added in v1.4.0

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir added in v1.4.0

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo added in v1.4.0

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames added in v1.4.0

func AssetNames() []string

AssetNames returns the names of the assets.

func GetPageStructure

func GetPageStructure(body io.Reader) ([]string, error)

func GetSimilarity

func GetSimilarity(a, b []string) float64

func HostAndPortToURL

func HostAndPortToURL(host string, port int, protocol string) string

func MustAsset added in v1.4.0

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset added in v1.4.0

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets added in v1.4.0

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Header struct {
	Name              string `json:"name"`
	Value             string `json:"value"`
	DecreasesSecurity bool   `json:"decreasesSecurity"`
	IncreasesSecurity bool   `json:"increasesSecurity"`
}

func (*Header) SetSecurityFlags added in v1.7.0

func (h *Header) SetSecurityFlags()

type Logger

type Logger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(format string, args ...interface{})

func (*Logger) Important

func (l *Logger) Important(format string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, args ...interface{})

func (*Logger) Log

func (l *Logger) Log(level int, format string, args ...interface{})

func (*Logger) SetDebug

func (l *Logger) SetDebug(d bool)

func (*Logger) SetSilent

func (l *Logger) SetSilent(s bool)

func (*Logger) Warn

func (l *Logger) Warn(format string, args ...interface{})

type Note added in v1.4.0

type Note struct {
	Text string `json:"text"`
	Type string `json:"type"`
}

type Options

type Options struct {
	Threads           *int
	OutDir            *string
	SessionPath       *string
	TemplatePath      *string
	Proxy             *string
	ChromePath        *string
	Resolution        *string
	Ports             *string
	ScanTimeout       *int
	HTTPTimeout       *int
	ScreenshotTimeout *int
	Nmap              *bool
	SaveBody          *bool
	Silent            *bool
	Debug             *bool
	Version           *bool
}

func ParseOptions

func ParseOptions() (Options, error)

type Page

type Page struct {
	sync.Mutex
	UUID           string   `json:"uuid"`
	URL            string   `json:"url"`
	Hostname       string   `json:"hostname"`
	Addrs          []string `json:"addrs"`
	Status         string   `json:"status"`
	PageTitle      string   `json:"pageTitle"`
	PageStructure  []string `json:"-"`
	HeadersPath    string   `json:"headersPath"`
	BodyPath       string   `json:"bodyPath"`
	ScreenshotPath string   `json:"screenshotPath"`
	HasScreenshot  bool     `json:"hasScreenshot"`
	Headers        []Header `json:"headers"`
	Tags           []Tag    `json:"tags"`
	Notes          []Note   `json:"notes"`
}

func NewPage

func NewPage(pageURL string) (*Page, error)

func (*Page) AddHeader

func (p *Page) AddHeader(name string, value string)

func (*Page) AddNote added in v1.7.0

func (p *Page) AddNote(text string, noteType string)

func (*Page) AddTag added in v1.7.0

func (p *Page) AddTag(text string, tagType string, link string)

func (*Page) BaseFilename added in v1.7.0

func (p *Page) BaseFilename() string

func (*Page) IsIPHost added in v1.7.0

func (p *Page) IsIPHost() bool

func (*Page) ParsedURL added in v1.7.0

func (p *Page) ParsedURL() *url.URL

type Report

type Report struct {
	Session  *Session
	Template string
}

func NewReport

func NewReport(s *Session, templ string) *Report

func (*Report) Render

func (r *Report) Render(dest io.Writer) error

type Session

type Session struct {
	sync.Mutex
	Version                string                        `json:"version"`
	Options                Options                       `json:"-"`
	Out                    *Logger                       `json:"-"`
	Stats                  *Stats                        `json:"stats"`
	Pages                  map[string]*Page              `json:"pages"`
	PageSimilarityClusters map[string][]string           `json:"pageSimilarityClusters"`
	Ports                  []int                         `json:"-"`
	EventBus               EventBus.Bus                  `json:"-"`
	WaitGroup              sizedwaitgroup.SizedWaitGroup `json:"-"`
}

func NewSession

func NewSession() (*Session, error)

func (*Session) AddPage added in v1.7.0

func (s *Session) AddPage(url string) (*Page, error)

func (*Session) Asset added in v1.4.0

func (s *Session) Asset(name string) ([]byte, error)

func (*Session) BaseFilenameFromURL

func (s *Session) BaseFilenameFromURL(stru string) string

func (*Session) End

func (s *Session) End()

func (*Session) GetFilePath

func (s *Session) GetFilePath(p string) string

func (*Session) GetPage added in v1.7.0

func (s *Session) GetPage(url string) *Page

func (*Session) GetPageByUUID added in v1.7.0

func (s *Session) GetPageByUUID(id string) *Page

func (*Session) ReadFile

func (s *Session) ReadFile(p string) ([]byte, error)

func (*Session) SaveToFile added in v1.7.0

func (s *Session) SaveToFile(filename string) error

func (*Session) Start

func (s *Session) Start()

func (*Session) ToJSON added in v1.7.0

func (s *Session) ToJSON() string

type Stats

type Stats struct {
	StartedAt            time.Time `json:"startedAt"`
	FinishedAt           time.Time `json:"finishedAt"`
	PortOpen             uint32    `json:"portOpen"`
	PortClosed           uint32    `json:"portClosed"`
	RequestSuccessful    uint32    `json:"requestSuccessful"`
	RequestFailed        uint32    `json:"requestFailed"`
	ResponseCode2xx      uint32    `json:"responseCode2xx"`
	ResponseCode3xx      uint32    `json:"responseCode3xx"`
	ResponseCode4xx      uint32    `json:"responseCode4xx"`
	ResponseCode5xx      uint32    `json:"responseCode5xx"`
	ScreenshotSuccessful uint32    `json:"screenshotSuccessful"`
	ScreenshotFailed     uint32    `json:"screenshotFailed"`
}

func (*Stats) Duration

func (s *Stats) Duration() time.Duration

func (*Stats) IncrementPortClosed

func (s *Stats) IncrementPortClosed()

func (*Stats) IncrementPortOpen

func (s *Stats) IncrementPortOpen()

func (*Stats) IncrementRequestFailed

func (s *Stats) IncrementRequestFailed()

func (*Stats) IncrementRequestSuccessful

func (s *Stats) IncrementRequestSuccessful()

func (*Stats) IncrementResponseCode2xx

func (s *Stats) IncrementResponseCode2xx()

func (*Stats) IncrementResponseCode3xx

func (s *Stats) IncrementResponseCode3xx()

func (*Stats) IncrementResponseCode4xx

func (s *Stats) IncrementResponseCode4xx()

func (*Stats) IncrementResponseCode5xx

func (s *Stats) IncrementResponseCode5xx()

func (*Stats) IncrementScreenshotFailed

func (s *Stats) IncrementScreenshotFailed()

func (*Stats) IncrementScreenshotSuccessful

func (s *Stats) IncrementScreenshotSuccessful()

type Tag added in v1.4.0

type Tag struct {
	Text string `json:"text"`
	Type string `json:"type"`
	Link string `json:"link"`
	Hash string `json:"hash"`
}
func (t Tag) HasLink() bool

Jump to

Keyboard shortcuts

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