Documentation
¶
Index ¶
- Constants
- func AllInjectionPayloads(seed ...int64) map[string]string
- func EnumInt(anyArr ...any) (n int64)
- func EnumString(anyArr ...any) string
- func ExtractJSONPath(path string, data any) any
- func ExtractTopLevelJSONFields(body []byte) map[string]any
- func ExtractTopPrimitiveAttributes(b []byte, max int) (res []string)
- func ExtractTypes(val any, dataTemplate DataTemplateRequest) any
- func FileProperty(fileName string, name string) any
- func FindVariable(name string, data any) any
- func FlatRegexMap(val any) map[string]string
- func FormatCreditCard(cardNumber string) string
- func GenerateCreditCard(cardType CardType, seed int64) string
- func GenerateFuzzData(val any) any
- func IsJSONPathExpression(key string) bool
- func IsValidCreditCard(cardNumber string) bool
- func IsValidSSN(ssn string) bool
- func NewRandomSource(seed int64) *rand.Rand
- func ParseTemplate(dir string, byteBody []byte, data any) ([]byte, error)
- func PrefixTypeStringToRegEx(val string, dataTemplate DataTemplateRequest) string
- func PropertyContains(name string, targets []any, data any) bool
- func PropertyEquals(name string, data any, target any) bool
- func RandAddress() string
- func RandAirport() string
- func RandBase64() string
- func RandBool() bool
- func RandCity() string
- func RandCmdInjection(seed ...int64) string
- func RandCountry() string
- func RandCountryCode() string
- func RandCreditCard() string
- func RandCurrencyCode() string
- func RandEin() string
- func RandEmail() string
- func RandFileExtension() string
- func RandFileLine(fileName string) string
- func RandFilename() string
- func RandFirstFemaleName() string
- func RandFirstMaleName() string
- func RandFirstName() string
- func RandFlightNumber() string
- func RandFloatMax(max float64) float64
- func RandFloatMinMax(min, max float64) float64
- func RandFutureDate() string
- func RandHTTPStatus() int
- func RandHexColor() string
- func RandHost() string
- func RandIPv6() string
- func RandIntArrayMinMax(min int, max int) []int
- func RandIntMax(max int) int
- func RandIntMinMax(min, max int) int
- func RandItin() string
- func RandLDAPi(seed ...int64) string
- func RandLastName() string
- func RandLatitude() float64
- func RandLongitude() float64
- func RandMACAddress() string
- func RandMD5() string
- func RandMimeType() string
- func RandName() string
- func RandNoSQLi(seed ...int64) string
- func RandParagraph(min, max int) string
- func RandPassword() string
- func RandPastDate() string
- func RandPathTraversal(seed ...int64) string
- func RandPhone() string
- func RandPort() int
- func RandRGBColor() string
- func RandRegex(re string) string
- func RandSHA256() string
- func RandSQLi(seed ...int64) string
- func RandSSN() string
- func RandSSTI(seed ...int64) string
- func RandSemver() string
- func RandSentence(min, max int) string
- func RandSlug() string
- func RandSsn() string
- func RandString(n int) string
- func RandStringArrayMinMax(min int, max int) []string
- func RandStringMinMax(min int, max int) string
- func RandTimezone() string
- func RandTriString(sep string) string
- func RandURL() string
- func RandUSState() string
- func RandUSStateAbbr() string
- func RandUnixTimestamp() int64
- func RandUsername() string
- func RandWord(min, max int) string
- func RandXSS(seed ...int64) string
- func RandXXE(seed ...int64) string
- func RandomAirportByRegion(region string) string
- func ReMarshalArrayOrObjectWithIndent(b []byte) string
- func SeededAddress(seed int64) string
- func SeededAirport(seed int64) string
- func SeededBool(seed int64) bool
- func SeededCity(seed int64) string
- func SeededCountry(seed int64) string
- func SeededCountryCode(seed int64) string
- func SeededCreditCard(seed int64) string
- func SeededCurrencyCode(seed int64) string
- func SeededFileLine(fileName string, seed int64) string
- func SeededFirstFemaleName(seed int64) string
- func SeededFirstMaleName(seed int64) string
- func SeededFirstName(seed int64) string
- func SeededFlightNumber(seed int64) string
- func SeededLastName(seed int64) string
- func SeededName(seed int64) string
- func SeededRandCmdInjection(seed int64) string
- func SeededRandFloatMax(seed int64, min, max float64) float64
- func SeededRandIntMax(seed int64, min, max int) int
- func SeededRandLDAPi(seed int64) string
- func SeededRandNoSQLi(seed int64) string
- func SeededRandPathTraversal(seed int64) string
- func SeededRandSQLi(seed int64) string
- func SeededRandSSTI(seed int64) string
- func SeededRandXSS(seed int64) string
- func SeededRandXXE(seed int64) string
- func SeededSSN(seed int64) string
- func SeededTimezone(seed int64) string
- func SeededTriString(seed int64, sep string) string
- func SeededUSPostal(state string, seed int64) string
- func SeededUSState(seed int64) string
- func SeededUSStateAbbr(seed int64) string
- func SeededUUID(seed int64) string
- func StripTypeTags(re string) string
- func TemplateFuncs(dir string, data any) template.FuncMap
- func ToFloat64(input any) (res float64)
- func ULID() string
- func UUID() string
- func UnmarshalArrayOrObject(b []byte) (res any, err error)
- func UnmarshalArrayOrObjectAndExtractTypes(str string, dataTemplate DataTemplateRequest) (map[string]string, error)
- func UnmarshalArrayOrObjectAndExtractTypesAndMarshal(str string, dataTemplate DataTemplateRequest) (string, error)
- func ValidateRegexMap(val any, regex map[string]string) error
- func ValueToRegEx(val string, dataTemplate DataTemplateRequest) string
- func VariableJsonPath(varPath string, expected string, data any) bool
- func VariableNumber(name string, data any) float64
- func VariableSize(name string, data any) int
- type Airline
- type Airport
- type CardInfo
- type CardType
- type DataTemplateRequest
Constants ¶
const AnyWordRegex = `\w+`
AnyWordRegex constant
const BooleanPrefixRegex = PrefixTypeBoolean + `(false|true)`
BooleanPrefixRegex constant
const EmailRegex = `\w+@\w+\\.\w+`
EmailRegex constant
const EmailRegex2 = `\w+@\w+.?\w+`
EmailRegex2 constant
const EmailRegex3 = `.+@.+\..+`
EmailRegex3 constant
const EmailRegex4 = `.+@.+\\..+`
EmailRegex4 constant
const FixtureDataExt = ".dat"
FixtureDataExt extension
const IntPrefixRegex = PrefixTypeNumber + `[+-]?\d{1,10}`
IntPrefixRegex constant
const NumberPrefixRegex = PrefixTypeNumber + `[+-]?((\d{1,10}(\.\d{1,5})?)|(\.\d{1,10}))`
NumberPrefixRegex constant
const PrefixTypeArray = "__array__"
PrefixTypeArray type
const PrefixTypeBoolean = "__boolean__"
PrefixTypeBoolean type
const PrefixTypeExample = "__example__"
PrefixTypeExample type
const PrefixTypeNumber = "__number__"
PrefixTypeNumber type
const PrefixTypeObject = "__object__"
PrefixTypeObject type
const PrefixTypeString = "__string__"
PrefixTypeString type
const RequestCount = "_RequestCount"
RequestCount name
const UintPrefixRegex = PrefixTypeNumber + `\d{1,10}`
UintPrefixRegex constant
const UnescapeHTML = "UnescapeHTML"
UnescapeHTML flag
const WildRegex = `.+`
WildRegex constant
Variables ¶
This section is empty.
Functions ¶
func AllInjectionPayloads ¶
AllInjectionPayloads returns one random payload from each injection class. Useful for generating a diverse set of payloads in a single call.
func ExtractJSONPath ¶
ExtractJSONPath extracts a value at path from data. Supports: "user.id", "items[0].name", "$.user.id" (leading "$." is stripped).
func ExtractTopLevelJSONFields ¶
ExtractTopLevelJSONFields returns a flat map of top-level scalar (string/number/bool) fields from a JSON object body. Nested objects and arrays are included as-is. Used to inject request body fields as template parameters so {{.fieldName}} works in response templates without manual variable configuration.
func ExtractTopPrimitiveAttributes ¶
ExtractTopPrimitiveAttributes to fetch attributes
func ExtractTypes ¶
func ExtractTypes(val any, dataTemplate DataTemplateRequest) any
ExtractTypes extract types from any structure
func FindVariable ¶
FindVariable extracts variable property
func FlatRegexMap ¶
FlatRegexMap to add all regex in same map
func FormatCreditCard ¶
FormatCreditCard formats a credit card number with spaces based on its type
func GenerateCreditCard ¶
GenerateCreditCard generates a valid credit card number for the specified type
func GenerateFuzzData ¶
GenerateFuzzData using regex, data or types
func IsJSONPathExpression ¶
IsJSONPathExpression returns true when key starts with "$." or contains "[" followed by "]". Used to route assertion keys to JSONPath extraction instead of flat-key matching.
func IsValidCreditCard ¶
IsValidCreditCard checks if a credit card number is valid using the Luhn algorithm
func IsValidSSN ¶
IsValidSSN checks if an SSN is in the correct format and follows basic rules
func NewRandomSource ¶
NewRandomSource creates a new random source with a seed
func ParseTemplate ¶
ParseTemplate parses GO template with dynamic parameters
func PrefixTypeStringToRegEx ¶
func PrefixTypeStringToRegEx(val string, dataTemplate DataTemplateRequest) string
PrefixTypeStringToRegEx helper method for adding prefix and regex
func PropertyContains ¶
PropertyContains checks if variable contains value
func PropertyEquals ¶
PropertyEquals checks if variable is equal to the value
func RandBase64 ¶
func RandBase64() string
RandBase64 returns a random base64-encoded string (16 random bytes).
func RandCmdInjection ¶
RandCmdInjection returns a randomized OS command injection payload.
func RandCreditCard ¶
func RandCreditCard() string
func RandCurrencyCode ¶
func RandCurrencyCode() string
RandCurrencyCode returns a random ISO 4217 currency code.
func RandEin ¶
func RandEin() string
RandEin Generate a random United States Employer Identification Number EIN).
func RandFileExtension ¶
func RandFileExtension() string
RandFileExtension returns a random file extension (without dot).
func RandFilename ¶
func RandFilename() string
RandFilename generates a random filename with a random extension.
func RandFlightNumber ¶
func RandFlightNumber() string
RandFlightNumber generates a random flight number using real airline patterns
func RandFloatMax ¶
RandFloatMax returns random number between 0 and max
func RandFloatMinMax ¶
RandFloatMinMax returns random number between min and max
func RandFutureDate ¶
func RandFutureDate() string
RandFutureDate returns an ISO 8601 date 1–365 days in the future.
func RandHTTPStatus ¶
func RandHTTPStatus() int
RandHTTPStatus returns a random commonly-used HTTP status code.
func RandHexColor ¶
func RandHexColor() string
RandHexColor generates a random CSS hex color code (e.g. #3a7fcb).
func RandIntArrayMinMax ¶
RandIntArrayMinMax generator
func RandIntMinMax ¶
RandIntMinMax returns random number between min and max
func RandItin ¶
func RandItin() string
RandItin generator for random United States Individual Taxpayer Identification Number ITIN).
func RandLatitude ¶
func RandLatitude() float64
RandLatitude returns a random latitude value between -90 and 90.
func RandLongitude ¶
func RandLongitude() float64
RandLongitude returns a random longitude value between -180 and 180.
func RandMACAddress ¶
func RandMACAddress() string
RandMACAddress generates a random locally-administered unicast MAC address.
func RandNoSQLi ¶
RandNoSQLi returns a randomized NoSQL injection payload.
func RandParagraph ¶
RandParagraph generate a paragraph with at least min sentences and at most max sentences.
func RandPassword ¶
func RandPassword() string
RandPassword generates a random strong password (12–16 characters).
func RandPastDate ¶
func RandPastDate() string
RandPastDate returns an ISO 8601 date 1–365 days in the past.
func RandPathTraversal ¶
RandPathTraversal returns a randomized path traversal payload.
func RandPort ¶
func RandPort() int
RandPort returns a random unprivileged port number (1024–65535).
func RandRGBColor ¶
func RandRGBColor() string
RandRGBColor generates a random CSS rgb() color string.
func RandSemver ¶
func RandSemver() string
RandSemver generates a random semantic version string (e.g. 3.14.159).
func RandSentence ¶
RandSentence generate a sentence with at least min words and at most max words.
func RandSlug ¶
func RandSlug() string
RandSlug generates a URL-friendly slug (two lowercase words joined by a hyphen).
func RandSsn ¶
func RandSsn() string
RandSsn Generate a random invalid United States Social Security Identification Number SSN).
func RandStringArrayMinMax ¶
RandStringArrayMinMax generator
func RandTimezone ¶
func RandTimezone() string
RandTimezone returns a random IANA timezone identifier.
func RandUnixTimestamp ¶
func RandUnixTimestamp() int64
RandUnixTimestamp returns the current Unix epoch timestamp.
func RandUsername ¶
func RandUsername() string
RandUsername generates a random lowercase username (first name + digits).
func RandomAirportByRegion ¶
RandomAirportByRegion returns a random airport from a specific region
func ReMarshalArrayOrObjectWithIndent ¶
ReMarshalArrayOrObjectWithIndent helper method to unmarshal and marshal with indent
func SeededAirport ¶
SeededAirport returns a deterministic airport based on a seed
func SeededCountryCode ¶
SeededCountryCode country generator
func SeededCreditCard ¶
func SeededCurrencyCode ¶
SeededCurrencyCode returns a deterministic currency code based on seed.
func SeededFileLine ¶
SeededFileLine generator
func SeededFirstFemaleName ¶
SeededFirstFemaleName first name
func SeededFirstMaleName ¶
SeededFirstMaleName first name
func SeededFlightNumber ¶
SeededFlightNumber generates a deterministic flight number based on a seed
func SeededRandCmdInjection ¶
SeededRandCmdInjection returns a deterministic command injection payload for the given seed.
func SeededRandFloatMax ¶
SeededRandFloatMax returns random number with seed upto a max
func SeededRandIntMax ¶
SeededRandIntMax returns random number with seed upto a max
func SeededRandLDAPi ¶
SeededRandLDAPi returns a deterministic LDAP injection payload for the given seed.
func SeededRandNoSQLi ¶
SeededRandNoSQLi returns a deterministic NoSQL injection payload for the given seed.
func SeededRandPathTraversal ¶
SeededRandPathTraversal returns a deterministic path traversal payload for the given seed.
func SeededRandSQLi ¶
SeededRandSQLi returns a deterministic SQL injection payload for the given seed.
func SeededRandSSTI ¶
SeededRandSSTI returns a deterministic SSTI payload for the given seed.
func SeededRandXSS ¶
SeededRandXSS returns a deterministic XSS payload for the given seed.
func SeededRandXXE ¶
SeededRandXXE returns a deterministic XXE payload for the given seed.
func SeededSSN ¶
SeededSSN generates a random valid SSN - First 3 digits (area number): cannot be 000, 666, or 900-999 - Middle 2 digits (group number): cannot be 00 - Last 4 digits (serial number): cannot be 0000
func SeededTimezone ¶
SeededTimezone returns a deterministic IANA timezone based on seed.
func SeededTriString ¶
SeededTriString phrase generator
func SeededUSPostal ¶
SeededUSPostal Generate US postal code
func SeededUSStateAbbr ¶
SeededUSStateAbbr Generate US State
func SeededUUID ¶
SeededUUID generates a deterministic UUID v4 based on a seed value
func TemplateFuncs ¶
TemplateFuncs returns template functions
func UnmarshalArrayOrObject ¶
UnmarshalArrayOrObject helper function to unmarshal bytes based on object/array
func UnmarshalArrayOrObjectAndExtractTypes ¶
func UnmarshalArrayOrObjectAndExtractTypes(str string, dataTemplate DataTemplateRequest) (map[string]string, error)
UnmarshalArrayOrObjectAndExtractTypes helper method to unmarshal, add types and marshal again
func UnmarshalArrayOrObjectAndExtractTypesAndMarshal ¶
func UnmarshalArrayOrObjectAndExtractTypesAndMarshal(str string, dataTemplate DataTemplateRequest) (string, error)
UnmarshalArrayOrObjectAndExtractTypesAndMarshal helper method to unmarshal, add types and marshal again
func ValidateRegexMap ¶
ValidateRegexMap validate data against regex map. Keys starting with "$." or containing "[…]" are treated as JSONPath expressions and extracted from val before matching. All other keys use the existing flat-key logic.
func ValueToRegEx ¶
func ValueToRegEx(val string, dataTemplate DataTemplateRequest) string
ValueToRegEx value to regex
func VariableJsonPath ¶
VariableJsonPath Enhance PropertyMatches to support nested objects with JSON path
func VariableNumber ¶
VariableNumber returns numeric value for variable
func VariableSize ¶
VariableSize finds size of the variable
Types ¶
type Airport ¶
type Airport struct {
Code string
City string
Country string
Region string // NA = North America, EU = Europe, AS = Asia, etc.
}
Airport represents an airport with its IATA code, city, and country
func SeededAirportByRegion ¶
SeededAirportByRegion returns a deterministic airport from a specific region
type CardType ¶
type CardType string
CardType represents different credit card types
func GenerateRandomCreditCard ¶
GenerateRandomCreditCard generates a random valid credit card number of any type
func IdentifyCardType ¶
IdentifyCardType attempts to identify the card type from a card number
type DataTemplateRequest ¶
type DataTemplateRequest struct {
IncludeType bool `yaml:"include_type" json:"include_type"`
MinMultiplier int `yaml:"min_multiplier" json:"min_multiplier"`
MaxMultiplier int `yaml:"max_multiplier" json:"max_multiplier"`
}
DataTemplateRequest for generating random data pattern
func NewDataTemplateRequest ¶
func NewDataTemplateRequest(includeType bool, minMultiplier int, maxMultiplier int) DataTemplateRequest
NewDataTemplateRequest constructor
func (DataTemplateRequest) WithInclude ¶
func (dtr DataTemplateRequest) WithInclude(includeType bool) DataTemplateRequest
WithInclude instantiates copy with a new include type
func (DataTemplateRequest) WithMaxMultiplier ¶
func (dtr DataTemplateRequest) WithMaxMultiplier(multiplier int) DataTemplateRequest
WithMaxMultiplier instantiates copy with a new max multiplier