Documentation
¶
Index ¶
- Constants
- Variables
- func GetSHA256Hash(text string) string
- func InitializeYara(yaraRulesPath string) error
- func NormalizeURL(url string) string
- func SliceContains(slice []string, item string) bool
- func TextContains(text, pattern string) bool
- type Analysis
- type Brands
- type Browser
- type Check
- type CheckFunction
- type Dialog
- type Download
- type Link
- type LogCodec
- type Page
- type Resource
- type Warning
Constants ¶
const BrowserEventWaitTime time.Duration = 15
BrowserEventWaitTime is the seconds we wait while attempting to fetch some events from DevTools, before failing.
const BrowserTimeout time.Duration = 1
BrowserTimeout is the minutes we will wait before declaring failed the connection to our debugged browser or to the URL failed.
const BrowserWaitTime time.Duration = 5
BrowserWaitTime is the seconds we will wait before fetching navigation results.
Variables ¶
var SafeBrowsingKey string
SafeBrowsingKey contains the API key to use Google SafeBrowsing API.
var YaraRules *yara.Rules
YaraRules will contain compiled Yara rules provided by InitializeYara.
Functions ¶
func GetSHA256Hash ¶ added in v1.8.0
GetSHA256Hash retrieves a SHA256 hash of a string.
func InitializeYara ¶
InitializeYara will load any rule files found at the specified path and compile them into a Rules object.
func NormalizeURL ¶
NormalizeURL fixes a URL that is e.g. missing a scheme, etc.
func SliceContains ¶
SliceContains checks whether a string is contained in a slice of strings.
func TextContains ¶
TextContains will determine if a substring is present in a string. It is case-insensitive.
Types ¶
type Analysis ¶
type Analysis struct { URL string `json:"url"` FinalURL string `json:"final_url"` HTML string `json:"html"` Warnings []Warning `json:"warnings"` Score int `json:"score"` Safelisted bool `json:"safelisted"` Dangerous bool `json:"dangerous"` Brands *Brands `json:"brands"` }
Analysis contains information on the outcome of the URL and/or HTML analysis.
func NewAnalysis ¶
NewAnalysis instantiates a new Analysis struct.
func (*Analysis) AnalyzeDomain ¶
AnalyzeDomain performs all the available checks to be run on a URL or domain.
func (*Analysis) AnalyzeHTML ¶
AnalyzeHTML performs all the available checks to be run on an HTML string.
func (*Analysis) AnalyzePage ¶ added in v1.11.0
AnalyzePage performs all the available checks to be run on an HTML string as well as the provided list of resources (e.g. downloaded scripts).
func (*Analysis) AnalyzeURL ¶
AnalyzeURL performs all the available checks to be run on a URL or domain.
type Brands ¶
Brands defines the attribute of our list of supported brands.
func (*Brands) GetBrand ¶
GetBrand determines which among the marked brands is most likely the one impersonated by the page.
func (*Brands) IsDomainSafelisted ¶
IsDomainSafelisted checks if the specified domain is in any of the safelists of the supported brands.
func (*Brands) IsLinkDangerous ¶ added in v1.9.1
IsLinkDangerous checks if the specified link matches a brand's dangerous regexp.
type Browser ¶
type Browser struct { URL string `json:"url"` FinalURL string `json:"final_url"` Visits []string `json:"visits"` Resources []Resource `json:"resources"` Downloads []Download `json:"downloads"` Dialogs []Dialog `json:"dialogs"` HTML string `json:"html"` ScreenshotPath string `json:"screenshot_path"` ScreenshotData string `json:"screenshot_data"` UseTor bool `json:"use_tor"` DebugPort int `json:"debug_port"` DebugURL string `json:"debug_url"` LogEvents bool `json:"log_events"` UserAgent string `json:"user_agent"` ImageName string `json:"image_name"` ContainerID string `json:"container_id"` }
Browser is a struct containing details over a browser navigation to a URL.
type Check ¶
type Check struct { Call CheckFunction Score int Name string Description string }
Check defines the general proprties of a CheckFunction.
func GetDomainChecks ¶
func GetDomainChecks() []Check
GetDomainChecks returns a list of only the checks that work for domain names.
func GetHTMLChecks ¶
func GetHTMLChecks() []Check
GetHTMLChecks returns a list of all the available HTML checks.
func GetURLChecks ¶
func GetURLChecks() []Check
GetURLChecks returns a list of all the available URL checks.
type CheckFunction ¶
CheckFunction defines the functions used to implement URL or HTML checks.
type Dialog ¶ added in v1.13.0
type Dialog struct { URL string `json:"url"` Type string `json:"type"` Message string `json:"message"` }
Dialog contains details of JavaScript dialogs opened.
type Download ¶ added in v1.13.0
Download contains details of files which were offered for download at the link.
type Link ¶
type Link struct { URL string Scheme string Domain string Port string TopDomain string Path string RawQuery string Parameters map[string]string }
Link defines details of a parsed URL.
type LogCodec ¶ added in v1.13.0
type LogCodec struct {
// contains filtered or unexported fields
}
Adapted from: https://pkg.go.dev/github.com/mafredri/cdp#example-package-Logging LogCodec captures the output from writing RPC requests and reading responses on the connection. It implements rpcc.Codec via WriteRequest and ReadResponse.
func (*LogCodec) ReadResponse ¶ added in v1.13.0
ReadResponse unmarshals from the connection into v whilst echoing what is read into a buffer for logging.
type Page ¶
Page contains information on the HTML page.
func (*Page) GetEntities ¶
GetEntities returns any HTML entity of the specified type.