yaklib

package
v1.2.8-sp4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: AGPL-3.0 Imports: 102 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YAKIT_PLUGIN_TYPE_YAK         = "yak"
	YAKIT_PLUGIN_TYPE_NUCLEI      = "nuclei"
	YAKIT_PLUGIN_TYPE_MITM        = "mitm"
	YAKIT_PLUGIN_TYPE_PORTSCAN    = "port-scan"
	YAKIT_PLUGIN_TYPE_CODEC       = "codec"
	YAKIT_PLUGIN_TYPE_PACKET_HACK = "packet-hack"
)
View Source
const YAKIT_TAG_STATS = "YAKIT_TAG_STATS"

Variables

View Source
var (
	RegisterLogHook   = createRegisterOutputFunc(logHooks)
	UnregisterLogHook = createUnregisterOutputFunc(logHooks)

	RegisterLogConsoleHook   = createRegisterOutputFunc(logConsoleHooks)
	UnregisterLogConsoleHook = createUnregisterOutputFunc(logConsoleHooks)

	RegisterFailedHooks   = createRegisterOutputFunc(failedHooks)
	UnregisterFailedHooks = createUnregisterOutputFunc(failedHooks)

	RegisterOutputHooks   = createRegisterOutputFunc(outputHooks)
	UnregisterOutputHooks = createUnregisterOutputFunc(outputHooks)

	RegisterFinishHooks   = createRegisterOutputFunc(finishHooks)
	UnregisterFinishHooks = createUnregisterOutputFunc(finishHooks)

	RegisterAlertHooks   = createRegisterOutputFunc(alertHooks)
	UnregisterAlertHooks = createUnregisterOutputFunc(alertHooks)
)
View Source
var (
	PoCOptWithSource       = _pocOptWIthSource
	PoCOptWithRuntimeId    = _pocOptWithRuntimeId
	PoCOptWithFromPlugin   = _pocOptWithFromPlugin
	PoCOptWithSaveHTTPFlow = _pocOptWithSave
	PoCOptWithProxy        = _pocOptWithProxy
)

for export

View Source
var (
	// RE_HOSTNAME = regexp.MustCompile(`\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\.?|\b)`)
	RE_IPV4      = regexp.MustCompile(`(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`)
	RE_IPV6      = regexp.MustCompile(`((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?`)
	RE_MAC       = regexp.MustCompile(`((?:(?:[A-Fa-f0-9]{4}\.){2}[A-Fa-f0-9]{4})|(?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})|(?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}))`)
	RE_HOSTPORT  = regexp.MustCompile(`(((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?)):(\b(?:[1-9][0-9]*)\b)`)
	RE_URL       = regexp.MustCompile(`[A-Za-z]+(\+[A-Za-z+]+)?://\S+`)
	RE_PATH      = regexp.MustCompile(`(?:/[A-Za-z0-9$.+!*'(){},~:;=@#%_\-]*)+`)
	RE_PATHPARAM = regexp.MustCompile(`(?:/[A-Za-z0-9$.+!*'(){},~:;=@#%_\-]*)+(?:\?[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]<>]*)?`)
	RE_EMAIL     = regexp.MustCompile(`[a-zA-Z][a-zA-Z0-9_.+-=:]+@\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\.?|\b)`)
	RE_TTY       = regexp.MustCompile(`(?:/dev/(pts|tty([pq])?)(\w+)?/?(?:[0-9]+))`)
)

ARCH 当前操作系统的运行架构:它的值可能是386、amd64、arm、s390x等

View Source
var (
	Args []string
)
View Source
var BotExports = map[string]interface{}{
	"New":               bot.New,
	"FromEnv":           bot.FromEnv,
	"webhook":           bot.WithWebhook,
	"webhookWithSecret": bot.WithWebhookWithSecret,
	"workwx":            bot.WithWebhook,
	"ding":              bot.WithWebhookWithSecret,
}
View Source
var BufioExport = map[string]interface{}{
	"NewBuffer":     _newBuffer,
	"NewReader":     _newReader,
	"NewReaderSize": _newReaderSize,
	"NewWriter":     _newWriter,
	"NewWriterSize": _newWriterSize,
	"NewReadWriter": _newReadWriter,
	"NewScanner":    _newScanner,
}
View Source
var CNCountry = struct {
	GeoNameID         uint              `maxminddb:"geoname_id"`
	IsInEuropeanUnion bool              `maxminddb:"is_in_european_union"`
	IsoCode           string            `maxminddb:"iso_code"`
	Names             map[string]string `maxminddb:"names"`
}(struct {
	GeoNameID         uint
	IsInEuropeanUnion bool
	IsoCode           string
	Names             map[string]string
}{GeoNameID: 1814991, IsInEuropeanUnion: false, IsoCode: "CN", Names: map[string]string{

	"ru":    "Китай",
	"zh-CN": "中国",
	"pt-BR": "China",
	"en":    "China",
	"es":    "China",
	"de":    "China",
	"fr":    "China",
	"ja":    "中国",
}})
(map[string]interface {}) (len=4) {
 (string) (len=9) "GeoNameID": (float64) 1.814991e+06,
 (string) (len=17) "IsInEuropeanUnion": (bool) false,
 (string) (len=7) "IsoCode": (string) (len=2) "CN",
 (string) (len=5) "Names": (map[string]interface {}) (len=8) {
  (string) (len=5) "pt-BR": (string) (len=5) "China",
  (string) (len=2) "ru": (string) (len=10) "Китай",
  (string) (len=5) "zh-CN": (string) (len=6) "中国",
  (string) (len=2) "de": (string) (len=5) "China",
  (string) (len=2) "en": (string) (len=5) "China",
  (string) (len=2) "es": (string) (len=5) "China",
  (string) (len=2) "fr": (string) (len=5) "Chine",
  (string) (len=2) "ja": (string) (len=6) "中国"
 }
}

var CNCountry =

View Source
var CSRFExports = map[string]interface{}{
	"Generate":              GenerateCSRFPoc,
	"multipartDefaultValue": CsrfOptWithMultipartDefaultValue,
	"https":                 CsrfOptWithHTTPS,
}
View Source
var CliExports = map[string]interface{}{
	"Args":        _getArgs,
	"Bool":        _cliBool,
	"Have":        _cliBool,
	"String":      _cliString,
	"Int":         _cliInt,
	"Integer":     _cliInt,
	"Float":       _cliFloat,
	"Double":      _cliFloat,
	"YakitPlugin": _cliYakitPluginFiles,
	"StringSlice": _cliStringSlice,

	"Urls": _cliUrls,
	"Url":  _cliUrls,

	"Ports": _cliPort,
	"Port":  _cliPort,

	"Hosts":   _cliHosts,
	"Host":    _cliHosts,
	"Network": _cliHosts,
	"Net":     _cliHosts,

	"File":          _cliFile,
	"FileOrContent": _cliFileOrContent,
	"LineDict":      _cliLineDict,

	"setHelp":     _cliSetHelpInfo,
	"setDefault":  _cliSetDefaultValue,
	"setRequired": _cliSetRequired,

	"SetCliName": _cliSetName,
	"SetDoc":     _cliSetDocument,

	"help": _help,
	"check": func() {
		if helpParam.foundArgsIndex() != -1 {
			_help()
			os.Exit(1)
		} else if cliParamInvalid.IsSet() {
			errorMsg = strings.TrimSpace(errorMsg)
			if len(errorMsg) > 0 {
				fmt.Printf("Error:\n  %s\n\n", errorMsg)
			}
			_help()

		}
	},
}
View Source
var CodecExports = map[string]interface{}{}/* 122 elements not displayed */
View Source
var ContextExports = map[string]interface{}{
	"Seconds":            _seconds,
	"New":                _newContext,
	"Background":         _background,
	"WithCancel":         _withCancel,
	"WithTimeout":        _withTimeout,
	"WithTimeoutSeconds": _withTimeoutSeconds,
	"WithDeadline":       _withDeadline,
	"WithValue":          _withValue,
}
View Source
var CrawlerExports = map[string]interface{}{}
View Source
var DNSLogExports = map[string]interface{}{
	"NewCustomDNSLog":   NewCustomDNSLog,
	"QueryCustomScript": queryCustomScript,
	"LookupFirst":       netx.LookupFirst,
	"random":            randomDNSLogPlatforms,
	"mode":              setMode,
	"local":             setLocal,
	"script":            setScript,
}
View Source
var DatabaseExports = map[string]interface{}{

	"DownloadGeoIP": DownloadMMDB,
	"QueryIPCity":   QueryIP,
	"QueryIPForIPS": QueryIPForISP,

	"SaveHTTPFlowFromRaw":            saveHTTPFlowFromRaw,
	"SaveHTTPFlowFromRawWithType":    saveHTTPFlowFromRawWithType,
	"SaveHTTPFlowFromNative":         saveCrawler,
	"SaveHTTPFlowFromNativeWithType": saveHTTPFlowWithType,
	"SavePortFromResult":             savePortFromObj,
	"SaveDomain":                     saveDomain,
	"SavePayload":                    savePayloads,
	"SavePayloadByFile":              savePayloadByFile,

	"YAKIT_PLUGIN_TYPE_NUCLEI":      YAKIT_PLUGIN_TYPE_NUCLEI,
	"YAKIT_PLUGIN_TYPE_YAK":         YAKIT_PLUGIN_TYPE_YAK,
	"YAKIT_PLUGIN_TYPE_MITM":        YAKIT_PLUGIN_TYPE_MITM,
	"YAKIT_PLUGIN_TYPE_PORTSCAN":    YAKIT_PLUGIN_TYPE_PORTSCAN,
	"YAKIT_PLUGIN_TYPE_CODEC":       YAKIT_PLUGIN_TYPE_CODEC,
	"YAKIT_PLUGIN_TYPE_PACKET_HACK": YAKIT_PLUGIN_TYPE_PACKET_HACK,
	"SaveYakitPlugin":               saveYakitPlugin,

	"QueryUrlsByKeyword":      queryUrlsByKeyword,
	"QueryUrlsAll":            queryAllUrls,
	"QueryHTTPFlowsByKeyword": queryHTTPFlowByKeyword,
	"QueryHTTPFlowsAll": func() chan *yakit.HTTPFlow {
		return queryHTTPFlowByKeyword("")
	},
	"QueryPortsByUpdatedAt":       queryPortsByUpdatedAt,
	"QueryPortsByTaskName":        queryPortsByTaskName,
	"QueryHTTPFlowsByID":          queryHTTPFlowByID,
	"QueryHostPortByNetwork":      queryHostPortByNetwork,
	"QueryHostPortByKeyword":      queryHostAssetByNetwork,
	"QueryHostsByDomain":          queryHostAssetByDomainKeyword,
	"QueryDomainsByNetwork":       queryDomainAssetByNetwork,
	"QueryDomainsByDomainKeyword": queryDomainAssetByDomainKeyword,
	"QueryDomainsByTitle":         queryDomainAssetByHTMLTitle,
	"QueryPayloadGroups":          getPayloadGroups,
	"DeletePayloadByGroup":        deletePayload,

	"GetProjectKey": func(k any) string {
		return yakit.GetProjectKey(consts.GetGormProjectDatabase(), k)
	},
	"SetProjectKey": func(k, v any) error {
		return yakit.SetProjectKey(consts.GetGormProjectDatabase(), k, v)
	},
	"SetKey": func(k, v interface{}) error {
		return yakit.SetKey(consts.GetGormProfileDatabase(), k, v)
	},
	"GetKey": func(k interface{}) string {
		return yakit.GetKey(consts.GetGormProfileDatabase(), k)
	},
	"DelKey": func(k interface{}) {
		yakit.DelKey(consts.GetGormProfileDatabase(), k)
	},

	"GetYakitPluginByName": queryYakitPluginByName,

	"SaveYakitMenuItemByBatchExecuteConfig": saveYakitMenuItemByBatchExecuteConfig,
	"DeleteYakitMenuItemAll":                deleteYakitMenuItemAll,

	"YieldYakScriptAll":     _yieldYakScript,
	"DeleteYakScriptByName": _deleteYakScriptByName,

	"CreateTemporaryYakScript": yakit.CreateTemporaryYakScript,

	"NewAliveHost": YakitNewAliveHost,
	"QueryAliveHost": func(runtimeId string) chan *yakit.AliveHost {
		return yakit.YieldAliveHostRuntimeId(consts.GetGormProjectDatabase(), context.Background(), runtimeId)
	},
}
View Source
var DictUtilExports = map[string]interface{}{
	"Mix": _dictMix,
}
View Source
var Discard = ioutil.Discard

Discard 是一个 writer,它将所有写入的数据都丢弃掉

