utils

package
v2.9.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// URLDNS
	URLDNS = "URLDNS"
	// Click1
	Click1 = "Click1"
	// Clojure
	Clojure = "Clojure"
	// CommonsBeanutils1
	CommonsBeanutils1 = "CommonsBeanutils1"
	// CommonsBeanutils2
	CommonsBeanutils2 = "CommonsBeanutils2"
	// CommonsCollections1
	CommonsCollections1 = "CommonsCollections1"
	// CommonsCollections2
	CommonsCollections2 = "CommonsCollections2"
	// CommonsCollections3
	CommonsCollections3 = "CommonsCollections3"
	// CommonsCollections4
	CommonsCollections4 = "CommonsCollections4"
	// CommonsCollections5
	CommonsCollections5 = "CommonsCollections5"
	// CommonsCollections6
	CommonsCollections6 = "CommonsCollections6"
	// CommonsCollections7
	CommonsCollections7 = "CommonsCollections7"
	// CommonsCollections8
	CommonsCollections8 = "CommonsCollections8"
	// CommonsCollections9
	CommonsCollections9 = "CommonsCollections9"
	// CommonsCollections10
	CommonsCollections10 = "CommonsCollections10"
	// CommonsCollections11
	CommonsCollections11 = "CommonsCollections11"
	// CommonsCollections12
	CommonsCollections12 = "CommonsCollections12"
	// CommonsCollectionsK1
	CommonsCollectionsK1 = "CommonsCollectionsK1"
	// CommonsCollectionsK2
	CommonsCollectionsK2 = "CommonsCollectionsK2"
	// Fastjson1
	Fastjson1 = "Fastjson1"
	// Fastjson2
	Fastjson2 = "Fastjson2"
	// Groovy1
	Groovy1 = "Groovy1"
	// Jdk7u21
	Jdk7u21 = "Jdk7u21"
	// Jdk8u20
	Jdk8u20 = "Jdk8u20"
	// ROME
	ROME = "ROME"
	// ROME2
	ROME2 = "ROME2"
	// ROME3
	ROME3 = "ROME3"
	// Spring1
	Spring1 = "Spring1"
	// Spring2
	Spring2 = "Spring2"
)

枚举

View Source
const (
	Base64Type = "base64"
	HexType    = "hex"
)
View Source
const (
	NEW_FILE_PERM = 0666
)

Variables

View Source
var SeverityMap = map[string]Severity{
	"info":     INFO,
	"low":      LOW,
	"medium":   MEDIUM,
	"high":     HIGH,
	"critical": CRITICAL,
	"unkown":   UNKOWN,
}

Functions

func AppendString

func AppendString(filename, content string) error

AppendString appends the contents of the string to filename.

func Base64Encode

func Base64Encode(braw []byte) []byte

base64 encode

func Between

func Between(v1, o1, v, o2, v2 string) bool

Between operator为 < <= > >= ==

func BufferWriteAppend

func BufferWriteAppend(filename string, param string) error

func Compare

func Compare(v1, operator, v2 string) bool

Compare operator为 < <= > >= ==

func CreateRandomString

func CreateRandomString(len int) string

func Exists

func Exists(path string) bool

func GetNowDate

func GetNowDate() string

func GetNowDateTime

func GetNowDateTime() string

func GetNowDateTimeReportName

func GetNowDateTimeReportName() string

func GetNumberText

func GetNumberText(number int) string

func GetRandomIntWithAll

func GetRandomIntWithAll(min, max int) int

包含上下限 [min, max]

func GetRandomIntWithMin

func GetRandomIntWithMin(min, max int) int

不包含上限 [min, max)

func GetRandomTips

func GetRandomTips() string

func GetYsoserial added in v2.9.8

func GetYsoserial(payload, command, encodeType string) string

func HexDecode

func HexDecode(s string) []byte

16进制解码

func HexEncode

func HexEncode(s string) []byte

字符串转为16进制

func IsBlank

func IsBlank(value string) bool

func IsDir

func IsDir(path string) bool

func IsNotBlank

func IsNotBlank(value string) bool

func IsSeverityMatchingCvssScore

func IsSeverityMatchingCvssScore(severity string, score float64) string

func IsURL

func IsURL(input string) bool

IsURL tests a string to determine if it is a well-structured url or not.

func Mmh3Hash32

func Mmh3Hash32(raw []byte) int32

Mmh3Hash32 计算 mmh3 hash

func OpenFile

func OpenFile(fileName string) *os.File

func ParseUrl

func ParseUrl(u *url.URL) *proto.UrlType

func Pkcs5padding added in v2.9.8

func Pkcs5padding(ciphertext []byte, blockSize int, after int) []byte

func RandFromChoices

func RandFromChoices(n int, choices string) string

RandFromChoices 从choices里面随机获取

func RandLetterNumbers

func RandLetterNumbers(n int) string

RandLetterNumbers 随机大小写字母和数字

func RandLetters

func RandLetters(n int) string

RandLetters 随机小写字母

func RandLowLetterNumber

func RandLowLetterNumber(n int) string

RandLowLetterNumber 随机小写字母和数字

func RandSleep

func RandSleep(millisencond int)

func RandomStr

func RandomStr(randSource *rand.Rand, letterBytes string, n int) string

func RandomUA

func RandomUA() string

RandomUA will return a random user agent.

func ReadFileLineByLine

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

func ReadFromFile

func ReadFromFile(filename string) ([]byte, error)

func ReadFromPathOrURL

func ReadFromPathOrURL(templatePath string) (data []byte, err error)

ReadFromPathOrURL reads and returns the contents of a file or url.

func ReverseString

func ReverseString(s string) string

func Str2UTF8

func Str2UTF8(str string) string

字符串转 utf 8

func StringSliceContains

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

StringSliceContains checks if a string slice contains a string.

func Tcp

func Tcp(addr string, data []byte) ([]byte, error)

func ToString

func ToString(slice []string) string

func UrlTypeToString

func UrlTypeToString(u *proto.UrlType) string

func WriteFile

func WriteFile(filename string, data []byte) error

Types

type Severity

type Severity int
const (
	Undefined Severity = iota

	INFO

	LOW

	MEDIUM

	HIGH

	CRITICAL

	UNKOWN
)

type StringSlice

type StringSlice []string

StringSlice is a slice of strings

func (StringSlice) GetKey

func (stringSlice StringSlice) GetKey(value string) int

func (StringSlice) Modify

func (stringSlice StringSlice) Modify(value string)

func (*StringSlice) Set

func (stringSlice *StringSlice) Set(value string)

Set appends a value to the string slice.

func (StringSlice) String

func (stringSlice StringSlice) String() string

type Syncfile

type Syncfile struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSyncfile

func NewSyncfile(filename string) (*Syncfile, error)

func (*Syncfile) Write

func (sf *Syncfile) Write(content string)

type Unzip

type Unzip struct {
}

func NewUnzip

func NewUnzip() *Unzip

func (Unzip) Extract

func (uz Unzip) Extract(source, destination string) ([]string, error)

Jump to

Keyboard shortcuts

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