v0.0.0-...-2a31ebf Latest Latest

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 23 Imported by: 0




View Source
const (
	// Accept is the default HTTP Accept header value used by Amass.
	Accept = "text/html,application/json,application/xhtml+xml,application/xml;q=0.5,*/*;q=0.2"
	// AcceptLang is the default HTTP Accept-Language header value used by Amass.
	AcceptLang = "en-US,en;q=0.5"


View Source
var DefaultClient *http.Client

DefaultClient is the same HTTP client used by the package methods.

View Source
var (
	// UserAgent is the default user agent used by Amass during HTTP requests.
	UserAgent string


func CheckCookie

func CheckCookie(urlString string, cookieName string) bool

CheckCookie checks if a cookie exists in the cookie jar for a given host

func CleanName

func CleanName(name string) string

CleanName will clean up the names scraped from the web.

func CopyCookies

func CopyCookies(src string, dest string)

CopyCookies copies cookies from one domain to another. Some of our data sources rely on shared auth tokens and this avoids sending extra requests to have the site reissue cookies for the other domains.

func Crawl

func Crawl(ctx context.Context, u string, scope []string, max int, callback func(*Request, *Response)) error

Crawl will spider the web page at the URL argument looking while staying within the scope provided.

func NamesFromCert

func NamesFromCert(cert *x509.Certificate) []string

NamesFromCert parses DNS names out of a TLS certificate.

func PullCertificateNames

func PullCertificateNames(ctx context.Context, addr string, ports []int) []string

PullCertificateNames attempts to pull a cert from one or more ports on an IP.

func TLSConn

func TLSConn(ctx context.Context, host string, port int) (*tls.Conn, error)

TLSConn attempts to make a TLS connection with the host on the given port.


type BasicAuth

type BasicAuth struct {
	Username string
	Password string

BasicAuth contains the data used for HTTP basic authentication.

type Header map[string]string

Header represents the HTTP headers for requests and responses.

func HdrToAmassHeader

func HdrToAmassHeader(hdr http.Header) Header

HdrToAmassHeader converts a net/http Header to an Amass Header.

type Request

type Request struct {
	URL    string
	Method string
	Header Header
	Body   string
	Auth   *BasicAuth

Request represents the HTTP request in the Amass preferred format.

func ReqToAmassRequest

func ReqToAmassRequest(req *http.Request) *Request

ReqToAmassRequest converts a net/http Request to an Amass Request.

type Response

type Response struct {
	Status     string
	StatusCode int
	Proto      string
	ProtoMajor int
	ProtoMinor int
	Header     Header
	Body       string
	Length     int64
	TLS        *tls.ConnectionState

Response represents the HTTP response in the Amass preferred format.

func RequestWebPage

func RequestWebPage(ctx context.Context, r *Request) (*Response, error)

RequestWebPage returns the response headers, body, and status code for the provided URL when successful.

func RespToAmassResponse

func RespToAmassResponse(resp *http.Response) *Response

RespToAmassResponse converts a net/http Response to an Amass Response.

Jump to

Keyboard shortcuts

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