View Source
var DnsExports = map[string]interface{}{
	"QueryIP":    _dnsQueryIP,
	"QueryIPAll": _dnsQueryIPAll,
	"QueryNS":    _dnsQueryNS,
	"QueryTXT":   _dnsQueryTxt,
	"QuertAxfr":  _dnsQueryAxfr,

	"timeout":    _dnsConfigOpt_WithTimeout,
	"dnsServers": _dnsConfigOpt_WithDNSServers,
}
View Source
var EOF = io.EOF

EOF 是一个错误,表示读取到了 EOF

View Source
var EmptyBytesSlice = make([][]byte, 0)
View Source
var EnvExports = map[string]interface{}{
	"Get": _getEnv,
	"Set": _setEnv,
}
View Source
var ExecExports = map[string]interface{}{
	"CommandContext": _execStringToCommand,
	"Command": func(i string) (*exec.Cmd, error) {
		return _execStringToCommand(context.Background(), i)
	},

	"CheckCrash": _checkExecCrash,

	"SystemBatch": _execSystemBatch,

	"SystemContext": _execSystem,

	"System": func(i string) ([]byte, error) {
		return _execSystem(context.Background(), i)
	},

	"WatchStdout": _execWatchStdout,
	"WatchOutput": _execWatchStdout,
	"WatchStderr": _execWatchStderr,

	"timeout":    _execTimeout,
	"callback":   _execSetCallback,
	"concurrent": _execConcurrent,
}

系统命令执行导出接口

View Source
var FileExport = map[string]interface{}{
	"ReadLines":  _fileReadLines,
	"GetDirPath": _fileGetDirPath,
	"GetExt":     _ext,
	"GetBase":    _getBase,
	"Clean":      _clean,
	"Split":      _filePathSplit,
	"IsExisted":  _fileIsExisted,
	"IsFile":     _fileIsFile,
	"IsDir":      _fileIsDir,
	"IsAbs":      _fileIsAbs,
	"IsLink":     _fileIsLink,
	"Join":       _fileJoin,

	"O_RDWR":   os.O_RDWR,
	"O_CREATE": os.O_CREATE,
	"O_APPEND": os.O_APPEND,
	"O_EXCL":   os.O_EXCL,
	"O_RDONLY": os.O_RDONLY,
	"O_SYNC":   os.O_SYNC,
	"O_TRUNC":  os.O_TRUNC,
	"O_WRONLY": os.O_WRONLY,

	"ReadAll":      _fileReadAll,
	"ReadFile":     _fileReadFile,
	"TempFile":     _tempFile,
	"TempFileName": _tempFileName,
	"Mkdir":        _mkdir,
	"MkdirAll":     _mkdirAll,
	"Rename":       _rename,
	"Remove":       _remove,
	"Create":       _create,

	"Open":     _fileOpen,
	"OpenFile": _fileOpenWithPerm,
	"Stat":     _fileStat,
	"Lstat":    _fileLstat,
	"Save":     _saveFile,
	"SaveJson": _saveJson,

	"Cat":   _cat,
	"TailF": _tailf,
	"Mv":    _mv,
	"Rm":    _rm,
	"Cp":    _fileCopy,
	"Dir":   _ls,
	"Ls":    _dir,

	"Abs":                     _fileAbs,
	"ReadFileInfoInDirectory": _readFileInfoInDirectory,
	"ReadDirInfoInDirectory":  _readDirInfoInDirectory,
	"NewMultiFileLineReader":  _newMultiFileLineReader,
	"Walk":                    _walk,
}
View Source
var FunkExports = map[string]interface{}{
	"WaitConnect": WaitConnect,

	"Map": func(i interface{}, fc funkGeneralFuncType) interface{} {
		return funk.Map(i, func(i interface{}) interface{} {
			return fc(i)
		})
	},
	"ToMap": funk.ToMap,
	"Reduce": func(i interface{}, fc funkGeneralReduceFuncType, acc interface{}) interface{} {
		return funk.Reduce(i, func(pre interface{}, after interface{}) interface{} {
			return fc(pre, after)
		}, acc)
	},
	"Filter": func(i interface{}, fc func(interface{}) bool) interface{} {
		return funk.Filter(i, func(pre interface{}) bool {
			return fc(pre)
		})
	},
	"Find": func(i interface{}, fc func(interface{}) bool) interface{} {
		return funk.Find(i, func(pre interface{}) bool {
			return fc(pre)
		})
	},
	"Foreach": func(i interface{}, fc func(interface{})) {
		funk.ForEach(i, func(pre interface{}) {
			fc(pre)
		})
	},
	"ForeachRight": func(i interface{}, fc func(interface{})) {
		funk.ForEachRight(i, func(pre interface{}) {
			fc(pre)
		})
	},
	"Contains":     funk.Contains,
	"IndexOf":      funk.IndexOf,
	"Difference":   funk.Difference,
	"Subtract":     funk.Subtract,
	"Intersect":    intersect,
	"IsSubset":     funk.Subset,
	"Equal":        funk.IsEqual,
	"Chunk":        funk.Chunk,
	"RemoveRepeat": funk.Uniq,
	"Tail":         funk.Tail,
	"Head":         funk.Head,
	"Drop":         funk.Drop,
	"Shift": func(i interface{}) interface{} {
		return funk.Drop(i, 1)
	},
	"Values":    funk.Values,
	"Keys":      funk.Keys,
	"Zip":       funk.Zip,
	"ToFloat64": funk.ToFloat64,
	"Shuffle":   funk.Shuffle,
	"Reverse":   funk.Reverse,
	"Sum":       funk.Sum,
	"All":       funk.All,
	"Max":       max,
	"Min":       min,
	"Some":      funk.Some,
	"Every":     funk.Every,
	"Any":       funk.Any,
	"Sort":      sort.SliceStable,
	"Range": func(i int) []interface{} {
		return make([]interface{}, i)
	},
	"If": func(i bool, a, b interface{}) interface{} {
		if i {
			return a
		} else {
			return b
		}
	},
	"ConvertToMap": func(i interface{}) map[string][]string {
		return utils.InterfaceToMap(i)
	},
}
View Source
var FuzzExports = map[string]interface{}{
	"Strings":            _fuzz,
	"StringsWithParam":   _fuzzFuncEx,
	"StringsFunc":        _fuzzFunc,
	"HTTPRequest":        mutate.NewFuzzHTTPRequest,
	"MustHTTPRequest":    mutate.NewMustFuzzHTTPRequest,
	"https":              mutate.OptHTTPS,
	"proxy":              mutate.OptProxy,
	"UrlsToHTTPRequests": mutate.UrlsToHTTPRequests,
	"UrlToHTTPRequest":   _urlToFuzzRequest,

	"ProtobufHex":   _protobufRecordsFromHex,
	"ProtobufBytes": _protobufRecordsFromBytes,
	"ProtobufJSON":  _protobufRecordsFromJSON,
	"ProtobufYAML":  _protobufRecordsFromYAML,

	"WithDelay":           mutate.WithPoolOPt_DelaySeconds,
	"WithNamingContext":   mutate.WithPoolOpt_NamingContext,
	"WithConcurrentLimit": mutate.WithPoolOpt_Concurrent,
	"WithTimeOut":         mutate.WithPoolOpt_Timeout,
}
View Source
var GeoJsonExports = map[string]interface{}{
	"NewFeatureCollection": geojson.NewFeatureCollection,
	"FeaturesToCollection": func(fs ...*geojson.Feature) *geojson.FeatureCollection {
		col := geojson.NewFeatureCollection()
		for _, i := range fs {
			col.AddFeature(i)
		}
		return col
	},
	"WithValue": func(f *geojson.Feature, value float64) *geojson.Feature {
		f.SetProperty("value", value)
		return f
	},
	"WithName": func(f *geojson.Feature, value string) *geojson.Feature {
		f.SetProperty("name", value)
		return f
	},
	"WithNameValue": func(f *geojson.Feature, name string, value float64) *geojson.Feature {
		f.SetProperty("name", name)
		f.SetProperty("value", value)
		return f
	},
	"WithProperty": func(f *geojson.Feature, key string, value float64) *geojson.Feature {
		f.SetProperty(key, value)
		return f
	},
}
View Source
var GlobalExport = map[string]interface{}{
	"_createOnLogger":        createLogger,
	"_createOnLoggerConsole": createConsoleLogger,
	"_createOnFailed":        createFailed,
	"_createOnOutput":        createOnOutput,
	"_createOnFinished":      createOnFinished,
	"_createOnAlert":         createOnAlert,

	"loglevel":   setLogLevel,
	"logquiet":   _logDiscard,
	"logdiscard": _logDiscard,
	"logrecover": _logRecover,

	"yakit_output": _yakit_output,
	"yakit_save":   _yakit_save,
	"yakit_status": _yakit_status,

	"fail": _failed,
	"die":  _diewith,
	"uuid": _uuid,

	"timestamp":           _timestamp,
	"nanotimestamp":       _nanotimestamp,
	"datetime":            _datetime,
	"date":                _date,
	"now":                 _now,
	"parseTime":           _parseTime,
	"timestampToDatetime": _timestampToDatetime,
	"timestampToTime":     _timestampToTime,
	"datetimeToTimestamp": _datetimeToTimestamp,
	"tick1s":              tick1s,

	"input": _input,
	"dump":  _dump,
	"sdump": _sdump,

	"randn":   _randn,
	"randstr": _randstr,

	"assert":      _assert,
	"assertTrue":  _assert,
	"isEmpty":     _isEmpty,
	"assertEmpty": _assertEmpty,
	"assertf":     _assertf,

	"parseInt":     parseInt,
	"parseStr":     parseString,
	"parseString":  parseString,
	"parseBool":    parseBool,
	"parseBoolean": parseBool,
	"parseFloat":   parseFloat,
	"atoi":         atoi,

	"sleep": sleep,
	"wait":  _wait,

	"desc":    _desc,
	"descStr": _descToString,
	"chr":     chr,
	"ord":     ord,
	"type":    typeof,
	"typeof":  typeof,
}
View Source
var GrokExports = map[string]interface{}{
	"ExtractIPv4":     RegexpMatchIPv4,
	"ExtractIPv6":     RegexpMatchIPv6,
	"ExtractIP":       RegexpMatchIP,
	"ExtractEmail":    RegexpMatchEmail,
	"ExtractPath":     RegexpMatchPathParam,
	"ExtractTTY":      RegexpMatchTTY,
	"ExtractURL":      RegexpMatchURL,
	"ExtractHostPort": RegexpMatchHostPort,
	"ExtractMac":      RegexpMatchMac,
}
View Source
var GzipExports = map[string]interface{}{
	"Compress":   utils.GzipCompress,
	"Decompress": utils.GzipDeCompress,
	"IsGzip":     utils.IsGzip,
}
View Source
var HTTPServer_Serve = _httpServe
View Source
var HTTPServer_ServeOpt_Callback = _httpServerOptCallback
View Source
var HTTPServer_ServeOpt_Context = _httpServerOptContext
View Source
var HttpExports = yakhttp.HttpExports
View Source
var HttpPoolExports = mutate.HttpPoolExports
View Source
var HttpServeExports = map[string]interface{}{
	"Serve":                _httpServe,
	"tlsCertAndKey":        _httpServerOptCaAndKey,
	"context":              _httpServerOptContext,
	"handler":              _httpServerOptCallback,
	"LocalFileSystemServe": _localFileSystemServe,
}
View Source
var IoExports = map[string]interface{}{
	"ReadAll":     _readAll,
	"ReadFile":    _readFile,
	"ReadEvery1s": _readEvery1s,

	"LimitReader": _limitReader,
	"TeeReader":   _teeReader,
	"MultiReader": _multiReader,
	"NopCloser":   _nopCloser,
	"Pipe":        _ioPipe,
	"Copy":        _copy,
	"CopyN":       _copyN,

	"WriteString": _writeString,
	"ReadStable":  _readStable,

	"Discard": Discard,
	"EOF":     EOF,
}
View Source
var IsPrivileged = privileged.GetIsPrivileged()

IsPrivileged 当前是否是特权模式

