2024-04-26 19:30:35 +00:00
package gofakeit
import (
"fmt"
"math/rand"
"strconv"
"strings"
"github.com/brianvoe/gofakeit/v6/data"
)
// DomainName will generate a random url domain name
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func DomainName ( ) string { return domainName ( globalFaker . Rand ) }
// DomainName will generate a random url domain name
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) DomainName ( ) string { return domainName ( f . Rand ) }
func domainName ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
name := strings . Replace ( strings . ToLower ( jobDescriptor ( r ) + bs ( r ) ) , " " , "" , - 1 )
return fmt . Sprintf ( "%s.%s" , name , domainSuffix ( r ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// DomainSuffix will generate a random domain suffix
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func DomainSuffix ( ) string { return domainSuffix ( globalFaker . Rand ) }
// DomainSuffix will generate a random domain suffix
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) DomainSuffix ( ) string { return domainSuffix ( f . Rand ) }
func domainSuffix ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return getRandValue ( r , [ ] string { "internet" , "domain_suffix" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// URL will generate a random url string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func URL ( ) string { return url ( globalFaker . Rand ) }
// URL will generate a random url string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) URL ( ) string { return url ( f . Rand ) }
func url ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
// Slugs
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
num := number ( r , 1 , 4 )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
slug := make ( [ ] string , num )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
for i := 0 ; i < num ; i ++ {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
slug [ i ] = bs ( r )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
scheme := randomString ( r , [ ] string { "https" , "http" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
path := strings . ToLower ( strings . Join ( slug , "/" ) )
url := fmt . Sprintf ( "%s://www.%s/%s" , scheme , domainName ( r ) , path )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
url = strings . Replace ( url , " " , "" , - 1 )
return url
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// HTTPMethod will generate a random http method
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func HTTPMethod ( ) string { return httpMethod ( globalFaker . Rand ) }
// HTTPMethod will generate a random http method
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) HTTPMethod ( ) string { return httpMethod ( f . Rand ) }
func httpMethod ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return getRandValue ( r , [ ] string { "internet" , "http_method" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// IPv4Address will generate a random version 4 ip address
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func IPv4Address ( ) string { return ipv4Address ( globalFaker . Rand ) }
// IPv4Address will generate a random version 4 ip address
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) IPv4Address ( ) string { return ipv4Address ( f . Rand ) }
func ipv4Address ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
num := func ( ) int { return r . Intn ( 256 ) }
return fmt . Sprintf ( "%d.%d.%d.%d" , num ( ) , num ( ) , num ( ) , num ( ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// IPv6Address will generate a random version 6 ip address
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func IPv6Address ( ) string { return ipv6Address ( globalFaker . Rand ) }
// IPv6Address will generate a random version 6 ip address
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) IPv6Address ( ) string { return ipv6Address ( f . Rand ) }
func ipv6Address ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
num := func ( ) int { return r . Intn ( 65536 ) }
return fmt . Sprintf ( "%x:%x:%x:%x:%x:%x:%x:%x" , num ( ) , num ( ) , num ( ) , num ( ) , num ( ) , num ( ) , num ( ) , num ( ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// MacAddress will generate a random mac address
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func MacAddress ( ) string { return macAddress ( globalFaker . Rand ) }
// MacAddress will generate a random mac address
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) MacAddress ( ) string { return macAddress ( f . Rand ) }
func macAddress ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
num := 255
return fmt . Sprintf ( "%02x:%02x:%02x:%02x:%02x:%02x" , r . Intn ( num ) , r . Intn ( num ) , r . Intn ( num ) , r . Intn ( num ) , r . Intn ( num ) , r . Intn ( num ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// HTTPStatusCode will generate a random status code
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func HTTPStatusCode ( ) int { return httpStatusCode ( globalFaker . Rand ) }
// HTTPStatusCode will generate a random status code
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) HTTPStatusCode ( ) int { return httpStatusCode ( f . Rand ) }
func httpStatusCode ( r * rand . Rand ) int {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randInt , _ := strconv . Atoi ( getRandValue ( r , [ ] string { "internet" , "http_status_general" } ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return randInt
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// HTTPStatusCodeSimple will generate a random simple status code
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func HTTPStatusCodeSimple ( ) int { return httpStatusCodeSimple ( globalFaker . Rand ) }
// HTTPStatusCodeSimple will generate a random simple status code
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) HTTPStatusCodeSimple ( ) int { return httpStatusCodeSimple ( f . Rand ) }
func httpStatusCodeSimple ( r * rand . Rand ) int {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randInt , _ := strconv . Atoi ( getRandValue ( r , [ ] string { "internet" , "http_status_simple" } ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return randInt
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// LogLevel will generate a random log level
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
// See data/LogLevels for list of available levels
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func LogLevel ( logType string ) string { return logLevel ( globalFaker . Rand , logType ) }
// LogLevel will generate a random log level
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
// See data/LogLevels for list of available levels
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) LogLevel ( logType string ) string { return logLevel ( f . Rand , logType ) }
func logLevel ( r * rand . Rand , logType string ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
if _ , ok := data . LogLevels [ logType ] ; ok {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return getRandValue ( r , [ ] string { "log_level" , logType } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
return getRandValue ( r , [ ] string { "log_level" , "general" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// UserAgent will generate a random broswer user agent
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func UserAgent ( ) string { return userAgent ( globalFaker . Rand ) }
// UserAgent will generate a random broswer user agent
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) UserAgent ( ) string { return userAgent ( f . Rand ) }
func userAgent ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randNum := randIntRange ( r , 0 , 4 )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
switch randNum {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
case 0 :
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return chromeUserAgent ( r )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
case 1 :
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return firefoxUserAgent ( r )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
case 2 :
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return safariUserAgent ( r )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
case 3 :
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return operaUserAgent ( r )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
default :
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return chromeUserAgent ( r )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// ChromeUserAgent will generate a random chrome browser user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ChromeUserAgent ( ) string { return chromeUserAgent ( globalFaker . Rand ) }
// ChromeUserAgent will generate a random chrome browser user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) ChromeUserAgent ( ) string { return chromeUserAgent ( f . Rand ) }
func chromeUserAgent ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randNum1 := strconv . Itoa ( randIntRange ( r , 531 , 536 ) ) + strconv . Itoa ( randIntRange ( r , 0 , 2 ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randNum2 := strconv . Itoa ( randIntRange ( r , 36 , 40 ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randNum3 := strconv . Itoa ( randIntRange ( r , 800 , 899 ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return "Mozilla/5.0 " + "(" + randomPlatform ( r ) + ") AppleWebKit/" + randNum1 + " (KHTML, like Gecko) Chrome/" + randNum2 + ".0." + randNum3 + ".0 Mobile Safari/" + randNum1
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// FirefoxUserAgent will generate a random firefox broswer user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func FirefoxUserAgent ( ) string { return firefoxUserAgent ( globalFaker . Rand ) }
// FirefoxUserAgent will generate a random firefox broswer user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) FirefoxUserAgent ( ) string { return firefoxUserAgent ( f . Rand ) }
func firefoxUserAgent ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
ver := "Gecko/" + date ( r ) . Format ( "2006-01-02" ) + " Firefox/" + strconv . Itoa ( randIntRange ( r , 35 , 37 ) ) + ".0"
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
platforms := [ ] string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"(" + windowsPlatformToken ( r ) + "; " + "en-US" + "; rv:1.9." + strconv . Itoa ( randIntRange ( r , 0 , 3 ) ) + ".20) " + ver ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"(" + linuxPlatformToken ( r ) + "; rv:" + strconv . Itoa ( randIntRange ( r , 5 , 8 ) ) + ".0) " + ver ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"(" + macPlatformToken ( r ) + " rv:" + strconv . Itoa ( randIntRange ( r , 2 , 7 ) ) + ".0) " + ver ,
}
return "Mozilla/5.0 " + randomString ( r , platforms )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// SafariUserAgent will generate a random safari browser user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func SafariUserAgent ( ) string { return safariUserAgent ( globalFaker . Rand ) }
// SafariUserAgent will generate a random safari browser user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) SafariUserAgent ( ) string { return safariUserAgent ( f . Rand ) }
func safariUserAgent ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
randNum := strconv . Itoa ( randIntRange ( r , 531 , 536 ) ) + "." + strconv . Itoa ( randIntRange ( r , 1 , 51 ) ) + "." + strconv . Itoa ( randIntRange ( r , 1 , 8 ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
ver := strconv . Itoa ( randIntRange ( r , 4 , 6 ) ) + "." + strconv . Itoa ( randIntRange ( r , 0 , 2 ) )
mobileDevices := [ ] string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"iPhone; CPU iPhone OS" ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"iPad; CPU OS" ,
}
platforms := [ ] string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"(Windows; U; " + windowsPlatformToken ( r ) + ") AppleWebKit/" + randNum + " (KHTML, like Gecko) Version/" + ver + " Safari/" + randNum ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"(" + macPlatformToken ( r ) + " rv:" + strconv . Itoa ( randIntRange ( r , 4 , 7 ) ) + ".0; en-US) AppleWebKit/" + randNum + " (KHTML, like Gecko) Version/" + ver + " Safari/" + randNum ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
"(" + randomString ( r , mobileDevices ) + " " + strconv . Itoa ( randIntRange ( r , 7 , 9 ) ) + "_" + strconv . Itoa ( randIntRange ( r , 0 , 3 ) ) + "_" + strconv . Itoa ( randIntRange ( r , 1 , 3 ) ) + " like Mac OS X; " + "en-US" + ") AppleWebKit/" + randNum + " (KHTML, like Gecko) Version/" + strconv . Itoa ( randIntRange ( r , 3 , 5 ) ) + ".0.5 Mobile/8B" + strconv . Itoa ( randIntRange ( r , 111 , 120 ) ) + " Safari/6" + randNum ,
}
return "Mozilla/5.0 " + randomString ( r , platforms )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// OperaUserAgent will generate a random opera browser user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func OperaUserAgent ( ) string { return operaUserAgent ( globalFaker . Rand ) }
// OperaUserAgent will generate a random opera browser user agent string
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) OperaUserAgent ( ) string { return operaUserAgent ( f . Rand ) }
func operaUserAgent ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
platform := "(" + randomPlatform ( r ) + "; en-US) Presto/2." + strconv . Itoa ( randIntRange ( r , 8 , 13 ) ) + "." + strconv . Itoa ( randIntRange ( r , 160 , 355 ) ) + " Version/" + strconv . Itoa ( randIntRange ( r , 10 , 13 ) ) + ".00"
return "Opera/" + strconv . Itoa ( randIntRange ( r , 8 , 10 ) ) + "." + strconv . Itoa ( randIntRange ( r , 10 , 99 ) ) + " " + platform
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// linuxPlatformToken will generate a random linux platform
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func linuxPlatformToken ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return "X11; Linux " + getRandValue ( r , [ ] string { "computer" , "linux_processor" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// macPlatformToken will generate a random mac platform
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func macPlatformToken ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return "Macintosh; " + getRandValue ( r , [ ] string { "computer" , "mac_processor" } ) + " Mac OS X 10_" + strconv . Itoa ( randIntRange ( r , 5 , 9 ) ) + "_" + strconv . Itoa ( randIntRange ( r , 0 , 10 ) )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// windowsPlatformToken will generate a random windows platform
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func windowsPlatformToken ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return getRandValue ( r , [ ] string { "computer" , "windows_platform" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// randomPlatform will generate a random platform
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func randomPlatform ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
platforms := [ ] string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
linuxPlatformToken ( r ) ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
macPlatformToken ( r ) ,
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
windowsPlatformToken ( r ) ,
}
return randomString ( r , platforms )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
// HTTPVersion will generate a random http version
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func HTTPVersion ( ) string { return httpVersion ( globalFaker . Rand ) }
// HTTPVersion will generate a random http version
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
func ( f * Faker ) HTTPVersion ( ) string { return httpVersion ( f . Rand ) }
func httpVersion ( r * rand . Rand ) string {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return getRandValue ( r , [ ] string { "internet" , "http_version" } )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}
func addInternetLookup ( ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
AddFuncLookup ( "url" , Info {
2024-07-24 23:45:04 +00:00
Display : "URL" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Web address that specifies the location of a resource on the internet" ,
2024-07-24 23:45:04 +00:00
Example : "http://www.principalproductize.biz/target" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return url ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "domainname" , Info {
2024-07-24 23:45:04 +00:00
Display : "Domain Name" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Human-readable web address used to identify websites on the internet" ,
2024-07-24 23:45:04 +00:00
Example : "centraltarget.biz" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return domainName ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "domainsuffix" , Info {
2024-07-24 23:45:04 +00:00
Display : "Domain Suffix" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "The part of a domain name that comes after the last dot, indicating its type or purpose" ,
2024-07-24 23:45:04 +00:00
Example : "org" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return domainSuffix ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "ipv4address" , Info {
2024-07-24 23:45:04 +00:00
Display : "IPv4 Address" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Numerical label assigned to devices on a network for identification and communication" ,
2024-07-24 23:45:04 +00:00
Example : "222.83.191.222" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return ipv4Address ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "ipv6address" , Info {
2024-07-24 23:45:04 +00:00
Display : "IPv6 Address" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Numerical label assigned to devices on a network, providing a larger address space than IPv4 for internet communication" ,
2024-07-24 23:45:04 +00:00
Example : "2001:cafe:8898:ee17:bc35:9064:5866:d019" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return ipv6Address ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "httpmethod" , Info {
2024-07-24 23:45:04 +00:00
Display : "HTTP Method" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Verb used in HTTP requests to specify the desired action to be performed on a resource" ,
2024-07-24 23:45:04 +00:00
Example : "HEAD" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return httpMethod ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "loglevel" , Info {
2024-07-24 23:45:04 +00:00
Display : "Log Level" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Classification used in logging to indicate the severity or priority of a log entry" ,
2024-07-24 23:45:04 +00:00
Example : "error" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return logLevel ( r , "" ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "useragent" , Info {
2024-07-24 23:45:04 +00:00
Display : "User Agent" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "String sent by a web browser to identify itself when requesting web content" ,
2024-07-24 23:45:04 +00:00
Example : "Mozilla/5.0 (Windows NT 5.0) AppleWebKit/5362 (KHTML, like Gecko) Chrome/37.0.834.0 Mobile Safari/5362" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return userAgent ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "chromeuseragent" , Info {
2024-07-24 23:45:04 +00:00
Display : "Chrome User Agent" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "The specific identification string sent by the Google Chrome web browser when making requests on the internet" ,
2024-07-24 23:45:04 +00:00
Example : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/5312 (KHTML, like Gecko) Chrome/39.0.836.0 Mobile Safari/5312" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return chromeUserAgent ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "firefoxuseragent" , Info {
2024-07-24 23:45:04 +00:00
Display : "Firefox User Agent" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "The specific identification string sent by the Firefox web browser when making requests on the internet" ,
2024-07-24 23:45:04 +00:00
Example : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_3 rv:7.0) Gecko/1900-07-01 Firefox/37.0" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return firefoxUserAgent ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "operauseragent" , Info {
2024-07-24 23:45:04 +00:00
Display : "Opera User Agent" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "The specific identification string sent by the Opera web browser when making requests on the internet" ,
2024-07-24 23:45:04 +00:00
Example : "Opera/8.39 (Macintosh; U; PPC Mac OS X 10_8_7; en-US) Presto/2.9.335 Version/10.00" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return operaUserAgent ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "safariuseragent" , Info {
2024-07-24 23:45:04 +00:00
Display : "Safari User Agent" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "The specific identification string sent by the Safari web browser when making requests on the internet" ,
2024-07-24 23:45:04 +00:00
Example : "Mozilla/5.0 (iPad; CPU OS 8_3_2 like Mac OS X; en-US) AppleWebKit/531.15.6 (KHTML, like Gecko) Version/4.0.5 Mobile/8B120 Safari/6531.15.6" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return safariUserAgent ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "httpstatuscode" , Info {
2024-07-24 23:45:04 +00:00
Display : "HTTP Status Code" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Random http status code" ,
2024-07-24 23:45:04 +00:00
Example : "200" ,
Output : "int" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return httpStatusCode ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "httpstatuscodesimple" , Info {
2024-07-24 23:45:04 +00:00
Display : "HTTP Status Code Simple" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Three-digit number returned by a web server to indicate the outcome of an HTTP request" ,
2024-07-24 23:45:04 +00:00
Example : "404" ,
Output : "int" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return httpStatusCodeSimple ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "httpversion" , Info {
2024-07-24 23:45:04 +00:00
Display : "HTTP Version" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Number indicating the version of the HTTP protocol used for communication between a client and a server" ,
2024-07-24 23:45:04 +00:00
Example : "HTTP/1.1" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return httpVersion ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
AddFuncLookup ( "macaddress" , Info {
2024-07-24 23:45:04 +00:00
Display : "MAC Address" ,
Category : "internet" ,
2024-04-26 19:30:35 +00:00
Description : "Unique identifier assigned to network interfaces, often used in Ethernet networks" ,
2024-07-24 23:45:04 +00:00
Example : "cb:ce:06:94:22:e9" ,
Output : "string" ,
2024-04-26 19:30:35 +00:00
Generate : func ( r * rand . Rand , m * MapParams , info * Info ) ( any , error ) {
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
return macAddress ( r ) , nil
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
} ,
} )
2024-07-24 23:45:04 +00:00
2024-04-26 19:30:35 +00:00
}