Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateSHA3256(value string) string
- func ValidateAdversary(value interface{}) (string, string, error)
- func ValidateBase64(value interface{}) (string, string, error)
- func ValidateBoolean(value interface{}) (bool, string, error)
- func ValidateCIDR(value interface{}) (string, string, error)
- func ValidateCity(value interface{}) (string, string, error)
- func ValidateCountry(value interface{}) (string, string, error)
- func ValidateDate(value interface{}) (string, string, error)
- func ValidateDatetime(value interface{}) (string, string, error)
- func ValidateEmail(value interface{}) (string, string, error)
- func ValidateFQDN(value interface{}) (string, string, error)
- func ValidateFloat(value interface{}) (float64, string, error)
- func ValidateHexadecimal(value interface{}) (string, string, error)
- func ValidateIP(value interface{}) (string, string, error)
- func ValidateInteger(value interface{}) (int64, string, error)
- func ValidateMAC(value interface{}) (string, string, error)
- func ValidateMD5(value interface{}) (string, string, error)
- func ValidateMime(value interface{}) (string, string, error)
- func ValidateObject(value interface{}) (string, string, error)
- func ValidatePath(value interface{}) (string, string, error)
- func ValidatePhone(value interface{}) (string, string, error)
- func ValidatePort(value interface{}) (string, string, error)
- func ValidateRegEx(regex, value string) error
- func ValidateRegexComp(value interface{}) (string, string, error)
- func ValidateSHA1(value interface{}) (string, string, error)
- func ValidateSHA224(value interface{}) (string, string, error)
- func ValidateSHA256(value interface{}) (string, string, error)
- func ValidateSHA3224(value interface{}) (string, string, error)
- func ValidateSHA3256(value interface{}) (string, string, error)
- func ValidateSHA3384(value interface{}) (string, string, error)
- func ValidateSHA3512(value interface{}) (string, string, error)
- func ValidateSHA384(value interface{}) (string, string, error)
- func ValidateSHA512(value interface{}) (string, string, error)
- func ValidateSHA512224(value interface{}) (string, string, error)
- func ValidateSHA512256(value interface{}) (string, string, error)
- func ValidateString(value interface{}, insensitive bool) (string, string, error)
- func ValidateURL(value interface{}) (string, string, error)
- func ValidateUUID(value interface{}) (uuid.UUID, string, error)
- func ValidateValue(value interface{}, t string) (interface{}, string, error)
- type Definition
- type Entity
Constants ¶
const ( STR = "Case-sensitive string" IP = "IP" EMAIL = "Email" FQDN = "FQDN" INTEGER = "Integer" CIDR = "CIDR" CITY = "City" COUNTRY = "Country" FLOAT = "Float" URL = "URL" MD5 = "MD5" HEXADECIMAL = "Hexadecimal" BASE64 = "BASE64" DATE = "Date" MAC = "MAC" MIME = "MIME type" PHONE = "Phone" SHA1 = "SHA-1" SHA224 = "SHA-224" SHA256 = "SHA-256" SHA384 = "SHA-384" SHA512 = "SHA-512" SHA3_224 = "SHA3-224" SHA3_256 = "SHA3-256" SHA3_384 = "SHA3-384" SHA3_512 = "SHA3-512" SHA512_224 = "SHA512-224" SHA512_256 = "SHA512-256" DATETIME = "Datetime" UUID = "UUID" BOOLEAN = "Boolean" ISTR = "String" PATH = "Path" OBJECT = "UUID|MD5|SHA3-256" ADVERSARY = "Adversary" REGEX = "Regex" PORT = "Port" )
Variables ¶
var Definitions = []Definition{}/* 128 elements not displayed */
Functions ¶
func GenerateSHA3256 ¶
GenerateSHA3256 generates a SHA3-256 hash from the given string.
func ValidateAdversary ¶
ValidateAdversary validates if the given value is a valid adversary. It checks if the value is a valid URL, UUID, email, IP, phone or FQDN. If any of these validations pass, it returns an error. If the value is not a string, it returns an error. Otherwise, it returns the value and its SHA3-256 hash.
func ValidateBase64 ¶
ValidateBase64 validates if a given string is a valid base64 encoded string. It returns the original string, its SHA3-256 hash and an error if the validation fails.
func ValidateBoolean ¶
ValidateBoolean validates if a given value is a boolean and generates a SHA3-256 hash of the value. Returns a boolean indicating if the value is a boolean, the SHA3-256 hash of the value and an error if any.
func ValidateCIDR ¶
ValidateCIDR validates if a given string is a valid CIDR notation and returns the CIDR string and its SHA3-256 hash.
func ValidateCity ¶
ValidateCity validates a city name by converting it to title case and generating a SHA3-256 hash. It takes a value of type interface{} and returns the validated city name, its SHA3-256 hash, and an error (if any).
func ValidateCountry ¶
ValidateCountry validates a given country string value by converting it to title case and generating a SHA3-256 hash. Returns the validated country string value, its SHA3-256 hash, and an error if the value is not a string.
func ValidateDate ¶
ValidateDate validates a date string in the format "2006-01-02" and returns the formatted date string and its SHA3-256 hash.
func ValidateDatetime ¶
ValidateDatetime validates a datetime string in the RFC3339Nano format and returns the formatted datetime string and its SHA3-256 hash.
func ValidateEmail ¶
ValidateEmail validates if a given string is a valid email address. It returns the email address, its SHA3-256 hash and an error if any.
func ValidateFQDN ¶
ValidateFQDN validates a fully qualified domain name (FQDN) string. It returns the validated FQDN, its SHA3-256 hash, and an error if the validation fails.
func ValidateFloat ¶
ValidateFloat validates if the given value is a float64 or an int64 that can be converted to a float64. It returns the validated float64 value, its SHA3-256 hash, and an error if the value is not a float64 or an int64.
func ValidateHexadecimal ¶
ValidateHexadecimal validates if the given value is a valid hexadecimal string. It returns the hexadecimal string in lowercase format, its SHA3-256 hash and an error if any.
func ValidateIP ¶
ValidateIP validates if the given IP address is valid and not private, multicast, loopback, or unspecified. It returns the validated IP address and its SHA3-256 hash.
func ValidateInteger ¶
ValidateInteger validates if a value is an integer and returns its int64 representation, its SHA3-256 hash and an error if the value is not an integer.
func ValidateMAC ¶
ValidateMAC validates if a given string is a valid MAC address and returns the MAC address in uppercase and its SHA3-256 hash.
func ValidateMD5 ¶
ValidateMD5 validates if a given string is a valid MD5 hash. It receives a value of type interface{} and returns the validated string, its SHA3-256 hash and an error.
func ValidateMime ¶
ValidateMime validates if a given string is a valid MIME type and returns the validated string, its SHA3-256 hash and an error if any.
func ValidateObject ¶
ValidateObject validates an object by checking if it's a valid UUID, MD5 or SHA3256 hash. If the object is valid, it returns the string representation of the hash, the hash itself and no error. If the object is invalid, it returns empty strings and an error.
func ValidatePath ¶
ValidatePath validates if the given value is a valid path and returns the path in lowercase and its SHA3-256 hash. If the value is not a string or contains "://" it returns an error.
func ValidatePhone ¶
ValidatePhone validates a phone number and returns the validated phone number and its SHA3-256 hash. If the value is not a string, it returns an error.
func ValidatePort ¶ added in v1.0.1
ValidatePort validates a port with protocol. It returns the validated PORT, its SHA3-256 hash, and an error if the validation fails.
func ValidateRegEx ¶
ValidateRegEx validates if a given value matches a regular expression. It returns an error if the value does not match the expression.
func ValidateRegexComp ¶
ValidateRegexComp validates if a given value is a valid regular expression. It returns the validated value, its SHA3-256 hash, and an error if the value is not a string or is not a valid regular expression.
func ValidateSHA1 ¶
ValidateSHA1 validates if a given value is a valid SHA1 hash. It receives a value of any type and returns the validated SHA1 hash as a string, its SHA3-256 hash as a string and an error if the value is not a string or if it is not a valid SHA1 hash.
func ValidateSHA224 ¶
ValidateSHA224 validates if a given string is a valid SHA-224 hash and returns the hash in lowercase and its SHA3-256 hash.
func ValidateSHA256 ¶
ValidateSHA256 validates that a given value is a valid SHA256 hash. It takes an interface{} value and returns the validated value as a string, the SHA3256 hash of the value as a string, and an error if the value is not a valid SHA256 hash.
func ValidateSHA3224 ¶
ValidateSHA3224 validates if a given string is a valid SHA3-224 hash and returns the hash in lowercase and its SHA3-256 hash.
func ValidateSHA3256 ¶
ValidateSHA3256 validates if the given value is a valid SHA3-256 hash.
func ValidateSHA3384 ¶
ValidateSHA3256 validates if a given string is a valid SHA3-256 hash and returns the hash in lowercase and its SHA3-256 hash.
func ValidateSHA3512 ¶
ValidateSHA3512 validates if a given string is a valid SHA3-512 hash and returns the hash in lowercase and its SHA3-256 hash.
func ValidateSHA384 ¶
ValidateSHA384 validates a string value as a SHA384 hash and returns the hash value, its SHA3256 hash, and an error if any.
func ValidateSHA512 ¶
ValidateSHA512 validates if a given value is a valid SHA512 hash. It receives a value of any type and returns the validated hash as a string, its SHA3256 hash as a string and an error if the value is not a valid SHA512 hash.
func ValidateSHA512224 ¶
ValidateSHA512224 validates if a given value is a valid SHA512/224 hash. It receives a value of any type and returns the validated hash as a string, the hash generated using SHA3-256 and an error if the value is not a string or if it doesn't match the expected format.
func ValidateSHA512256 ¶
ValidateSHA512256 validates that a given value is a valid SHA512-256 hash. It takes an interface{} value and returns the validated hash as a string, the hash generated by the GenerateSHA3256 function, and an error if any.
func ValidateString ¶
ValidateString validates a string value and returns the original value, its SHA3-256 hash and an error. If the insensitive flag is set to true, the value is converted to lowercase before hashing.
func ValidateURL ¶
ValidateURL validates a given URL string and returns the URL in lowercase and its SHA3-256 hash. If the value is not a string, it returns an error.
func ValidateUUID ¶
ValidateUUID validates if a given value is a valid UUID string and returns the UUID, its SHA3-256 hash and an error if any.
func ValidateValue ¶
Types ¶
type Definition ¶
type Definition struct { Type string `json:"type" example:"object"` Description string `json:"description" example:"Important description about the type"` DataType string `json:"dataType" example:"String"` Example *Entity `json:"example,omitempty"` Attributes []Definition `json:"attributes,omitempty"` Associations []Definition `json:"associations,omitempty"` Tags []string `json:"tags,omitempty"` Correlate []string `json:"correlate,omitempty"` Label string `json:"label,omitempty"` }
type Entity ¶
type Entity struct { Type string `json:"type" example:"object"` Attributes map[string]interface{} `json:"attributes"` Associations []Entity `json:"associations"` Reputation int `json:"reputation" example:"-1"` Correlate []string `json:"correlate"` Tags []string `json:"tags"` VisibleBy []string `json:"visibleBy"` }
Source Files ¶
- adversary.go
- base64.go
- boolean.go
- cidr.go
- city.go
- country.go
- date.go
- definitions.go
- email.go
- entity.go
- examples.go
- float.go
- fqdn.go
- hexadecimal.go
- integer.go
- ip.go
- mac.go
- md5.go
- mime.go
- object.go
- path.go
- phone.go
- port.go
- regex.go
- sha1.go
- sha224.go
- sha256.go
- sha3-224.go
- sha3-256.go
- sha3-384.go
- sha3-512.go
- sha384.go
- sha512-224.go
- sha512-256.go
- sha512.go
- string.go
- url.go
- uuid.go