View Source
var (
	JSOttoExports = map[string]interface{}{
		"PoweredBy":            "github.com/robertkrimen/otto",
		"New":                  _jsNewEngine,
		"Run":                  otto.Run,
		"CallFunctionFromCode": _jsCallFuncFromCode,
		"NullValue":            otto.NullValue,
		"UndefinedValue":       otto.UndefinedValue,
		"FalseValue":           otto.FalseValue,
		"ToValue":              otto.ToValue,
		"NaNValue":             otto.NaNValue,
		"TrueValue":            otto.TrueValue,
		"ASTWalk":              javascript.BasicJavaScriptASTWalker,
		"Parse":                _Pares,
		"GetSTType":            javascript.GetStatementType,
	}
)
View Source
var JsonExports = map[string]interface{}{
	"New":     _yakJson,
	"Marshal": json.Marshal,
	"dumps":   _jsonDumps,
	"loads":   _jsonLoad,

	"Find":          jsonpath.Find,
	"FindPath":      jsonpath.FindFirst,
	"ReplaceAll":    jsonpath.ReplaceAll,
	"ExtractJSON":   jsonextractor.ExtractStandardJSON,
	"ExtractJSONEx": jsonextractor.ExtractJSONWithRaw,
}
View Source
var LdapExports = map[string]interface{}{
	"Login": _login,

	"port":     optLdap_Port,
	"username": optLdap_Username,
	"password": optLdap_Password,
}
View Source
var LogExports = map[string]interface{}{
	"info":     log.Infof,
	"setLevel": setLogLevel,
	"debug":    log.Debugf,
	"warn":     log.Warningf,
	"error":    log.Errorf,

	"Info":     log.Infof,
	"SetLevel": setLogLevel,
	"Debug":    log.Debugf,
	"Warn":     log.Warningf,
	"Error":    log.Errorf,
}
View Source
var MathExport = map[string]interface{}{
	"Round":       Round,
	"Sqrt":        Sqrt,
	"Pow":         Pow,
	"Pow10":       Pow10,
	"Floor":       Floor,
	"Ceil":        Ceil,
	"RoundToEven": RoundToEven,
	"Abs":         Abs,
	"NaN":         NaN,
	"IsNaN":       IsNaN,
	"Pi":          math.Pi,
	"Ln10":        math.Ln10,
	"Ln2":         math.Ln2,
	"E":           math.E,
	"Sqrt2":       math.Sqrt2,
	"SqrtPi":      math.SqrtPi,
	"SqrtE":       math.SqrtE,
}
View Source
var (
	MitmExports = map[string]interface{}{
		"Start":  startMitm,
		"Bridge": startBridge,

		"maxContentLength":     mitmMaxContentLength,
		"isTransparent":        mitmConfigIsTransparent,
		"context":              mitmConfigContext,
		"host":                 mitmConfigHost,
		"callback":             mitmConfigCallback,
		"hijackHTTPRequest":    mitmConfigHijackHTTPRequest,
		"hijackHTTPResponse":   mitmConfigHijackHTTPResponse,
		"hijackHTTPResponseEx": mitmConfigHijackHTTPResponseEx,
		"wscallback":           mitmConfigWSCallback,
		"wsforcetext":          mitmConfigWSForceTextFrame,
		"rootCA":               mitmConfigCertAndKey,
		"useDefaultCA":         mitmConfigUseDefault,
	}
)
View Source
var MmdbExports = map[string]interface{}{
	"Open": maxminddb.Open,
	"QueryIPCity": func(r *maxminddb.Reader, ip string) (*geo.City, error) {
		var c geo.City
		err := r.Lookup(net.ParseIP(utils.FixForParseIP(ip)), &c)
		if err != nil {
			return nil, utils.Errorf("loop up failed: %s", err)
		}

		if c.Country.IsoCode == "HK" || c.Country.IsoCode == "MO" {
			c.City.Names = c.Country.Names
			c.City.GeoNameID = c.Country.GeoNameID
			c.Country = CNCountry
		} else if c.Country.IsoCode == "TW" {
			if c.City.GeoNameID > 0 {
				var maps = make(map[string]string)
				for k, v := range c.City.Names {
					if c.Country.Names[k] != "" {
						maps[k] = fmt.Sprintf("%v/%v", c.Country.Names[k], v)
					}
				}
			} else {
				c.City.Names = c.Country.Names
				c.City.GeoNameID = c.Country.GeoNameID
			}

			c.Country = CNCountry
		}
		return &c, nil
	},
}

OS 当前操作系统名

View Source
var PingExports = map[string]interface{}{
	"Scan": _pingScan,
	"Ping": _ping,

	"excludeHosts": _pingConfigOpt_excludeHosts,
	"onResult":     _pingConfigOpt_onResult,
	"dnsTimeout":   _pingConfigOpt_withDNSTimeout,
	"timeout":      _pingConfigOpt_withTimeout,
	"dnsServers":   _pingConfigOpt_dnsServers,
	"scanCClass":   _pingConfigOpt_scanCClass,
	"skip":         _pingConfigOpt_skipped,
	"concurrent":   _pingConfigOpt_concurrent,
	"tcpPingPorts": _pingConfigOpt_tcpPingPorts,
	"proxy":        _pingConfigOpt_proxy,
}
View Source
var PoCExports = map[string]interface{}{}/* 110 elements not displayed */
View Source
var RdpExports = map[string]interface{}{
	"Login":   bruteutils.RDPLogin,
	"Version": extrafp.RDPVersion,
}
View Source
var RedisExports = map[string]interface{}{
	"New":            newRedis,
	"host":           redisOpt_Host,
	"port":           redisOpt_Port,
	"addr":           redisOpt_Addr,
	"username":       redisOpt_Username,
	"password":       redisOpt_Password,
	"timeoutSeconds": redisOpt_TimeoutSeconds,
	"retry":          redisOpt_Retry,
}
View Source
var RegenExports = map[string]interface{}{
	"Generate":               regen.Generate,
	"GenerateOne":            regen.GenerateOne,
	"GenerateVisibleOne":     regen.GenerateVisibleOne,
	"MustGenerate":           regen.MustGenerate,
	"MustGenerateOne":        regen.MustGenerateOne,
	"MustGenerateVisibleOne": regen.MustGenerateVisibleOne,
}
View Source
var Regexp2Export = map[string]interface{}{
	"QuoteMeta": regexp2.Escape,
	"Compile":   re2Compile,
	"CompileWithOption": func(rule string, opt int) (*regexp2.Regexp, error) {
		return regexp2.Compile(rule, regexp2.RegexOptions(opt))
	},
	"OPT_None":                    regexp2.None,
	"OPT_IgnoreCase":              regexp2.IgnoreCase,
	"OPT_Multiline":               regexp2.Multiline,
	"OPT_ExplicitCapture":         regexp2.ExplicitCapture,
	"OPT_Compiled":                regexp2.Compiled,
	"OPT_Singleline":              regexp2.Singleline,
	"OPT_IgnorePatternWhitespace": regexp2.IgnorePatternWhitespace,
	"OPT_RightToLeft":             regexp2.RightToLeft,
	"OPT_Debug":                   regexp2.Debug,
	"OPT_ECMAScript":              regexp2.ECMAScript,
	"OPT_RE2":                     regexp2.RE2,

	"Find":               re2Find,
	"FindAll":            re2FindAll,
	"FindSubmatch":       re2FindSubmatch,
	"FindSubmatchAll":    re2FindSubmatchAll,
	"FindGroup":          re2ExtractGroups,
	"FindGroupAll":       re2ExtractGroupsAll,
	"ReplaceAll":         re2ReplaceAll,
	"ReplaceAllWithFunc": re2ReplaceAllFunc,
}
View Source
var RegexpExport = map[string]interface{}{
	"QuoteMeta":        _quoteMeta,
	"Compile":          _compile,
	"CompilePOSIX":     _compilePOSIX,
	"MustCompile":      _mustCompile,
	"MustCompilePOSIX": _mustCompilePOSIX,

	"Match":                _reMatch,
	"Grok":                 Grok,
	"ExtractIPv4":          RegexpMatchIPv4,
	"ExtractIPv6":          RegexpMatchIPv6,
	"ExtractIP":            RegexpMatchIP,
	"ExtractEmail":         RegexpMatchEmail,
	"ExtractPath":          RegexpMatchPathParam,
	"ExtractTTY":           RegexpMatchTTY,
	"ExtractURL":           RegexpMatchURL,
	"ExtractHostPort":      RegexpMatchHostPort,
	"ExtractMac":           RegexpMatchMac,
	"Find":                 _find_extractByRegexp,
	"FindIndex":            _findIndex_extractByRegexp,
	"FindAll":              _findAll_extractByRegexp,
	"FindAllIndex":         _findAllIndex_extractByRegexp,
	"FindSubmatch":         _findSubmatch_extractByRegexp,
	"FindSubmatchIndex":    _findSubmatchIndex_extractByRegexp,
	"FindSubmatchAll":      _findSubmatchAll_extractByRegexp,
	"FindSubmatchAllIndex": _findSubmatchAllIndex_extractByRegexp,
	"FindGroup":            reExtractGroups,
	"FindGroupAll":         reExtractGroupsAll,
	"ReplaceAll":           _replaceAll_extractByRegexp,
	"ReplaceAllWithFunc":   _replaceAllFunc_extractByRegexp,
}
View Source
var (
	RiskExports = map[string]interface{}{
		"CreateRisk":             yakit.CreateRisk,
		"Save":                   yakit.SaveRisk,
		"NewRisk":                YakitNewRiskBuilder(GetYakitClientInstance()),
		"RegisterBeforeRiskSave": yakit.RegisterBeforeRiskSave,
		"YieldRiskByTarget": func(target string) chan *yakit.Risk {
			return yakit.YieldRisksByTarget(consts.GetGormProjectDatabase(), context.Background(), target)
		},
		"YieldRiskByRuntimeId": func(runtimeId string) chan *yakit.Risk {
			return yakit.YieldRisksByRuntimeId(consts.GetGormProjectDatabase(), context.Background(), runtimeId)
		},
		"YieldRiskByCreateAt": func(timestamp int64) chan *yakit.Risk {
			return yakit.YieldRisksByCreateAt(consts.GetGormProjectDatabase(), context.Background(), timestamp)
		},
		"DeleteRiskByTarget": func(addr string) {
			yakit.DeleteRiskByTarget(consts.GetGormProjectDatabase(), addr)
		},
		"DeleteRiskByID": func(id any) {
			var err = yakit.DeleteRiskByID(consts.GetGormProjectDatabase(), int64(codec.Atoi(utils.InterfaceToString(id))))
			if err != nil {
				log.Errorf("delete risk by id error: %v", err)
			}
		},
		"NewUnverifiedRisk":         yakit.NewUnverifiedRisk,
		"NewPublicReverseRMIUrl":    yakit.NewPublicReverseProtoUrl("rmi"),
		"NewPublicReverseHTTPSUrl":  yakit.NewPublicReverseProtoUrl("https"),
		"NewPublicReverseHTTPUrl":   yakit.NewPublicReverseProtoUrl("http"),
		"NewLocalReverseRMIUrl":     yakit.NewLocalReverseProtoUrl("rmi"),
		"NewLocalReverseHTTPSUrl":   yakit.NewLocalReverseProtoUrl("https"),
		"NewLocalReverseHTTPUrl":    yakit.NewLocalReverseProtoUrl("http"),
		"HaveReverseRisk":           yakit.HaveReverseRisk,
		"NewRandomPortTrigger":      yakit.NewRandomPortTrigger,
		"NewDNSLogDomain":           yakit.NewDNSLogDomain,
		"CheckDNSLogByToken":        yakit.CheckDNSLogByToken,
		"CheckRandomTriggerByToken": yakit.CheckRandomTriggerByToken,
		"CheckICMPTriggerByLength":  yakit.CheckICMPTriggerByLength,
		"ExtractTokenFromUrl":       yakit.ExtractTokenFromUrl,
		"payload":                   yakit.WithRiskParam_Payload,
		"title":                     yakit.WithRiskParam_Title,
		"type":                      yakit.WithRiskParam_RiskType,
		"titleVerbose":              yakit.WithRiskParam_TitleVerbose,
		"description":               yakit.WithRiskParam_Description,
		"solution":                  yakit.WithRiskParam_Solution,
		"typeVerbose":               yakit.WithRiskParam_RiskVerbose,
		"parameter":                 yakit.WithRiskParam_Parameter,
		"token":                     yakit.WithRiskParam_Token,
		"details":                   yakit.WithRiskParam_Details,
		"request":                   yakit.WithRiskParam_Request,
		"response":                  yakit.WithRiskParam_Response,
		"runtimeId":                 yakit.WithRiskParam_RuntimeId,
		"potential":                 yakit.WithRiskParam_Potential,
		"cve":                       yakit.WithRiskParam_CVE,
		"severity":                  yakit.WithRiskParam_Severity,
		"level":                     yakit.WithRiskParam_Severity,
		"fromYakScript":             yakit.WithRiskParam_FromScript,
		"ignore":                    yakit.WithRiskParam_Ignore,
	}
)
View Source
var SambaExports = map[string]interface{}{
	"username":    _smbConfig_Username,
	"password":    _smbConfig_Password,
	"domain":      _smbConfig_Domain,
	"workstation": _smbConfig_Workstation,
	"hash":        _smbConfig_Hash,
	"debug":       _smbConfig_Debug,
	"Connect":     smbConn,
}
View Source
var SpaceEngineExports = map[string]interface{}{
	"ShodanQuery":  _shodan,
	"FofaQuery":    _fofa,
	"QuakeQuery":   _quake,
	"HunterQuery":  _hunter,
	"ZoomeyeQuery": _zoomeye,

	"maxPage":   _spaceEngine_MaxPage,
	"maxRecord": _spaceEngine_MaxRecord,
	"pageSize":  _spaceEngine_PageSize,
}
View Source
var Stderr = os.Stderr

