common

package
v0.0.0-...-98d202b Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB = &mgo.Database{}
View Source
var FlowCollect = &mgo.Collection{}
View Source
var Session = &mgo.Session{}
View Source
var VulnCollect = &mgo.Collection{}
View Source
var WSHandler = melody.New()

Functions

func B64Decode

func B64Decode(content string) string

func GenrateFlowID

func GenrateFlowID() string

Generate UUID (will check if it exists in the DB)

func GetContainsWeight

func GetContainsWeight(keyword, content string) float32

Simply calculate the proportion of keyword in content

func GetNowTime

func GetNowTime() int64

func IsB64

func IsB64(content string) bool

func SimilarText

func SimilarText(first, second string) float64

Calculate text similarity using Jaccard, used to identify 404 page

func URLDecode

func URLDecode(content string) (string, error)

Types

type Flow

type Flow struct {
	// UUID
	ID      string `json:"id"`
	Session int64  `json:"session"`
	// Request
	HttpVersion   string            `json:"httpVersion"` // e.g. "HTTP/1.0"
	RemoteAddr    string            `json:"remoteAddr"`
	Scheme        string            `json:"scheme"` // e.g. "http"
	BasicAuth     map[string]string `json:"basicAuth"`
	Host          string            `json:"host"`
	Port          int               `json:"port"`
	Method        string            `json:"method"`
	Path          string            `json:"path"`
	Query         map[string]string `json:"query"`    // GET parameter
	Fragment      string            `json:"fragment"` // URL HASH content
	URL           string            `json:"url"`      // uri
	Headers       map[string]string `json:"headers"`
	Cookies       map[string]string `json:"cookies"`
	Form          map[string]string `json:"form"`     // GET/POST/PUT content
	PostForm      map[string]string `json:"postform"` // POST content
	ContentLength int64             `json:"contentLength"`
	// MultipartForm *multipart.Form  // MultipartForm, temporarily not processed
	// Response
	ResponseHttpVersion   string            `json:"responseHttpVersion"` // e.g. "HTTP/1.0"
	ResponseStatus        string            `json:"responseStatus"`      // e.g. "200 OK"
	ResponseStatusCode    int               `json:"responseStatusCode"`  // e.g. 200
	ResponseHeaders       map[string]string `json:"responseHeaders"`
	ResponseCookies       map[string]string `json:"responseCookies"`
	ResponseBody          string            `json:"responseBody"`
	ResponseContentLength int64             `json:"responseContentLength"`
	// Other
	CreateTime   int64 `json:"createTime"`
	RequestTime  int64 `json:"requestTime"`
	ResponseTime int64 `json:"responseTime"`
}

HTTPFlow information

func GenrateFlow

func GenrateFlow(ctx *goproxy.ProxyCtx) Flow

Convert ctx to Flow

func (Flow) Broadcast

func (this Flow) Broadcast(mode string)

func (Flow) GetSafeBaseURL

func (this Flow) GetSafeBaseURL() string

Prevent other protocol, such as (ws/wss)

func (Flow) LogFlow

func (this Flow) LogFlow() bool

insert to database

type FlowContext

type FlowContext struct {
	FlowID       string
	RequestTime  int64
	ResponseTime int64
}

type Vuln

type Vuln struct {
	FlowID     string `json:"flowid"`
	Host       string `json:"host"`
	Title      string `json:"title"`
	Level      string `json:"level"`
	Content    string `json:"content"`
	CreateTime int64  `json:"createtime"`
}

Vulnerability information

func (Vuln) Broadcast

func (this Vuln) Broadcast()

func (Vuln) LogVulnInfo

func (this Vuln) LogVulnInfo() bool

insert to database

Jump to

Keyboard shortcuts

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