Documentation ¶
Index ¶
- Constants
- Variables
- func Base64Decode(text string) ([]byte, error)
- func Base64Encode(text string) string
- func Build404URL(original string) (string, error)
- func BuildURLWithParam(original string, param string, payload string, urlEncode bool) (string, error)
- func BytesCountToHumanReadable(b int64) string
- func CalculateURLDepth(rawURL string) int
- func CapitalizeFirstLetter(input string) string
- func CloneMultipartFileHeader(fh *multipart.FileHeader) *multipart.FileHeader
- func CloneMultipartForm(f *multipart.Form) *multipart.Form
- func CloneURL(u *url.URL) *url.URL
- func CloneURLValues(v url.Values) url.Values
- func Colorize(text, color string) string
- func Contains(slice []string, item string) bool
- func DecodeBase36(s string) (int64, error)
- func DeepCopy(src, dest interface{}) error
- func DoWorkWithTimeout(fn interface{}, params []interface{}, timeout time.Duration) (interface{}, error)
- func EnsureCertificatesExist(certPath, keyPath, caCertPath, caKeyPath string) (*tls.Config, *tls.Config, error)
- func EscapeDots(input string) string
- func FilterOutString(slice []string, target string) []string
- func FormatOutput[T Formattable](data []T, format FormatType) (string, error)
- func FormatOutputToFile[T Formattable](data []T, format FormatType, filepath string) error
- func FormatSingleOutput[T Formattable](data T, format FormatType) (string, error)
- func GenerateCertificates(...) (*tls.Config, *tls.Config, error)
- func GenerateRandInt(min, max int) int
- func GenerateRandomLowercaseString(length int) string
- func GenerateRandomString(length int) string
- func GetBaseURL(urlStr string) (string, error)
- func GetHostFromURL(u string) (string, error)
- func GetIPFromURL(urlStr string) ([]net.IP, error)
- func GetLastPathSegment(rawurl string) (string, error)
- func GetParametersToTest(path string, params []string, testAllParams bool) (parametersToTest []string)
- func GetParentURL(urlStr string) (string, bool, error)
- func GetURLWithoutQueryString(urlStr string) (string, error)
- func GetUniqueBaseURLs(urls []string) ([]string, error)
- func GetUniqueItems(items []string) []string
- func HashBytes(data []byte) string
- func IsRootURL(urlStr string) (bool, error)
- func LocalFileExists(path string) bool
- func NormalizeURLParams(rawURL string) (string, error)
- func ParseHeadersStringToMap(headersStr string) map[string][]string
- func ReadFileByLines(filename string) ([]string, error)
- func ResolveDomain(domain string) ([]net.IP, error)
- func SetupCloseHandler()
- func SliceContains(slice []string, item string) bool
- func SliceContainsInt(slice []int, item int) bool
- func SliceContainsUint(slice []uint, item uint) bool
- func Slugify(text string) string
- func StringsSliceToText(items []string) string
- func ZeroConsoleAndFileLog() zerolog.Logger
- func ZeroConsoleLog() zerolog.Logger
- type Auditor
- type AuditorConfig
- type DataType
- type FormatType
- type Formattable
- type ParameterAuditItem
- type ParameterAuditor
- type ParameterValidValue
Constants ¶
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
const DefaultRandomStringsCharset = "abcdedfghijklmnopqrstABCDEFGHIJKLMNOP"
DefaultRandomStringsCharset Default charset used for random string generation
const (
LogTimeFormat = "2006-01-02T15:04:05.000"
)
Variables ¶
var TimeoutError = errors.New("operation timed out")
TimeoutError is returned when the operation times out
Functions ¶
func Base64Decode ¶
Helper function to base64 decode a string
func Base64Encode ¶
Base64Encode just returns a text encoded to base 64
func Build404URL ¶
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 ¶
BytesCountToHumanReadable converts bytes to a human-readable string format.
func CalculateURLDepth ¶
CalculateURLDepth calculates the depth of a URL. Returns -1 if the URL is invalid.
func CapitalizeFirstLetter ¶
CapitalizeFirstLetter capitalizes the first letter of a string
func CloneMultipartFileHeader ¶
func CloneMultipartFileHeader(fh *multipart.FileHeader) *multipart.FileHeader
func DecodeBase36 ¶
DecodeBase36 decodes a Base36 string to an integer
func DoWorkWithTimeout ¶
func EnsureCertificatesExist ¶
func FilterOutString ¶
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 GenerateRandInt ¶
GenerateRandInt generates a random integer between min and max
func GenerateRandomString ¶
GenerateRandomString returns a random string of the defined length
func GetBaseURL ¶
GetBaseURL extracts the base URL from a URL string.
func GetHostFromURL ¶
GetHostFromURL extracts the host from the given URL.
func GetIPFromURL ¶
GetIPFromURL takes a URL string, parses it to extract the host, and then resolves the host to IP addresses.
func GetLastPathSegment ¶
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 ¶
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 ¶
GetURLWithoutQueryString returns the base URL from the given URL by removing the query string
func GetUniqueBaseURLs ¶
GetUniqueBaseURLs parses a list of URLs and returns a slice of unique base URLs.
func GetUniqueItems ¶
GetUniqueItems takes a slice of strings and returns a new slice with unique items.
func LocalFileExists ¶
func NormalizeURLParams ¶
NormalizeURLParams normalizes the URL parameters by appending an "X" to each value.
func ParseHeadersStringToMap ¶
ParseHeadersStringToMap parses a string containing key-value pairs separated by commas into a map[string][]string
func ReadFileByLines ¶
func ResolveDomain ¶
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 ¶
SliceContains utility function to check if a slice of strings contains the specified string
func SliceContainsInt ¶
SliceContainsInt utility function to check if a slice of integers contains the specified integer
func SliceContainsUint ¶
SliceContainsUint utility function to check if a slice of uints contains the specified uint
func StringsSliceToText ¶
StringsSliceToText iterates a slice of strings to generate a text list, mainly for reporting
func ZeroConsoleLog ¶
Types ¶
type AuditorConfig ¶
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 ¶
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 ParameterAuditItem ¶
ParameterAuditItem struct
type ParameterAuditor ¶
type ParameterAuditor interface {
Run()
}