Stderr 标准错误

View Source
var Stdin = os.Stdin

Stdin 标准输入

View Source
var Stdout = os.Stdout

Stdout 标准输出

View Source
var StringsExport = map[string]interface{}{}/* 115 elements not displayed */
View Source
var SyncExport = map[string]interface{}{
	"NewWaitGroup":      NewWaitGroup,
	"NewSizedWaitGroup": NewSizedWaitGroup,
	"NewMutex":          NewMutex,
	"NewLock":           NewLock,
	"NewMap":            NewMap,
	"NewOnce":           NewOnce,
	"NewRWMutex":        NewRWMutex,
	"NewPool":           NewPool,
	"NewCond":           NewCond,
}
View Source
var SystemExports = map[string]interface{}{
	"IsTCPPortOpen":             IsTCPPortOpen,
	"IsUDPPortOpen":             IsUDPPortOpen,
	"LookupHost":                lookupHost,
	"LookupIP":                  lookupIP,
	"IsTCPPortAvailable":        IsTCPPortAvailable,
	"IsUDPPortAvailable":        IsUDPPortAvailable,
	"GetRandomAvailableTCPPort": GetRandomAvailableTCPPort,
	"GetRandomAvailableUDPPort": GetRandomAvailableUDPPort,
	"IsRemoteTCPPortOpen":       IsRemoteTCPPortOpen,

	"GetMachineID": GetMachineID,

	"Remove":               Remove,
	"RemoveAll":            RemoveAll,
	"Rename":               Rename,
	"TempDir":              TempDir,
	"Getwd":                Getwd,
	"Getpid":               Getpid,
	"Getppid":              Getppid,
	"Getuid":               Getuid,
	"Geteuid":              Geteuid,
	"Getgid":               Getgid,
	"Getegid":              Getegid,
	"Environ":              Environ,
	"Hostname":             Hostname,
	"Unsetenv":             Unsetenv,
	"LookupEnv":            LookupEnv,
	"Clearenv":             Clearenv,
	"Setenv":               Setenv,
	"Getenv":               Getenv,
	"Exit":                 Exit,
	"Args":                 Args,
	"Stdout":               Stdout,
	"Stdin":                Stdin,
	"Stderr":               Stderr,
	"Executable":           Executable,
	"ExpandEnv":            ExpandEnv,
	"Pipe":                 Pipe,
	"Chdir":                Chdir,
	"Chmod":                Chmod,
	"Chown":                Chown,
	"OS":                   OS,
	"ARCH":                 ARCH,
	"IsPrivileged":         IsPrivileged,
	"GetDefaultDNSServers": GetDefaultDNSServers,
	"WaitConnect":          WaitConnect,
	"GetLocalAddress":      GetLocalAddress,
	"GetLocalIPv4Address":  GetLocalIPv4Address,
	"GetLocalIPv6Address":  GetLocalIPv6Address,
}
View Source
var TcpExports = map[string]interface{}{
	"MockServe":       utils.DebugMockHTTP,
	"MockTCPProtocol": DebugMockTCPProtocol,

	"Connect": _tcpConnect,

	"clientTimeout": _tcpTimeout,
	"clientLocal":   _tcpLocalAddr,
	"clientTls":     _tcpClientTls,
	"clientProxy":   _tcpClientProxy,

	"Serve":          tcpServe,
	"serverCallback": _tcpServeCallback,
	"serverContext":  _tcpServeContext,
	"serverTls":      _tcpServerTls,

	"Forward": _tcpPortForward,
}
View Source
var TimeExports = map[string]interface{}{
	"Now":              _timeNow,
	"now":              _timenow,
	"GetCurrentMonday": _getCurrentMonday,
	"GetCurrentDate":   _getCurrentDate,
	"sleep":            sleep,
	"Sleep":            sleep,
	"Parse":            _timeparse,
	"ParseDuration":    _timeParseDuration,
	"Unix":             _timeUnix,
	"After":            _timeAfter,
	"AfterFunc":        _timeAfterFunc,
	"NewTimer":         _timeNewTimer,
	"NewTicker":        _timeNewTicker,
	"Until":            _timeUntil,
	"Since":            _timeSince,
}
View Source
var TimeZoneExports = map[string]interface{}{
	"Get": _timezoneLoadLocation,
	"Now": _timezoneNow,
}
View Source
var TlsExports = map[string]interface{}{
	"GenerateRSAKeyPair":     tlsutils.RSAGenerateKeyPair,
	"GenerateRSA1024KeyPair": rsaWithBitSize(1024),
	"GenerateRSA2048KeyPair": rsaWithBitSize(2048),
	"GenerateRSA4096KeyPair": rsaWithBitSize(4096),
	"GenerateSM2KeyPair":     tlsutils.SM2GenerateKeyPair,
	"GenerateRootCA": func(commonName string) (ca []byte, key []byte, _ error) {
		return tlsutils.GenerateSelfSignedCertKeyWithCommonName(commonName, "", nil, nil)
	},
	"SignX509ServerCertAndKey": tlsutils.SignServerCrtNKey,
	"SignX509ClientCertAndKey": tlsutils.SignClientCrtNKey,
	"SignServerCertAndKey": func(ca []byte, key []byte) (cert []byte, sKey []byte, _ error) {
		return tlsutils.SignServerCrtNKeyWithParams(ca, key, "Server", time.Now().Add(time.Hour*24*365*99), false)
	},
	"SignClientCertAndKey": func(ca []byte, key []byte) (cert []byte, sKey []byte, _ error) {
		return tlsutils.SignClientCrtNKeyWithParams(ca, key, "Server", time.Now().Add(time.Hour*24*365*99), false)
	},
	"Inspect":             netx.TLSInspect,
	"EncryptWithPkcs1v15": tlsutils.PemPkcs1v15Encrypt,
	"DecryptWithPkcs1v15": tlsutils.PemPkcs1v15Decrypt,
}
View Source
var UDPExport = map[string]interface{}{
	"MockUDPProtocol": DebugMockUDPProtocol,
	"Connect":         connectUdp,
	"clientTimeout":   clientTimeout,
	"clientLocalAddr": clientLocalAddr,

	"Serve": udpServe,
	"serverTimeout": func(f float64) udpServerOpt {
		return func(config *udpServerConfig) {
			config.timeout = utils.FloatSecondDuration(f)
		}
	},
	"serverContext": func(ctx context.Context) udpServerOpt {
		return func(config *udpServerConfig) {
			config.ctx = ctx
		}
	},
	"serverCallback": func(cb func(*udpConnection, []byte)) udpServerOpt {
		return func(config *udpServerConfig) {
			config.callback = cb
		}
	},
}
View Source
var XMLExports = map[string]interface{}{
	"Escape": Escape,
	"dumps":  _xmldumps,
	"loads":  _xmlloads,
}
View Source
var YakitExports = map[string]interface{}{
	"NewClient":       NewYakitClient,
	"NewTable":        NewTable,
	"NewLineGraph":    NewLineGraph,
	"NewBarGraph":     NewBarGraph,
	"NewPieGraph":     NewPieGraph,
	"NewWordCloud":    NewWordCloud,
	"NewHTTPFlowRisk": NewHTTPFlowRisk,

	"InitYakit":               InitYakit,
	"UpdateOnlineYakitStore":  updateOnlineYakitStore,
	"UpdateYakitStore":        updateYakitStore,
	"UpdateYakitStoreLocal":   yakit.LoadYakitFromLocalDir,
	"UpdateYakitStoreFromGit": yakit.LoadYakitThirdpartySourceScripts,

	"GenerateYakitMITMHooksParams": generateYakitMITMHookParams,
	"GetHomeDir":                   consts.GetDefaultYakitBaseDir,
	"GetHomeTempDir":               consts.GetDefaultYakitBaseTempDir,
	"GetOnlineBaseUrl":             consts.GetOnlineBaseUrl,
	"SetOnlineBaseUrl":             consts.SetOnlineBaseUrl,

	"Info":          emptyVirtualClient.YakitInfo,
	"Warn":          emptyVirtualClient.YakitWarn,
	"Debug":         emptyVirtualClient.YakitDebug,
	"Error":         emptyVirtualClient.YakitError,
	"Text":          emptyVirtualClient.YakitTextBlock,
	"Markdown":      emptyVirtualClient.YakitMarkdown,
	"Report":        emptyVirtualClient.YakitReport,
	"File":          emptyVirtualClient.YakitFile,
	"Output":        emptyVirtualClient.Output,
	"SetProgress":   emptyVirtualClient.YakitSetProgress,
	"SetProgressEx": emptyVirtualClient.YakitSetProgressEx,
}
View Source
var YamlExports = map[string]interface{}{
	"Marshal": yaml.Marshal,
	"Unmarshal": func(b []byte) (interface{}, error) {
		var i interface{}
		err := yaml.Unmarshal(b, &i)
		if err != nil {
			return nil, err
		}
		return i, nil
	},
	"UnmarshalStrict": func(b []byte) (interface{}, error) {
		var i interface{}
		err := yaml.UnmarshalStrict(b, &i)
		if err != nil {
			return nil, err
		}
		return i, nil
	},
}
View Source
var ZipExports = map[string]interface{}{
	"Decompress": ziputil.DeCompress,
	"Compress": func(zipName string, filenames ...string) error {
		return ziputil.CompressByName(filenames, zipName)
	},
}

Functions

func Abs added in v1.2.9

func Abs(x float64) float64

Abs 返回x的绝对值 Example: ``` math.Abs(-1) // 1 math.Abs(1) // 1 ```

func BuildTlsConfig

func BuildTlsConfig(crt, key interface{}, cas ...interface{}) *tls.Config

func Ceil added in v1.2.9

func Ceil(x float64) float64

Ceil 返回不小于x的最小整数 Example: ``` math.Ceil(1.5) // 2 math.Ceil(-1.5) // -1 ```

func Chdir added in v1.2.9

func Chdir(dir string) error

Chdir 改变当前工作目录 Example: ``` err = os.Chdir("/tmp") ```

func Chmod added in v1.2.9

func Chmod(name string, mode os.FileMode) error

Chmod 改变指定文件或目录的权限 Example: ``` err = os.Chmod("/tmp/test.txt", 0777) ```

func Chown added in v1.2.9

func Chown(name string, uid, gid int) error

Chown 改变指定文件或目录的所有者和所属组 Example: ``` err = os.Chown("/var/www/html/test.txt", 1000, 1000) ```

func Clearenv added in v1.2.9

func Clearenv()

Clearenv 清空所有环境变量 Example: ``` os.Clearenv() ```

func Compare added in v1.2.8

func Compare(a string, b string) int

Compare 按照ascii码表顺序逐个比较字符串a和b中的每个字符,如果a==b,则返回0,如果a<b,则返回-1,如果a>b,则返回1 Example: ``` str.Compare("hello yak", "hello yak") // 0 str.Compare("hello yak", "hello") // 1 str.Compare("hello", "hello yak") // -1 ```

func Contains added in v1.2.8

func Contains(s string, substr string) bool

Contains 判断字符串s是否包含substr Example: ``` str.Contains("hello yakit", "yak") // true ```

func ContainsAny added in v1.2.8

func ContainsAny(s string, chars string) bool

ContainsAny 判断字符串s是否包含chars中的任意字符 Example: ``` str.ContainsAny("hello yak", "ly") // true str.ContainsAny("hello yak", "m") // false ```

func Count added in v1.2.8

func Count(s string, substr string) int

Count 返回字符串s中substr出现的次数 Example: ``` str.Count("hello yak", "l") // 2 ```

func CsrfOptWithHTTPS added in v1.2.4

func CsrfOptWithHTTPS(b bool) csrfConfig

func CsrfOptWithMultipartDefaultValue added in v1.2.4

func CsrfOptWithMultipartDefaultValue(b bool) csrfConfig

func DebugMockTCPFromScan added in v1.2.7

func DebugMockTCPFromScan(du time.Duration, responses map[string][][]byte) (string, int)

func DebugMockTCPProtocol added in v1.2.7

func DebugMockTCPProtocol(name string) (string, int)

func DebugMockUDP added in v1.2.3

func DebugMockUDP(rsp []byte) (string, int)

func DebugMockUDPFromScan added in v1.2.3

func DebugMockUDPFromScan(du time.Duration, responses map[string][][]byte) (string, int)

