chrome

package
v0.0.0-...-a9bca5b Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chrome

type Chrome struct {
	ResolutionX int
	ResolutionY int
	UserAgent   string
	JsCode      string
	Timeout     int64
	Delay       int
	FullPage    bool
	ChromePath  string
	Proxy       string
	Headers     []string
	HeadersMap  map[string]interface{}

	// http codes to screenshot (used as a filter)
	ScreenshotCodes []int

	// save screenies as PDF's instead
	AsPDF bool
	// save screenies in db
	ScreenshotDbStore bool
	// contains filtered or unexported fields
}

Chrome contains information about a Google Chrome instance, with methods to run on it.

func NewChrome

func NewChrome() *Chrome

NewChrome returns a new initialised Chrome struct

func (*Chrome) Preflight

func (chrome *Chrome) Preflight(url *url.URL) (result *PreflightResult, err error)

Preflight will preflight a url

func (*Chrome) PrepareHeaderMap

func (chrome *Chrome) PrepareHeaderMap()

initalize the headers Map. we do this given the format chromedp wants Ref:

https://github.com/chromedp/examples/blob/master/headers/main.go

func (*Chrome) Screenshot

func (chrome *Chrome) Screenshot(url *url.URL) (result *ScreenshotResult, err error)

Screenshot takes a screenshot of a URL, optionally saving network and console events. Ref:

https://github.com/chromedp/examples/blob/255873ca0d76b00e0af8a951a689df3eb4f224c3/screenshot/main.go

func (*Chrome) StoreRequest

func (chrome *Chrome) StoreRequest(db *gorm.DB, preflight *PreflightResult, screenshot *ScreenshotResult, filename string) (uint, error)

StoreRequest will store request info to the DB

type ConsoleLog

type ConsoleLog struct {
	URLID uint

	Type  string
	Value string
}

type NetworkLog

type NetworkLog struct {
	URLID uint

	RequestID   string
	Time        time.Time
	RequestType storage.RequestType
	StatusCode  int64
	URL         string
	FinalURL    string // may differ from URL if there were redirects
	IP          string
	Error       string
}

type PreflightResult

type PreflightResult struct {
	URL              *url.URL
	HTTPResponse     *http.Response
	HTTPTitle        string
	HTTPTechnologies []string
}

PreflightResult contains the results of a preflight run

type ScreenshotResult

type ScreenshotResult struct {
	Screenshot []byte
	DOM        string

	// logging
	ConsoleLog []ConsoleLog
	NetworkLog []NetworkLog
}

ScreenshotResult contains the results of a screenshot

type Wappalyzer

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

func NewWappalyzer

func NewWappalyzer() *Wappalyzer

NewWappalyzer returns a new Wappalyzer instance. If an error occured, .error would contain an error()

func (*Wappalyzer) HTMLTitle

func (w *Wappalyzer) HTMLTitle(b []byte) string

HTMLTitle returns the title parsed from an HTML <title> tag.

func (*Wappalyzer) Technologies

func (w *Wappalyzer) Technologies(headers http.Header, body []byte) (tech []string)

Technologies uses wappalyzergo to determine known technologies from headers or an HTTP body

Jump to

Keyboard shortcuts

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