lib

package
v0.0.0-...-aa95b58 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ResetColor = "\033[0m"

	Red    = "\033[31m"
	Green  = "\033[32m"
	Yellow = "\033[33m"
	Blue   = "\033[34m"
	Purple = "\033[35m"
	Cyan   = "\033[36m"
	White  = "\033[37m"
)

ANSI color codes

View Source
const DefaultRandomStringsCharset = "abcdedfghijklmnopqrstABCDEFGHIJKLMNOP"

DefaultRandomStringsCharset Default charset used for random string generation

View Source
const (
	LogTimeFormat = "2006-01-02T15:04:05.000"
)

Variables

View Source
var TimeoutError = errors.New("operation timed out")

TimeoutError is returned when the operation times out

Functions

func Base64Decode

func Base64Decode(text string) ([]byte, error)

Helper function to base64 decode a string

func Base64Encode

func Base64Encode(text string) string

Base64Encode just returns a text encoded to base 64

func Build404URL

func Build404URL(original string) (string, error)

Build404URL Adds a randomly generated path to the URL to fingerprint 404 errors

func BuildURLWithParam

func BuildURLWithParam(original string, param string, payload string, urlEncode bool) (string, error)

BuildURLWithParam builds a URL with the provided parameter and payload

func BytesCountToHumanReadable

func BytesCountToHumanReadable(b int64) string

BytesCountToHumanReadable converts bytes to a human-readable string format.

func CalculateURLDepth

func CalculateURLDepth(rawURL string) int

CalculateURLDepth calculates the depth of a URL. Returns -1 if the URL is invalid.

func CapitalizeFirstLetter

func CapitalizeFirstLetter(input string) string

CapitalizeFirstLetter capitalizes the first letter of a string

func CloneMultipartFileHeader

func CloneMultipartFileHeader(fh *multipart.FileHeader) *multipart.FileHeader

func CloneMultipartForm

func CloneMultipartForm(f *multipart.Form) *multipart.Form

func CloneURL

func CloneURL(u *url.URL) *url.URL

func CloneURLValues

func CloneURLValues(v url.Values) url.Values

func Colorize

func Colorize(text, color string) string

Colorize wraps the text with the specified color and resets the color after.

func Contains

func Contains(slice []string, item string) bool

Need to refactor existing contains to SliceContains

func DecodeBase36

func DecodeBase36(s string) (int64, error)

DecodeBase36 decodes a Base36 string to an integer

func DeepCopy

func DeepCopy(src, dest interface{}) error

func DoWorkWithTimeout

func DoWorkWithTimeout(fn interface{}, params []interface{}, timeout time.Duration) (interface{}, error)

func EnsureCertificatesExist

func EnsureCertificatesExist(certPath, keyPath, caCertPath, caKeyPath string) (*tls.Config, *tls.Config, error)

func EscapeDots

func EscapeDots(input string) string

EscapeDots escapes dots in a string

func FilterOutString

func FilterOutString(slice []string, target string) []string

FilterOutString removes all instances of target from the slice.

func FormatOutput

func FormatOutput[T Formattable](data []T, format FormatType) (string, error)

func FormatOutputToFile

func FormatOutputToFile[T Formattable](data []T, format FormatType, filepath string) error

func FormatSingleOutput

func FormatSingleOutput[T Formattable](data T, format FormatType) (string, error)

func GenerateCertificates

func GenerateCertificates(certPath, keyPath, caCertPath, caKeyPath, organization, country, locality, streetAddress, postalCode string) (*tls.Config, *tls.Config, error)

func GenerateRandInt

func GenerateRandInt(min, max int) int

GenerateRandInt generates a random integer between min and max

func GenerateRandomLowercaseString

func GenerateRandomLowercaseString(length int) string

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString returns a random string of the defined length

func GetBaseURL

func GetBaseURL(urlStr string) (string, error)

GetBaseURL extracts the base URL from a URL string.

func GetHostFromURL

func GetHostFromURL(u string) (string, error)

GetHostFromURL extracts the host from the given URL.

func GetIPFromURL

func GetIPFromURL(urlStr string) ([]net.IP, error)

GetIPFromURL takes a URL string, parses it to extract the host, and then resolves the host to IP addresses.

func GetLastPathSegment

func GetLastPathSegment(rawurl string) (string, error)

func GetParametersToTest

func GetParametersToTest(path string, params []string, testAllParams bool) (parametersToTest []string)

GetParametersToTest returns a list of parameters to test based on the provided path and params

func GetParentURL

func GetParentURL(urlStr string) (string, bool, error)