func DebugMockUDPProtocol added in v1.2.3

func DebugMockUDPProtocol(name string) (string, int)

func DebugMockUDPWithTimeout added in v1.2.3

func DebugMockUDPWithTimeout(du time.Duration, rsp []byte) (string, int)

func DownloadMMDB

func DownloadMMDB() error

func DownloadOnlineAuthProxy

func DownloadOnlineAuthProxy(baseUrl string) error

func EndsWith added in v1.2.8

func EndsWith(s string, suffix string) bool

EndsWith / HasSuffix 判断字符串s是否以suffix结尾 Example: ``` str.EndsWith("Hello Yak", "Yak") // true str.EndsWith("Hello Yak", "Hello") // false ```

func Environ added in v1.2.9

func Environ() []string

Environ 获取表示环境变量的字符串切片,格式为"key=value" Example: ``` for env in os.Environ() { value = env.SplitN("=", 2) printf("key = %s, value = %v\n", value[0], value[1]) } ```

func EqualFold added in v1.2.8

func EqualFold(s string, t string) bool

EqualFold 判断字符串s和t是否相等,忽略大小写 Example: ``` str.EqualFold("hello Yak", "HELLO YAK") // true ```

func Escape added in v1.2.4

func Escape(s []byte) string

func Executable added in v1.2.9

func Executable() (string, error)

Executable 获取当前可执行文件的路径 Example: ``` path, err = os.Executable() ```

func Exit added in v1.2.9

func Exit(code int)

Exit 退出当前进程 Example: ``` os.Exit(0) ```

func ExpandEnv added in v1.2.9

func ExpandEnv(s string) string

ExpandEnv 将字符串中的${var}或$var替换为其对应环境变量名的值 Example: ``` os.ExpandEnv("PATH = $PATH") ```

func Fields added in v1.2.8

func Fields(s string) []string

Fields 返回将字符串s按照空白字符('\t', '\n', '\v', '\f', '\r', ' ', 0x85, 0xA0)分割的字符串切片 Example: ``` str.Fields("hello world\nhello yak\tand\vyakit") // [hello", "world", "hello", "yak", "and", "yakit"] ```

func Floor added in v1.2.9

func Floor(x float64) float64

Floor 返回不大于x的最大整数 Example: ``` math.Floor(1.5) // 1 math.Floor(-1.5) // -2 ```

func GenerateCSRFPoc

func GenerateCSRFPoc(raw interface{}, opts ...csrfConfig) (string, error)

func GetDefaultDNSServers added in v1.2.9

func GetDefaultDNSServers() []string

GetDefaultDNSServers 获取默认的DNS服务器ip对应的字符串切片 Example: ``` os.GetDefaultDNSServers() ```

func GetExtYakitLibByClient

func GetExtYakitLibByClient(client *YakitClient) map[string]interface{}

func GetExtYakitLibByOutput added in v1.2.7

func GetExtYakitLibByOutput(Output func(d any) error) map[string]interface{}

func GetLocalAddress added in v1.2.9

func GetLocalAddress() []string

GetLocalAddress 获取本地IP地址 Example: ``` os.GetLocalAddress() // ["192.168.1.103", "fe80::605a:5ff:fefb:5405"] ```

func GetLocalIPv4Address added in v1.2.9

func GetLocalIPv4Address() []string

GetLocalIPv4Address 获取本地IPv4地址 Example: ``` os.GetLocalIPv4Address() // ["192.168.3.103"] ```

func GetLocalIPv6Address added in v1.2.9

func GetLocalIPv6Address() []string

GetLocalIPv6Address 获取本地IPv6地址 Example: ``` os.GetLocalIPv6Address() // ["fe80::605a:5ff:fefb:5405"] ```

func GetMachineID added in v1.2.9

func GetMachineID() string

GetMachineID 获取每个机器唯一的标识符 Example: ``` os.GetMachineID() ```

func GetRandomAvailableTCPPort added in v1.2.9

func GetRandomAvailableTCPPort() int

GetRandomAvailableTCPPort 获取随机可用的TCP端口 Example: ``` tcp.Serve("127.0.0.1", os.GetRandomAvailableTCPPort()) ```

func GetRandomAvailableUDPPort added in v1.2.9

func GetRandomAvailableUDPPort() int

GetRandomAvailableUDPPort 获取随机可用的UDP端口 Example: ``` udp.Serve("127.0.0.1", os.GetRandomAvailableTCPPort()) ```

func Getegid added in v1.2.9

func Getegid() int

Getegid 获取当前进程的有效组ID Example: ``` os.Getegid() ```

func Getenv added in v1.2.9

func Getenv(key string) string

Getenv 获取指定的环境变量的值,如果不存在则返回空字符串 Example: ``` value = os.Getenv("PATH") ```

func Geteuid added in v1.2.9

func Geteuid() int

Geteuid 获取当前进程的有效用户ID Example: ``` os.Geteuid() ```

func Getgid added in v1.2.9

func Getgid() int

Getgid 获取当前进程的组ID Example: ``` os.Getgid() ```

func Getpid added in v1.2.9

func Getpid() int

Getpid 获取当前进程的进程ID Example: ``` os.Getpid() ```

func Getppid added in v1.2.9

func Getppid() int

Getppid 获取当前进程的父进程ID Example: ``` os.Getppid() ```

func Getuid added in v1.2.9

func Getuid() int

Getuid 获取当前进程的用户ID Example: ``` os.Getuid() ```

func Getwd added in v1.2.9

func Getwd() (string, error)

Getwd 获取当前工作目录路径 Example: ``` cwd, err = os.Getwd() ```

func Hostname added in v1.2.9

func Hostname() (name string, err error)

Hostname 获取主机名 Example: ``` name, err = os.Hostname() ```

func Index added in v1.2.8

func Index(s string, substr string) int

Index 返回字符串s中substr第一次出现的位置的索引,如果字符串中不存在substr,则返回-1 Example: ``` str.Index("hello yak", "yak") // 6 str.Index("hello world", "yak") // -1 ```

func IndexAny added in v1.2.8

func IndexAny(s string, chars string) int

IndexAny 返回字符串s中chars任意字符首次出现的位置的索引,如果字符串中不存在chars,则返回-1 Example: ``` str.IndexAny("Hello world", "world") // 2,因为l在第三个字符中首次出现 str.IndexAny("Hello World", "Yak") // -1 ```

func IndexByte added in v1.2.8

func IndexByte(s string, c byte) int

IndexByte 返回字符串s中第一个等于c的字符的索引,如果字符串中不存在c,则返回-1 Example: ``` str.IndexByte("hello yak", 'y') // 6 str.IndexByte("hello yak", 'm') // -1 ```

func InitYakit added in v1.2.2

func InitYakit(y *YakitClient)

func InjectCliArgs added in v1.2.6

func InjectCliArgs(args []string)

func IsNaN added in v1.2.9

func IsNaN(x float64) bool

IsNaN 判断一个数是否是NaN Example: ``` math.IsNaN(1) // false math.IsNaN(math.NaN()) // true ```

func IsRemoteTCPPortOpen added in v1.2.9

func IsRemoteTCPPortOpen(host string, p int) bool

IsRemoteTCPPortOpen 检查远程TCP端口是否开放 Example: ``` os.IsRemoteTCPPortOpen("yaklang.com", 443) // true ```

func IsTCPPortAvailable added in v1.2.9

func IsTCPPortAvailable(p int) bool

IsTCPPortAvailable 检查TCP端口是否可用 Example: ``` os.IsTCPPortAvailable(80) ```

func IsTCPPortOpen added in v1.2.9

func IsTCPPortOpen(p int) bool

IsTCPPortOpen 检查TCP端口是否开放 Example: ``` os.IsTCPPortOpen(80) ```

func IsUDPPortAvailable added in v1.2.9

func IsUDPPortAvailable(p int) bool

IsUDPPortAvailable 检查UDP端口是否可用 Example: ``` os.IsUDPPortAvailable(80) ```

func IsUDPPortOpen added in v1.2.9

func IsUDPPortOpen(p int) bool

IsUDPPortOpen 检查UDP端口是否开放 Example: ``` os.IsUDPPortOpen(80) ```

func Join added in v1.2.8

func Join(i interface{}, d interface{}) (defaultResult string)

Join 将i中的元素用d连接,如果传入的参数不是字符串,会自动将其转为字符串,再将其用d连接。如果连接失败,则会返回i的字符串形式。 Example: ``` str.Join([]string{"hello", "yak"}, " ") // hello yak str.Join([]int{1, 2, 3}, " ") // 1 2 3 ```

func JsonRawByteToMap

func JsonRawByteToMap(jbyte json.RawMessage) (map[string]interface{}, error)

func JsonStrToVarList

func JsonStrToVarList(jstr string) ([]interface{}, error)

func JsonStreamToMapList

func JsonStreamToMapList(reader io.Reader) []map[string]interface{}

JsonStreamToMapList 从 reader 中读取字符串并解析为 map 列表 Example: ``` reader, writer = io.Pipe()

go fn {
    writer.Write(`{"a":1,"b":2} {"c":3, "d":4}`)
    writer.Close()
}

println(str.JsonStreamToMapList(reader)) // [map[a:1 b:2] map[c:3 d:4]] ```

func JsonStreamToMapListWithDepth

func JsonStreamToMapListWithDepth(reader io.Reader, i int) []map[string]interface{}

func JsonToMap

func JsonToMap(line string) map[string]string

JsonToMap 将 json 字符串 line 解析为 map Example: ``` str.JsonToMap(`{"a":1,"b":2}`) // map[a:1 b:2] ```

func JsonToMapList

func JsonToMapList(line string) []map[string]string

JsonToMapList 将 json 字符串 line 解析为 map 列表 Example: ``` str.JsonToMapList(`{"a":1,"b":2} {"c":3, "d":4}`) // [map[a:1 b:2] map[c:3 d:4]] ```

func JsonbToMap

func JsonbToMap(jb postgres.Jsonb) (map[string]interface{}, error)

func JsonbToString

func JsonbToString(jb postgres.Jsonb) (string, error)

func JsonbToVarList

func JsonbToVarList(jb postgres.Jsonb) ([]interface{}, error)

func LastIndex added in v1.2.8

func LastIndex(s string, substr string) int

LastIndex 返回字符串s中substr最后一次出现的位置的索引,如果字符串中不存在substr,则返回-1 Example: ``` str.LastIndex("hello yak", "l") // 3 str.LastIndex("hello yak", "m") // -1 ```

func LastIndexAny added in v1.2.8

func LastIndexAny(s string, chars string) int

LastIndexAny 返回字符串s中chars任意字符最后一次出现的位置的索引,如果字符串中不存在chars,则返回-1 Example: ``` str.LastIndexAny("hello yak", "ly") // 6 str.LastIndexAny("hello yak", "m") // -1 ```

func LastIndexByte added in v1.2.8

func LastIndexByte(s string, c byte) int

LastIndexByte 返回字符串s中最后一个等于c的字符的索引,如果字符串中不存在c,则返回-1 Example: ``` str.LastIndexByte("hello yak", 'l') // 3 str.LastIndexByte("hello yak", 'm') // -1 ```

func LookupEnv added in v1.2.9

func LookupEnv(key string) (string, bool)

LookupEnv 获取指定的环境变量的值 Example: ``` value, ok = os.LookupEnv("PATH") ```

func MarshalYakitOutput

func MarshalYakitOutput(t interface{}) (string, string)

func NaN added in v1.2.9

func NaN() float64

NaN 返回一个IEEE-574 “非数字”的值 Example: ``` math.NaN() ```

func NewCond added in v1.2.9

func NewCond() *sync.Cond

NewCond 创建一个 Cond 结构体引用,即一个条件变量,参考golang官方文档:https://golang.org/pkg/sync/#Cond 条件变量是一种用于协调多个并发任务之间的同步机制,它允许一个任务等待某个条件成立,同时允许其他任务在条件成立时通知等待的任务 Example: ``` c = sync.NewCond() done = false func read(name) { c.L.Lock() for !done { c.Wait() } println(name, "start reading") c.L.Unlock() }

func write(name) { time.sleep(1) println(name, "start writing") c.L.Lock() done = true c.L.Unlock() println(name, "wakes all") c.Broadcast() }

go read("reader1") go read("reader2") go read("reader3") write("writer") time.sleep(3) ```

func NewDefaultPoCConfig added in v1.2.2

func NewDefaultPoCConfig() *_pocConfig

func NewLock added in v1.2.9

func NewLock() *sync.Mutex

NewLock 创建一个 Mutex 结构体引用,用于实现互斥锁,其帮助我们避免多个并发任务访问同一个资源时出现数据竞争问题 它实际是 NewMutex 的别名 Example: ``` m = sync.NewMutex() newMap = make(map[string]string) go func{ for { m.Lock() // 请求锁 defer m.Unlock() // 释放锁 newMap["key"] = "value" // 防止多个并发任务同时修改 newMap } } for { println(newMap["key"]) } ```

func NewMap added in v1.2.9

func NewMap() *sync.Map

NewMap 创建一个 Map 结构体引用,这个 Map 是并发安全的 Example: ``` m = sync.NewMap() go func { for { m.Store("key", "value2") } } for { m.Store("key", "value") v, ok = m.Load("key") if ok { println(v) } } ```

func NewMutex added in v1.2.9

func NewMutex() *sync.Mutex

NewMutex 创建一个 Mutex 结构体引用,用于实现互斥锁,其帮助我们避免多个并发任务访问同一个资源时出现数据竞争问题 Example: ``` m = sync.NewMutex() newMap = make(map[string]string) go func{ for { m.Lock() // 请求锁 defer m.Unlock() // 释放锁 newMap["key"] = "value" // 防止多个并发任务同时修改 newMap } } for { println(newMap["key"]) } ```

func NewOnce added in v1.2.9

func NewOnce() *sync.Once

NewOnce 创建一个 Once 结构体引用,其帮助我们确保某个函数只会被执行一次 Example: ``` o = sync.NewOnce() for i in 10 { o.Do(func() { println("this message will only print once") }) } ```

func NewPool added in v1.2.9

func NewPool(newFunc ...func() any) *sync.Pool

NewPool 创建一个 Pool 结构体引用,其帮助我们复用临时对象,减少内存分配的次数 Example: ``` p = sync.NewPool(func() { return make(map[string]string) }) m = p.Get() // 从 Pool 中获取,如果 Pool 中没有,则会调用传入的第一个参数函数,返回一个新的 map[string]string m["1"] = "2" println(m) // {"1": "2"} // 将 m 放回 Pool 中 p.Put(m) m2 = p.Get() // 从 Pool 中获取,实际上我们获取到的是刚 Put 进去的 m println(m2) // {"1": "2"} ```

func NewPortFromMatchResult

func NewPortFromMatchResult(f *fp.MatchResult) *yakit.Port

func NewPortFromSpaceEngineResult

func NewPortFromSpaceEngineResult(f *spacengine.NetSpaceEngineResult) *yakit.Port

func NewPortFromSynScanResult

func NewPortFromSynScanResult(f *synscan.SynScanResult) *yakit.Port

func NewRWMutex added in v1.2.9

func NewRWMutex() *sync.RWMutex

NewRWMutex 创建一个 RWMutex 结构体引用,用于实现读写锁,其帮助我们避免多个并发任务访问同一个资源时出现数据竞争问题 Example: ``` m = sync.NewRWMutex() newMap = make(map[string]string) go func{ for { m.Lock() // 请求写锁 defer m.Unlock() // 释放写锁 newMap["key"] = "value" // 防止多个并发任务同时修改 newMap } } for { m.RLock() // 请求读锁 defer m.RUnlock() // 释放读锁 println(newMap["key"]) } ```

func NewReader added in v1.2.8

func NewReader(s string) *strings.Reader

NewReader 返回一个从字符串s读取数据的*Reader Example: ``` r = str.NewReader("hello yak") buf = make([]byte, 256) _, err = r.Read(buf) die(err) println(sprintf("%s", buf)) // hello yak ```

func NewSizedWaitGroup added in v1.2.3

func NewSizedWaitGroup(size int) *utils.SizedWaitGroup

NewSizedWaitGroup 创建一个 SizedWaitGroup 结构体引用,其帮助我们在处理多个并发任务时,等待所有任务完成后再进行下一步操作 SizedWaitGroup 与 WaitGroup 的区别在于 SizedWaitGroup 可以限制并发任务的数量 Example: ``` wg = sync.NewSizedWaitGroup(5) // 限制大小为5 for i in 10 { wg.Add() // 任务数量超过5时,会阻塞,直到有任务完成 go func(i) { defer wg.Done() time.Sleep(i) printf("任务%d 完成\n", i) }(i) } wg.Wait() println("所有任务完成") ```

func NewYakitLogExecResult

func NewYakitLogExecResult(level string, data string, items ...interface{}) *ypb.ExecResult

func NewYakitProgressExecResult

func NewYakitProgressExecResult(id string, progress float64) *ypb.ExecResult

func NewYakitStatusCardExecResult

func NewYakitStatusCardExecResult(status, data string, items ...string) *ypb.ExecResult

func ParamsGetOr

func ParamsGetOr(i map[string]string, key, defaultValue string) string

ParamsGetOr 从 map 中获取 key 对应的值,如果不存在则返回 defaultValue Example: ``` str.ParamsGetOr({"a": "1"}, "a", "2") // 1 str.ParamsGetOr({"a": "1"}, "b", "2") // 2 ```

func Pipe added in v1.2.9

func Pipe() (r *os.File, w *os.File, err error)

Pipe 创建一个管道,返回一个读取端和一个写入端以及错误 它实际是 io.Pipe 的别名 Example: ``` r, w, err = os.Pipe() die(err)

go func {
    w.WriteString("hello yak")
    w.Close()
}

bytes, err = io.ReadAll(r) die(err) dump(bytes) ```

func Pow added in v1.2.9

func Pow(x, y float64) float64

Pow 返回x的y次方 Example: ``` math.Pow(2, 3) // 8 math.Pow(2, -1) // 0.5 ```

func Pow10 added in v1.2.9

func Pow10(n int) float64

Pow10 返回10的n次方 Example: ``` math.Pow10(2) // 100 math.Pow10(-1) // 0.1 ```

func QueryIP

func QueryIP(ip string) (*geo.City, error)

func QueryIPForISP

func QueryIPForISP(ip string) (*geo.ISP, error)

func RawHandlerToExecOutput added in v1.2.2

func RawHandlerToExecOutput(h func(any) error) func(result *ypb.ExecResult) error

func RegexpMatchEmail

func RegexpMatchEmail(i interface{}) []string

ExtractEmail 提取字符串中所有的 Email 地址 Example: ``` re.ExtractEmail("hello your email is anonymous@yaklang.io") // ["anonymous@yaklang.io"] ```

func RegexpMatchHostPort

func RegexpMatchHostPort(i interface{}) []string

ExtractHostPort 提取字符串中所有的 Host:Port Example: ``` re.ExtractHostPort("Open Host:Port\n127.0.0.1:80\n127.0.0.1:443") // ["127.0.0.1:80", "127.0.0.1:443"] ```

func RegexpMatchIP

func RegexpMatchIP(i interface{}) []string

ExtractIP 提取字符串中所有的 IP 地址 Example: ``` re.ExtractIP("hello your local ip is 127.0.0.1, your local ipv6 ip is fe80::1") // ["127.0.0.1", "fe80::1"] ```

func RegexpMatchIPv4

func RegexpMatchIPv4(i interface{}) []string

ExtractIPv4 提取字符串中所有的 IPv4 地址 Example: ``` re.ExtractIPv4("hello your local ip is 127.0.0.1, your public ip is 1.1.1.1") // ["127.0.0.1", "1.1.1.1"] ```

func RegexpMatchIPv6

func RegexpMatchIPv6(i interface{}) []string

ExtractIPv6 提取字符串中所有的 IPv6 地址 Example: ``` re.ExtractIPv6("hello your local ipv6 ip is fe80::1, your public ipv6 ip is 2001:4860:4860::8888") // ["fe80::1", "2001:4860:4860::8888"] ```

func RegexpMatchMac

func RegexpMatchMac(i interface{}) []string

ExtractMac 提取字符串中所有的 MAC 地址 Example: ``` re.ExtractMac("hello your mac is 00:00:00:00:00:00") // ["00:00:00:00:00:00"] ```

func RegexpMatchPathParam

func RegexpMatchPathParam(i interface{}) []string

ExtractPath 提取URL中的路径和查询字符串 Example: ``` re.ExtractPath("visit this website: yaklang.com/docs/api/re?name=anonymous") // ["/docs/api/re?name=anonymous"] ```

func RegexpMatchTTY

func RegexpMatchTTY(i interface{}) []string

ExtractTTY 提取字符串中所有的Linux/Unix系统中的设备文件路径 Example: ``` re.ExtractTTY("hello your tty is /dev/pts/1") // ["/dev/pts/1"] ```

func RegexpMatchURL

func RegexpMatchURL(i interface{}) []string

ExtractURL 提取字符串中所有的 URL 地址 Example: ``` re.ExtractURL("Yak official website: https://yaklang.com and https://yaklang.io") // ["https://yaklang.com", "https://yaklang.io"] ```

func Remove added in v1.2.9

func Remove(name string) error

Remove 删除指定的文件或目录 Example: ``` os.Remove("/tmp/test.txt") ```

func RemoveAll added in v1.2.9

func RemoveAll(name string) error

RemoveAll 递归删除指定的路径及其子路径 Example: ``` os.RemoveAll("/tmp") ```

func Rename added in v1.2.9

func Rename(oldpath, newpath string) error

Rename 重命名文件或目录,可以用于移动文件或目录 Example: ``` os.Rename("/tmp/test.txt", "/tmp/test2.txt") os.Rename("/tmp/test", "/root/test") ```

func Repeat added in v1.2.8

func Repeat(s string, count int) string

Repeat 返回将字符串s重复count次的字符串 Example: ``` str.Repeat("hello", 3) // hellohellohello ```

func Replace added in v1.2.8

func Replace(s string, old string, new string, n int) string

Replace 返回将字符串s中前n个old字符串替换为new字符串的字符串 Example: ``` str.Replace("hello yak", "l", "L", 1) // heLlo yak ```

func ReplaceAll added in v1.2.8

func ReplaceAll(s string, old string, new string) string

ReplaceAll 返回将字符串s中所有old字符串替换为new字符串的字符串 Example: ``` str.ReplaceAll("hello yak", "yak", "yakit") // hello yakit ```

func Round added in v1.2.9

func Round(x float64) float64

Round 返回四舍五入到最近的整数 存在一些特殊情况:Round(±0) = ±0,Round(±Inf) = ±Inf,Round(NaN) = NaN Example: ``` math.Round(1.5) // 2 math.Round(1.4) // 1 ```

func RoundToEven added in v1.2.9

func RoundToEven(x float64) float64

RoundToEven 返回四舍五入到最近的偶整数 Example: ``` math.RoundToEven(1.5) // 2 math.RoundToEven(2.5) // 2 math.RoundToEven(3.5) // 4 math.RoundToEven(4.5) // 4 ```

func SetEngineClient added in v1.2.2

func SetEngineClient(e *antlr4yak.Engine, client *YakitClient)

func SetEngineInterface added in v1.2.6

func SetEngineInterface(engine IEngine)

func SetYakitServer_LogHandler

func SetYakitServer_LogHandler(h func(level string, info string)) func(s *YakitServer)

func SetYakitServer_ProgressHandler

func SetYakitServer_ProgressHandler(h func(id string, progress float64)) func(s *YakitServer)

func Setenv added in v1.2.9

func Setenv(key, value string) error

Setenv 设置指定的环境变量 Example: ``` os.Setenv("PATH", "/usr/local/bin:/usr/bin:/bin") ```

func Split added in v1.2.8

func Split(s string, sep string) []string

Split 将字符串s按照sep分割成字符串切片 Example: ``` str.Split("Hello Yak", " ") // [Hello", "Yak"] ```

func SplitAfter added in v1.2.8

func SplitAfter(s string, sep string) []string

SplitAfter 将字符串s按照sep分割成字符串切片,但是每个元素都会保留sep Example: ``` str.SplitAfter("Hello-Yak", "-") // [Hello-", "Yak"] ```

func SplitAfterN added in v1.2.8

func SplitAfterN(s string, sep string, n int) []string

SplitAfterN 将字符串s按照sep分割成字符串切片,但是每个元素都会保留sep,最多分为n个元素 Example: ``` str.SplitAfterN("Hello-Yak-and-World", "-", 2) // [Hello-", "Yak-and-World"] ```

func SplitN added in v1.2.8

func SplitN(s string, sep string, n int) []string

SplitN 将字符串s按照sep分割成字符串切片,最多分为n个元素 Example: ``` str.SplitN("Hello-Yak-and-World", "-", 2) // [Hello", "Yak-and-World"] ```

func Sqrt added in v1.2.9

func Sqrt(x float64) float64

Sqrt 返回一个数的平方根 如果x < 0,返回NaN Example: ``` math.Sqrt(4) // 2 math.Sqrt(-1) // NaN ```

func StartsWith added in v1.2.8

func StartsWith(s string, prefix string) bool

StartsWith / HasPrefix 判断字符串s是否以prefix开头 Example: ``` str.StartsWith("Hello Yak", "Hello") // true str.StartsWith("Hello Yak", "Yak") // false ```

func TempDir added in v1.2.9

func TempDir() string

TempDir 获取用于存放临时文件的默认目录路径 Example: ``` os.TempDir() ```

func Title added in v1.2.8

func Title(s string) string

Title 返回字符串s的标题化版本,即所有单词的首字母都是大写的 Example: ``` str.Title("hello yak") // Hello Yak ```

func ToLower added in v1.2.8

func ToLower(s string) string

ToLower 返回字符串s的小写形式 Example: ``` str.ToLower("HELLO YAK") // hello yak ```

func ToTitle added in v1.2.8

func ToTitle(s string) string

ToTitle 返回字符串s的标题化版本,其中所有Unicode字母都会被转换为其大写 Example: ``` str.ToTitle("hello yak") // HELLO YAK ```

func ToUpper added in v1.2.8

func ToUpper(s string) string

ToUpper 返回字符串s的大写形式 Example: ``` str.ToUpper("hello yak") // HELLO YAK ```

func ToValidUTF8 added in v1.2.8

func ToValidUTF8(s string, replacement string) string

ToValidUTF8 返回将字符串s中无效的UTF-8编码替换为replacement的字符串 Example: ```

str.ToValidUTF8("hello yak", "?") // hello yak ```

func Trim added in v1.2.8

func Trim(s string, cutset string) string

Trim 返回将字符串s两侧所有包含cutset字符串中的字符都去掉的字符串 Example: ``` str.Trim("Hello Yak", "Hk") // ello Ya str.Trim("HelloYakHello", "Hello") // Yak ```

func TrimLeft added in v1.2.8

func TrimLeft(s string, cutset string) string

TrimLeft 返回将字符串s左侧所有包含cutset字符串中的字符都去掉的字符串 Example: ``` str.TrimLeft("Hello Yak", "H") // ello Yak str.TrimLeft("HelloYak", "Hello") // Yak ```

func TrimPrefix added in v1.2.8

func TrimPrefix(s string, prefix string) string

TrimPrefix 返回将字符串s前缀prefix去掉的字符串 Example: ``` str.TrimPrefix("Hello Yak", "Hello") // Yak str.TrimPrefix("HelloYak", "Hello") // Yak ```

func TrimRight added in v1.2.8

func TrimRight(s string, cutset string) string

TrimRight 返回将字符串s右侧所有包含cutset字符串中的字符都去掉的字符串 Example: ``` str.TrimRight("Hello Yak", "k") // Hello Ya str.TrimRight("HelloYak", "Yak") // Hello ```

func TrimSpace added in v1.2.8

func TrimSpace(s string) string

TrimSpace 返回将字符串s两侧所有的空白字符都去掉的字符串 Example: ``` str.TrimSpace(" \t\n Hello Yak \n\t\r\n") // Hello Yak ```

func TrimSuffix added in v1.2.8

func TrimSuffix(s string, suffix string) string

TrimSuffix 返回将字符串s后缀suffix去掉的字符串 Example: ``` str.TrimSuffix("Hello Yak", "ak") // Hello Y str.TrimSuffix("HelloYak", "Yak") // Hello ```

func Unsetenv added in v1.2.9

func Unsetenv(key string) error

Unsetenv 删除指定的环境变量 Example: ``` os.Unsetenv("PATH") ```

func WaitConnect

func WaitConnect(addr string, timeout float64) error

WaitConnect 等待一个地址的端口开放或指导超时时间,如果超时则返回错误,这通常用于等待并确保一个服务启动 Example: ``` timeout, _ = time.ParseDuration("1m") ctx, cancel = context.WithTimeout(context.New(), timeout)

go func() {
    err = tcp.Serve("127.0.0.1", 8888, tcp.serverCallback(func (conn) {
    conn.Send("hello world")
    conn.Close()
}), tcp.serverContext(ctx))

    die(err)
}()

os.WaitConnect("127.0.0.1:8888", 5)~ // 等待tcp服务器启动 conn = tcp.Connect("127.0.0.1", 8888)~ bytes = conn.Recv()~ println(string(bytes)) ```

func YakitMessageGenerator

func YakitMessageGenerator(i interface{}) ([]byte, error)

func YakitNewAliveHost added in v1.2.7

func YakitNewAliveHost(target string, opts ...yakit.AliveHostParamsOpt)

func YakitNewRiskBuilder added in v1.2.7

func YakitNewRiskBuilder(client *YakitClient) func(target string, opts ...yakit.RiskParamsOpt)

func YakitOutputToExecResult added in v1.2.7

func YakitOutputToExecResult(i interface{}) *ypb.ExecResult

Types

type CustomDNSLog added in v1.2.6

type CustomDNSLog struct {
	// contains filtered or unexported fields
}

func NewCustomDNSLog added in v1.2.6

func NewCustomDNSLog(opts ..._dnslogConfigOpt) *CustomDNSLog

func (*CustomDNSLog) CheckDNSLogByToken added in v1.2.6

func (c *CustomDNSLog) CheckDNSLogByToken() ([]*tpb.DNSLogEvent, error)

func (*CustomDNSLog) GetSubDomainAndToken added in v1.2.6

func (c *CustomDNSLog) GetSubDomainAndToken() (string, string, error)

type GrokResult

type GrokResult map[string][]string

func Grok

func Grok(line string, rule string) GrokResult

Grok 用于将字符串 line 使用 Grok 以规则 rule 进行解析,并返回解析结果(map),参考 https://doc.yonyoucloud.com/doc/logstash-best-practice-cn/filter/grok.html 获取更多信息。 Example: ``` str.Grok("04/18-00:59:45.385191", "%{MONTHNUM:month}/%{MONTHDAY:day}-%{TIME:time}") // map[HOUR:[00] MINUTE:[59] SECOND:[45.385191] day:[18] month:[04] time:[00:59:45.385191]] ```

func GrokWithMultiPattern

func GrokWithMultiPattern(line string, rule string, p map[string]string) GrokResult

func (GrokResult) Get

func (g GrokResult) Get(key string) string

func (GrokResult) GetAll

func (g GrokResult) GetAll(key string) []string

func (GrokResult) GetOr

func (g GrokResult) GetOr(key string, value string) string

type HttpFlowShare added in v1.2.2

type HttpFlowShare struct {
	ShareId     string `json:"share_id"`
	ExtractCode string `json:"extract_code"`
}

type HttpFlowShareRequest added in v1.2.2

type HttpFlowShareRequest struct {
	ExpiredTime  int64  `json:"expired_time"`
	Module       string `json:"module"`
	ShareContent string `json:"share_content"`
	Pwd          bool   `json:"pwd"`
	LimitNum     int64  `json:"limit_num"`
	Token        string `json:"token"`
}

type IEngine added in v1.2.6

type IEngine interface {
	ExecuteEx(code string, params map[string]interface{}) (*antlr4yak.Engine, error)
}
var EngineInterface IEngine

type OnlineClient

type OnlineClient struct {
	// https://192.168.1.1:8080
	BaseUrl string
	// contains filtered or unexported fields
}

func NewOnlineClient

func NewOnlineClient(baseUrl string) *OnlineClient

func (*OnlineClient) DownloadYakitPluginAll

func (s *OnlineClient) DownloadYakitPluginAll(
	ctx context.Context,
) *OnlineDownloadStream

func (*OnlineClient) DownloadYakitPluginAllWithToken

func (s *OnlineClient) DownloadYakitPluginAllWithToken(
	ctx context.Context, token string, keywords string, pluginType string, status string, isPrivate string, tags string, userId int64, userName string, timeSearch string, group string,
) *OnlineDownloadStream

func (*OnlineClient) DownloadYakitPluginById

func (s *OnlineClient) DownloadYakitPluginById(id string, token string) (*OnlinePlugin, error)

func (*OnlineClient) DownloadYakitPluginByIdWithToken

func (s *OnlineClient) DownloadYakitPluginByIdWithToken(id string, token string) (*OnlinePlugin, error)

func (*OnlineClient) DownloadYakitPluginIDWithToken

func (s *OnlineClient) DownloadYakitPluginIDWithToken(
	ctx context.Context, token string, ids ...string) *OnlineDownloadStream

func (*OnlineClient) DownloadYakitPluginWithTokenBindMe

func (s *OnlineClient) DownloadYakitPluginWithTokenBindMe(
	ctx context.Context, token string, keywords string, pluginType string, status string, isPrivate string, tags string, userId int64, userName string, timeSearch string, group string,
) *OnlineDownloadStream

func (*OnlineClient) DownloadYakitPluginsEx

func (s *OnlineClient) DownloadYakitPluginsEx(
	ctx context.Context,
	all bool,
	ids []string,
	userToken string,
	bindMe bool,
	keywords string,
	pluginType string,
	status string,
	isPrivate string,
	tags string,
	userId int64,
	userName string,
	scriptName []string,
	timeSearch string,
	group string,
) *OnlineDownloadStream

func (*OnlineClient) DownloadYakitScriptName

func (s *OnlineClient) DownloadYakitScriptName(
	ctx context.Context, token string, scriptName ...string) *OnlineDownloadStream

func (*OnlineClient) HttpFlowShare added in v1.2.2

func (s *OnlineClient) HttpFlowShare(ctx context.Context,
	token string, expiredTime int64, module string, shareContent string, pwd bool, limitNum int64) (*HttpFlowShare, error)

func (*OnlineClient) HttpFlowShareWithToken added in v1.2.2

func (s *OnlineClient) HttpFlowShareWithToken(ctx context.Context, token string, expiredTime int64, module string, shareContent string, pwd bool, limitNum int64) (*HttpFlowShare, error)

func (*OnlineClient) Save

func (s *OnlineClient) Save(db *gorm.DB, plugins ...*OnlinePlugin) error

func (*OnlineClient) UploadRiskToOnline

func (s *OnlineClient) UploadRiskToOnline(ctx context.Context,
	token string, hash string, ip string, ipInteger int64, Url string, port int,
	host string, title string, titleVerbose string, riskType string, riskTypeVerbose string, parameter string,
	payload string, details string, fromYakScript string, waitingVerified bool, reverseToken string, severity string,
	request string, response string, runtimeId string, cve string, description string, solution string, riskCreatedAt int64) error

func (*OnlineClient) UploadRiskToOnlineWithToken

func (s *OnlineClient) UploadRiskToOnlineWithToken(ctx context.Context, token string, risk *yakit.Risk) error

func (*OnlineClient) UploadScreenRecordersToOnline added in v1.2.2

func (s *OnlineClient) UploadScreenRecordersToOnline(ctx context.Context,
	token string, file os.File, noteInfo string, project string, hash string, videoName string, cover string, screenRecordersCreatedAt int64, filePath string) error

func (*OnlineClient) UploadScreenRecordersWithToken added in v1.2.2

func (s *OnlineClient) UploadScreenRecordersWithToken(ctx context.Context, token string, file os.File, screenRecorders *yakit.ScreenRecorder) error

type OnlineDownloadStream

type OnlineDownloadStream struct {
	Total     int64
	Page      int64
	PageTotal int64
	Limit     int64
	Chan      chan *OnlinePluginItem
}

type OnlinePaging

type OnlinePaging struct {
	Page      int `json:"page"`
	Total     int `json:"total"`
	TotalPage int `json:"total_page"`
	Limit     int `json:"limit"`
}

type OnlinePlugin

type OnlinePlugin struct {
	Id                   int64                `json:"id"`
	UpdatedAt            int64                `json:"updated_at"`
	Type                 string               `json:"type"`
	ScriptName           string               `json:"script_name"`
	Content              string               `json:"content"`
	PublishedAt          int64                `json:"published_at"`
	Tags                 string               `json:"tags"`
	DefaultOpen          bool                 `json:"default_open"`
	DownloadedTotal      int64                `json:"downloaded_total"`
	Stars                int64                `json:"stars"`
	Status               int64                `json:"status"`
	Official             bool                 `json:"official"`
	IsPrivate            bool                 `json:"is_private"`
	Params               []*OnlinePluginParam `json:"params"`
	UserId               int64                `json:"user_id"`
	Author               string               `json:"authors"`
	Help                 string               `json:"help"`
	EnablePluginSelector bool                 `json:"enable_plugin_selector"`
	PluginSelectorTypes  string               `json:"plugin_selector_types"`
	IsGeneralModule      bool                 `json:"is_general_module"`
	OnlineContributors   string               `json:"online_contributors"`
	UUID                 string               `json:"uuid"`
	HeadImg              string               `json:"head_img"`
	BasePluginId         int64                `json:"base_plugin_id"`
	Group                string               `json:"group"`
}

type OnlinePluginItem

type OnlinePluginItem struct {
	Plugin *OnlinePlugin
	Total  int64
}

type OnlinePluginParam

type OnlinePluginParam struct {
	Field        string `json:"field"`
	DefaultValue string `json:"default_value"`
	TypeVerbose  string `json:"type_verbose"`
	FieldVerbose string `json:"field_verbose"`
	Help         string `json:"help"`
	Required     bool   `json:"required"`
	Group        string `json:"group"`
	ExtraSetting string `json:"extra_setting"`
}

type PocConfig

type PocConfig func(c *_pocConfig)

type ProtobufRecord

type ProtobufRecord struct {
	Index protowire.Number `json:"index" yaml:"index"`
	Type  string           `json:"type" yaml:"type"`
	Value interface{}      `json:"value,omitempty" yaml:"value,omitempty,flow"`
}

protobuf

func (*ProtobufRecord) String

func (r *ProtobufRecord) String() string

func (*ProtobufRecord) ToBytes

func (r *ProtobufRecord) ToBytes() []byte

type ProtobufRecords

type ProtobufRecords struct {
	Records []*ProtobufRecord
	// contains filtered or unexported fields
}

func (*ProtobufRecords) Error

func (r *ProtobufRecords) Error() error

func (*ProtobufRecords) Find

func (r *ProtobufRecords) Find(index int) []*ProtobufRecord

utils

func (*ProtobufRecords) FuzzEveryIndex

func (r *ProtobufRecords) FuzzEveryIndex(callback func(index int, typ string, data interface{}) interface{}) ([][]byte, error)

func (*ProtobufRecords) FuzzIndex

func (r *ProtobufRecords) FuzzIndex(index int, callback func(index int, typ string, data interface{}) interface{}) ([][]byte, error)

func (*ProtobufRecords) MarshalJSON

func (r *ProtobufRecords) MarshalJSON() ([]byte, error)

marshal / unmarshal

func (*ProtobufRecords) MarshalYAML

func (r *ProtobufRecords) MarshalYAML() (interface{}, error)

func (*ProtobufRecords) String

func (r *ProtobufRecords) String() string

protobuf convert

func (*ProtobufRecords) ToBytes

func (r *ProtobufRecords) ToBytes() []byte

func (*ProtobufRecords) ToHex

func (r *ProtobufRecords) ToHex() string

func (*ProtobufRecords) ToJSON

func (r *ProtobufRecords) ToJSON() string

func (*ProtobufRecords) ToYAML

func (r *ProtobufRecords) ToYAML() string

func (*ProtobufRecords) UnmarshalJSON

func (r *ProtobufRecords) UnmarshalJSON(data []byte) error

func (*ProtobufRecords) UnmarshalYAML

func (r *ProtobufRecords) UnmarshalYAML(node *yaml.Node) error

type QueryOnlinePluginRequest

type QueryOnlinePluginRequest struct {
	Type       string   `json:"type"`
	UUID       []string `json:"uuid"`
	Token      string   `json:"token"`
	Page       int      `json:"page"`
	Limit      int      `json:"limit"`
	BindMe     bool     `json:"bind_me"`
	Keywords   string   `json:"keywords"`
	PluginType string   `json:"plugin_type"`
	Status     string   `json:"status"`
	User       bool     `json:"user"`
	IsPrivate  string   `json:"is_private"`
	Tags       string   `json:"tags"`
	UserId     int64    `json:"user_id"`
	UserName   string   `json:"user_name"`
	ScriptName []string `json:"script_name"`
	TimeSearch string   `json:"time_search"`
	Group      string   `json:"group"`
}

type QueryUploadRiskOnlineRequest

type QueryUploadRiskOnlineRequest struct {
	Token           string `json:"token"`
	RiskHash        string `json:"risk_hash"`
	IP              string `json:"ip"`
	IPInteger       int64  `json:"ip_integer"`
	Url             string `json:"url"`
	Port            int    `json:"port"`
	Host            string `json:"host"`
	Title           string `json:"title"`
	TitleVerbose    string `json:"title_verbose"`
	RiskType        string `json:"risk_type"`
	RiskTypeVerbose string `json:"risk_type_verbose"`
	Parameter       string `json:"parameter"`
	Payload         string `json:"payload"`
	Details         string `json:"details"`
	FromYakScript   string `json:"from_yak_script"`
	WaitingVerified bool   `json:"waiting_verified"`
	ReverseToken    string `json:"reverse_token"`
	Severity        string `json:"severity"`
	Request         string `json:"request"`
	Response        string `json:"response"`
	RuntimeId       string `json:"runtime_id"`
	CVE             string `json:"cve"`
	Description     string `json:"description"`
	Solution        string `json:"solution"`
	RiskCreatedAt   int64  `json:"risk_created_at"`
}

type RegisterOutputFuncType

type RegisterOutputFuncType func(tag string, cb _outputCallback)

type ScreenRecordersUploadToOnlineRequest added in v1.2.2

type ScreenRecordersUploadToOnlineRequest struct {
	//Filename 	string	 `json:"filename"`
	NoteInfo                 string  `json:"note_info"`
	Project                  string  `json:"project"`
	Hash                     string  `json:"hash"`
	VideoName                string  `json:"video_name"`
	Cover                    string  `json:"cover"`
	Token                    string  `json:"token"`
	VideoFile                os.File `json:"video_file"`
	ScreenRecordersCreatedAt int64   `json:"screen_recorders_created_at"`
}

type StringMap added in v1.2.4

type StringMap map[string]interface{}

func (StringMap) MarshalXML added in v1.2.4

func (m StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*StringMap) UnmarshalXML added in v1.2.4

func (m *StringMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type TagAndTypeValue

type TagAndTypeValue struct {
	Value string
	Count int
}

type TagStat

type TagStat struct {
	// contains filtered or unexported fields
}

func NewTagStat

func NewTagStat() (*TagStat, error)

func (*TagStat) All

func (t *TagStat) All() []*TagValue

func (*TagStat) ForceUpdate

func (t *TagStat) ForceUpdate() error

func (*TagStat) GetCount

func (t *TagStat) GetCount(val string) int

func (*TagStat) TopN

func (t *TagStat) TopN(n int) []*TagValue

type TagValue

type TagValue struct {
	Name  string
	Count int
}

type UnregisterOutputFuncType

type UnregisterOutputFuncType func(tag string)

type WaitGroupProxy added in v1.2.3

type WaitGroupProxy struct {
	*sync.WaitGroup
}

func NewWaitGroup added in v1.2.3

func NewWaitGroup() *WaitGroupProxy

NewWaitGroup 创建一个 WaitGroup 结构体引用,其帮助我们在处理多个并发任务时,等待所有任务完成后再进行下一步操作 Example: ``` wg = sync.NewWaitGroup() for i in 5 { wg.Add() // 增加一个任务 go func(i) { defer wg.Done() time.Sleep(i) printf("任务%d 完成\n", i) }(i) } wg.Wait() println("所有任务完成") ```

func (*WaitGroupProxy) Add added in v1.2.3

func (w *WaitGroupProxy) Add(delta ...int)

type YakLogger added in v1.2.8

type YakLogger struct {
	*log.Logger
	SetLevel func(string) *golog.Logger
}

func CreateYakLogger

func CreateYakLogger(yakFiles ...string) *YakLogger

func (*YakLogger) SetEngine added in v1.2.8

func (y *YakLogger) SetEngine(engine *antlr4yak.Engine)

type YakitClient

type YakitClient struct {
	// contains filtered or unexported fields
}

func AutoInitYakit

func AutoInitYakit() *YakitClient

func GetYakitClientInstance

func GetYakitClientInstance() *YakitClient

func NewVirtualYakitClient

func NewVirtualYakitClient(h func(i *ypb.ExecResult) error) *YakitClient

NewVirtualYakitClient 用于脚本执行结果在 grpc 调用时的消息传递

func NewYakitClient

func NewYakitClient(addr string) *YakitClient

func (*YakitClient) Output

func (c *YakitClient) Output(i interface{}) error

func (*YakitClient) SendRaw

func (c *YakitClient) SendRaw(y *YakitLog) error

func (*YakitClient) SetYakLog added in v1.2.8

func (c *YakitClient) SetYakLog(logger *YakLogger)

func (*YakitClient) YakitDebug added in v1.2.8

func (c *YakitClient) YakitDebug(tmp string, items ...interface{})

func (*YakitClient) YakitDraw added in v1.2.8

func (c *YakitClient) YakitDraw(level string, data interface{})

func (*YakitClient) YakitError added in v1.2.8

func (c *YakitClient) YakitError(tmp string, items ...interface{})

func (*YakitClient) YakitFile added in v1.2.8

func (c *YakitClient) YakitFile(fileName string, desc ...interface{})

func (*YakitClient) YakitInfo added in v1.2.8

func (c *YakitClient) YakitInfo(tmp string, items ...interface{})

func (*YakitClient) YakitLog added in v1.2.8

func (c *YakitClient) YakitLog(level string, tmp string, items ...interface{}) error

输入

func (*YakitClient) YakitMarkdown added in v1.2.8

func (c *YakitClient) YakitMarkdown(tmp interface{})

func (*YakitClient) YakitReport added in v1.2.8

func (c *YakitClient) YakitReport(i int)

func (*YakitClient) YakitSetProgress added in v1.2.8

func (c *YakitClient) YakitSetProgress(f float64)

func (*YakitClient) YakitSetProgressEx added in v1.2.8

func (c *YakitClient) YakitSetProgressEx(id string, f float64)

func (*YakitClient) YakitTextBlock added in v1.2.8

func (c *YakitClient) YakitTextBlock(tmp interface{})

func (*YakitClient) YakitWarn added in v1.2.8

func (c *YakitClient) YakitWarn(tmp string, items ...interface{})

type YakitFeature

type YakitFeature struct {
	Feature string                 `json:"feature"`
	Params  map[string]interface{} `json:"params"`
}

type YakitFixedTableData

type YakitFixedTableData struct {
	TableName string                 `json:"table_name"`
	Data      map[string]interface{} `json:"data"`
}

type YakitGraph

type YakitGraph struct {
	// line / bar / pie
	Type string             `json:"type"`
	Data []*yakitGraphValue `json:"data"`
}

设置基本图形

func NewBarGraph

func NewBarGraph() *YakitGraph

func NewLineGraph

func NewLineGraph() *YakitGraph

func NewPieGraph

func NewPieGraph() *YakitGraph

func NewWordCloud

func NewWordCloud() *YakitGraph

func (*YakitGraph) Add

func (y *YakitGraph) Add(k string, v interface{}, id ...string)

type YakitHTTPFlowRisk

type YakitHTTPFlowRisk struct {
	RiskName  string   `json:"risk_name"`
	Url       string   `json:"url"`
	IsHTTPS   bool     `json:"is_https"`
	Highlight string   `json:"highlight"`
	Request   []byte   `json:"request"`
	Response  []byte   `json:"response"`
	Fragment  []string `json:"fragment"`

	// low / middle / high / critical
	Level string `json:"level"`
}

mitm risk

func NewHTTPFlowRisk

func NewHTTPFlowRisk(
	riskName string,
	isHttps bool, url string,
	req []byte, rsp []byte,
) *YakitHTTPFlowRisk

func (*YakitHTTPFlowRisk) SetFragment

func (y *YakitHTTPFlowRisk) SetFragment(item ...string)

func (*YakitHTTPFlowRisk) SetLevel

func (y *YakitHTTPFlowRisk) SetLevel(l string)

type YakitLog

type YakitLog struct {
	Level     string `json:"level"`
	Data      string `json:"data"`
	Timestamp int64  `json:"timestamp"`
}

type YakitMessage

type YakitMessage struct {
	Type    string          `json:"type"`
	Content json.RawMessage `json:"content"`
}

type YakitProgress

type YakitProgress struct {
	Id       string  `json:"id"`
	Progress float64 `json:"progress"`
}

type YakitServer

type YakitServer struct {
	// contains filtered or unexported fields
}

func NewYakitServer

func NewYakitServer(port int, opts ...func(server *YakitServer)) *YakitServer

func (*YakitServer) Addr

func (s *YakitServer) Addr() string

func (*YakitServer) Shutdown

func (s *YakitServer) Shutdown()

func (*YakitServer) Start

func (s *YakitServer) Start()

type YakitStatusCard

type YakitStatusCard struct {
	Id   string   `json:"id"`
	Data string   `json:"data"`
	Tags []string `json:"tags"`
}

type YakitTable

type YakitTable struct {
	Head []string   `json:"head"`
	Data [][]string `json:"data"`
}

yaktable

func NewTable

func NewTable(head ...string) *YakitTable

func (*YakitTable) Append

func (y *YakitTable) Append(data ...interface{})

func (*YakitTable) SetHead

func (y *YakitTable) SetHead(head ...string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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