GetParentURL returns the parent URL for the given URL. If the given URL is already a parent URL, the function returns true as the second return value.

func GetURLWithoutQueryString

func GetURLWithoutQueryString(urlStr string) (string, error)

GetURLWithoutQueryString returns the base URL from the given URL by removing the query string

func GetUniqueBaseURLs

func GetUniqueBaseURLs(urls []string) ([]string, error)

GetUniqueBaseURLs parses a list of URLs and returns a slice of unique base URLs.

func GetUniqueItems

func GetUniqueItems(items []string) []string

GetUniqueItems takes a slice of strings and returns a new slice with unique items.

func HashBytes

func HashBytes(data []byte) string

func IsRootURL

func IsRootURL(urlStr string) (bool, error)

func LocalFileExists

func LocalFileExists(path string) bool

func NormalizeURLParams

func NormalizeURLParams(rawURL string) (string, error)

NormalizeURLParams normalizes the URL parameters by appending an "X" to each value.

func ParseHeadersStringToMap

func ParseHeadersStringToMap(headersStr string) map[string][]string

ParseHeadersStringToMap parses a string containing key-value pairs separated by commas into a map[string][]string

func ReadFileByLines

func ReadFileByLines(filename string) ([]string, error)

func ResolveDomain

func ResolveDomain(domain string) ([]net.IP, error)

ResolveDomain takes a domain name and returns its IP addresses.

func SetupCloseHandler

func SetupCloseHandler()

SetupCloseHandler creates a 'listener' on a new goroutine which will notify the program if it receives an interrupt from the OS. We then handle this by calling our clean up procedure and exiting the program.

func SliceContains

func SliceContains(slice []string, item string) bool

SliceContains utility function to check if a slice of strings contains the specified string

func SliceContainsInt

func SliceContainsInt(slice []int, item int) bool

SliceContainsInt utility function to check if a slice of integers contains the specified integer

func SliceContainsUint

func SliceContainsUint(slice []uint, item uint) bool

SliceContainsUint utility function to check if a slice of uints contains the specified uint

func Slugify

func Slugify(text string) string

func StringsSliceToText

func StringsSliceToText(items []string) string

StringsSliceToText iterates a slice of strings to generate a text list, mainly for reporting

func ZeroConsoleAndFileLog

func ZeroConsoleAndFileLog() zerolog.Logger

ZeroConsoleAndFileLog

func ZeroConsoleLog

func ZeroConsoleLog() zerolog.Logger

Types

type Auditor

type Auditor interface {
}

type AuditorConfig

type AuditorConfig struct {
	AuditPoolSize    int
	PageLoadTimeout  int
	KeepAfterSuccess bool
}

type DataType

type DataType string
const (
	TypeInt     DataType = "Integer"
	TypeFloat   DataType = "Float"
	TypeJSON    DataType = "JSON"
	TypeXML     DataType = "XML"
	TypeSVG     DataType = "SVG"
	TypeDate1   DataType = "Date (YYYY-MM-DD)"
	TypeDate2   DataType = "Date (MM/DD/YYYY)"
	TypeArray   DataType = "Array"
	TypeBoolean DataType = "Boolean"
	TypeEmail   DataType = "Email"
	TypeURL     DataType = "URL"
	TypeBase64  DataType = "Base64"
	TypeBase32  DataType = "Base32"
	TypeBase36  DataType = "Base36"
	TypeUUID    DataType = "UUID"
	TypeHex     DataType = "Hexadecimal"
	TypeHTML    DataType = "HTML"
	TypeJSCode  DataType = "JavaScript Code"
	TypeString  DataType = "String"
)

func GuessDataType

func GuessDataType(s string) DataType

type FormatType

type FormatType string
const (
	Pretty FormatType = "pretty"
	Text   FormatType = "text"
	JSON   FormatType = "json"
	YAML   FormatType = "yaml"
	Table  FormatType = "table"
)

func ParseFormatType

func ParseFormatType(format string) (FormatType, error)

ParseFormatType converts a string format to a FormatType.

type Formattable

type Formattable interface {
	String() string
	Pretty() string
	TableHeaders() []string
	TableRow() []string
}

type ParameterAuditItem

type ParameterAuditItem struct {
	Parameter string
	Payload   string
	URL       string
	URLEncode bool
}

ParameterAuditItem struct

type ParameterAuditor

type ParameterAuditor interface {
	Run()
}

type ParameterValidValue

type ParameterValidValue struct {
	Type        string
	Value       string
	IsDynamic   bool
	IsReflected bool
}

ParameterValidValue struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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