yaklib

package
v0.0.0-...-9a26220 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: AGPL-3.0 Imports: 120 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 (
	HTTPServer_Serve             = _httpServe
	HTTPServer_ServeOpt_Context  = _httpServerOptContext
	HTTPServer_ServeOpt_Callback = _httpServerOptCallback
)
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]+))`)
)
View Source
var (
	Tcp_Server_Callback = _tcpServeCallback
	Tcp_Server_Context  = _tcpServeContext
	Tcp_Server_Tls      = _tcpServerTls
)

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

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 = cli.CliExports
View Source
var CodecExports = map[string]interface{}{}/* 127 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 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,
	"SaveHTTPFlowFromRawWithOption":  saveHTTPFlowFromRawWithOption,
	"SaveHTTPFlowInstance":           saveHTTPFlowInstance,
	"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 *schema.HTTPFlow {
		return queryHTTPFlowByKeyword("")
	},
	"QueryPortsByUpdatedAt":       queryPortsByUpdatedAt,
	"QueryPortsByTaskName":        queryPortsByTaskName,
	"QueryPortsByRuntimeId":       queryPortsByRuntimeId,
	"QueryHTTPFlowsByID":          queryHTTPFlowByID,
	"QueryHostPortByNetwork":      queryHostPortByNetwork,
	"QueryHostPortByKeyword":      queryHostAssetByNetwork,
	"QueryHostsByDomain":          queryHostAssetByDomainKeyword,
	"QueryDomainsByNetwork":       queryDomainAssetByNetwork,
	"QueryDomainsByDomainKeyword": queryDomainAssetByDomainKeyword,
	"QueryDomainsByTitle":         queryDomainAssetByHTMLTitle,
	"QueryPayloadGroups":          getPayloadGroups,
	"GetAllPayloadGroupsName":     getAllPayloadGroupsName,
	"DeletePayloadByGroup":        deletePayloadByGroup,
	"YieldPayload":                YieldPayload,
	"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 *schema.AliveHost {
		return yakit.YieldAliveHostRuntimeId(consts.GetGormProjectDatabase(), context.Background(), runtimeId)
	},

	"saveHTTPFlowWithTags": yakit.CreateHTTPFlowWithTags,
}
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{}{

	"Command":        command,
	"CommandContext": commandContext,

	"CheckCrash": checkCrash,

	"System": system,

	"SystemContext": systemContext,

	"SystemBatch": systemBatch,

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

	"WatchStdout": execWatchStdout,
	"WatchOutput": execWatchStdout,
	"WatchStderr": execWatchStderr,
}

系统命令执行导出接口

View Source
var FileExport = map[string]interface{}{
	"ReadLines":             _fileReadLines,
	"ReadLinesWithCallback": _fileReadLinesWithCallback,
	"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,
	"SEPARATOR": SEP,

	"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{}{
	"Retry":       utils.Retry2,
	"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)
	},
	"GC": func() {
		debug.SetGCPercent(8)
		runtime.GC()
		debug.FreeOSMemory()
		debug.SetGCPercent(8)
	},
	"GCPercent": debug.SetGCPercent,
}
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,
	"context":            mutate.OptContext,
	"noEncode":           mutate.OptDisableAutoEncode,
	"showTag":            mutate.OptFriendlyDisplay,
	"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,
	"callable": IsYakFunction,
}
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 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 JSExports = map[string]interface{}{
	"PoweredBy":            "github.com/dop251/goja",
	"New":                  _jsNewEngine,
	"Run":                  _run,
	"CallFunctionFromCode": _jsCallFuncFromCode,

	"libCryptoJSV3": _libCryptoJSV3,
	"libCryptoJSV4": _libCryptoJSV4,
	"libJSRSASign":  _libJSRSASign,
	"libJsEncrypt":  _libJsEncrypt,
	"withVariable":  _withVariable,
	"withVariables": _withVariables,

	"ASTWalk":   javascript.BasicJavaScriptASTWalker,
	"Parse":     _Parse,
	"GetSTType": GetStatementType,

	"NullValue":      goja.Null(),
	"UndefinedValue": goja.Undefined(),
	"FalseValue":     defaultJSRuntime.ToValue(false),
	"ToValue":        defaultJSRuntime.ToValue,
	"NaNValue":       goja.NaN(),
	"TrueValue":      defaultJSRuntime.ToValue(true),

	"GetObjectFunction": _getObjectFunction,
	"GetFunction":       _getFunction,
}
View Source
var JsonExports = map[string]interface{}{
	"New":        _yakJson,
	"Marshal":    _jsonMarshal,
	"dumps":      _jsonDumps,
	"loads":      _jsonLoad,
	"withPrefix": _withPrefix,
	"withIndent": _withIndent,

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

	"port":     bruteutils.Ldap_Port,
	"username": bruteutils.Ldap_Username,
	"password": bruteutils.Ldap_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,
	"Sinh":        Sinh,
	"Sin":         Sin,
	"Cos":         Cos,
	"Tan":         Tan,
	"Asin":        Asin,
	"Acos":        Acos,
	"Atan":        Atan,
	"Pi":          math.Pi,
	"Ln10":        math.Ln10,
	"Ln2":         math.Ln2,
	"E":           math.E,
	"Sqrt2":       math.Sqrt2,
	"SqrtPi":      math.SqrtPi,
	"SqrtE":       math.SqrtE,
}
View Source
var MitmConfigContext = mitmConfigContext
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,
	"gmtls":                mitmConfigGMTLS,
	"gmtlsPrefer":          mitmConfigGMTLSPrefer,
	"gmtlsOnly":            mitmConfigGMTLSOnly,
}
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 OrderedMapExports = map[string]interface{}{
	"New": orderedmap.New,
}
View Source
var PoCExports = poc.PoCExports
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,
	"GenerateStream":           regen.GenerateStream,
	"GenerateOne":              regen.GenerateOne,
	"GenerateOneStream":        regen.GenerateOneStream,
	"GenerateVisibleOne":       regen.GenerateVisibleOne,
	"GenerateVisibleOneStream": regen.GenerateVisibleOneStream,
	"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) {
		_, _, pattern, err := utils.Regexp2Compile(rule, opt)
		return pattern, err
	},
	"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,
		"QueryRisksByKeyword":       QueryRisksByKeyword,
		"NewRisk":                   YakitNewRiskBuilder(GetYakitClientInstance()),
		"RegisterBeforeRiskSave":    yakit.RegisterBeforeRiskSave,
		"YieldRiskByTarget":         YieldRiskByTarget,
		"YieldRiskByIds":            YieldRiskByIds,
		"YieldRiskByRuntimeId":      YieldRiskByRuntimeId,
		"YieldRiskByCreateAt":       YieldRiskByCreateAt,
		"YieldRiskByScriptName":     YieldRiskByScriptName,
		"DeleteRiskByTarget":        DeleteRiskByTarget,
		"DeleteRiskByID":            DeleteRiskByID,
		"NewUnverifiedRisk":         yakit.NewUnverifiedRisk,
		"NewPublicReverseRMIUrl":    NewPublicReverseRMIUrl,
		"NewPublicReverseHTTPSUrl":  NewPublicReverseHTTPSUrl,
		"NewPublicReverseHTTPUrl":   NewPublicReverseHTTPUrl,
		"NewLocalReverseRMIUrl":     NewLocalReverseRMIUrl,
		"NewLocalReverseHTTPSUrl":   NewLocalReverseHTTPSUrl,
		"NewLocalReverseHTTPUrl":    NewLocalReverseHTTPUrl,
		"HaveReverseRisk":           yakit.HaveReverseRisk,
		"NewRandomPortTrigger":      yakit.NewRandomPortTrigger,
		"NewDNSLogDomain":           yakit.NewDNSLogDomain,
		"NewHTTPLog":                yakit.NewHTTPLog,
		"CheckDNSLogByToken":        yakit.YakitNewCheckDNSLogByToken(yakit.YakitPluginInfo{}),
		"CheckHTTPLogByToken":       yakit.YakitNewCheckHTTPLogByToken(yakit.YakitPluginInfo{}),
		"CheckRandomTriggerByToken": yakit.YakitNewCheckRandomTriggerByToken(yakit.YakitPluginInfo{}),
		"CheckICMPTriggerByLength":  yakit.YakitNewCheckICMPTriggerByLength(yakit.YakitPluginInfo{}),
		"CheckServerReachable":      yakit.CheckServerReachable,
		"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,
		"ip":                        yakit.WithRiskParam_IP,
		"tag":                       yakit.WithRiskParam_Tags,
	}
)
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,

	"Query": Query,

	"domain":    _spaceEngine_Domain,
	"maxPage":   _spaceEngine_MaxPage,
	"maxRecord": _spaceEngine_MaxRecord,
	"pageSize":  _spaceEngine_PageSize,
	"zoomeye":   withUseZoomeye,
	"shodan":    withUseShodan,
	"quake":     withUseQuake,
	"hunter":    withUseHunter,
	"fofa":      withUseFofa,
	"engine":    withEngine,
}
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{}{}/* 122 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,
	"GetHomeDir":           GetHomeDir,
	"Hostname":             Hostname,
	"Unsetenv":             Unsetenv,
	"LookupEnv":            LookupEnv,
	"Clearenv":             Clearenv,
	"Setenv":               Setenv,
	"Getenv":               Getenv,
	"Exit":                 Exit,
	"Args":                 cli.OsArgs,
	"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":   generateRSA1024KeyPair,
	"GenerateRSA2048KeyPair":   generateRSA2048KeyPair,
	"GenerateRSA4096KeyPair":   generateRSA4096KeyPair,
	"GenerateSM2KeyPair":       tlsutils.SM2GenerateKeyPair,
	"GenerateRootCA":           generateRootCA,
	"SignX509ServerCertAndKey": tlsutils.SignServerCrtNKey,
	"SignX509ClientCertAndKey": tlsutils.SignClientCrtNKey,
	"SignServerCertAndKey":     tlsutils.SignServerCrtNKeyWithoutAuth,
	"SignClientCertAndKey":     tlsutils.SignClientCrtNKeyWithoutAuth,
	"Inspect":                  netx.TLSInspect,
	"InspectForceHttp2":        netx.TLSInspectForceHttp2,
	"InspectForceHttp1_1":      netx.TLSInspectForceHttp1_1,
	"EncryptWithPkcs1v15":      tlsutils.PemPkcs1v15Encrypt,
	"DecryptWithPkcs1v15":      tlsutils.PemPkcs1v15Decrypt,
}
View Source
var TracerouteExports = map[string]interface{}{
	"Diagnostic": func(host string, opts ...pingutil.TracerouteConfigOption) (chan *pingutil.TracerouteResponse, error) {
		return pingutil.Traceroute(host, opts...)
	},
	"ctx": pingutil.WithCtx,
	"timeout": func(timeout float64) pingutil.TracerouteConfigOption {
		return func(cfg *pingutil.TracerouteConfig) {
			pingutil.WithReadTimeout(timeout)(cfg)
			pingutil.WithWriteTimeout(timeout)(cfg)
		}
	},
	"hops":     pingutil.WithMaxHops,
	"protocol": pingutil.WithProtocol,
	"retry":    pingutil.WithRetryTimes,
	"localIp":  pingutil.WithLocalAddr,
	"udpPort":  pingutil.WithUdpPort,
	"firstTTL": pingutil.WithFirstTTL,
}
View Source
var UDPExport = map[string]interface{}{
	"MockUDPProtocol": DebugMockUDPProtocol,
	"Connect":         connectUdp,
	"clientTimeout":   clientTimeout,
	"clientLocalAddr": clientLocalAddr,

	"Serve":          udpServe,
	"serverTimeout":  UdpWithTimeout,
	"serverContext":  UdpWithContext,
	"serverCallback": UdpWithCallback,
}
View Source
var WithDNSLog_SetScript = setScript
View Source
var XMLExports = map[string]interface{}{
	"Escape":   xml_tools.XmlEscape,
	"dumps":    xml_tools.XmlDumps,
	"loads":    xml_tools.XmlLoads,
	"Prettify": xml_tools.XmlPrettify,
	"escape":   xml_tools.WithHTMLEscape,
}
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,
	"Success":       emptyVirtualClient.YakitSuccess,
	"Code":          emptyVirtualClient.YakitCode,
	"Markdown":      emptyVirtualClient.YakitMarkdown,
	"Report":        emptyVirtualClient.YakitReport,
	"File":          emptyVirtualClient.YakitFile,
	"Stream":        emptyVirtualClient.Stream,
	"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)
	},
	"CompressRaw":      CompressRaw,
	"Recursive":        Recursive,
	"RecursiveFromRaw": RecursiveFromRaw,
}

Functions

func Abs

func Abs(x float64) float64

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

func Acos

func Acos(x float64) float64

Acos 反三角函数 Acos

func Asin

func Asin(x float64) float64

Asin 反三角函数 Asin

func Atan

func Atan(x float64) float64

Atan 反三角函数 Atan

func BuildGmTlsConfig

func BuildGmTlsConfig(crt, key interface{}, cas ...interface{}) *gmtls.Config

func BuildTlsConfig

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

func Ceil

func Ceil(x float64) float64

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

func Chdir

func Chdir(dir string) error

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

func Chmod

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

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

func Chown

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

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

func Clearenv

func Clearenv()

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

func Compare

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 CompressRaw

func CompressRaw(i any) ([]byte, error)

CompressRaw compresses a map to a zip file Example: ```

zipBytes = zip.CompressRaw({
	 "a.txt": "hello",
     "b.txt": "world",
})~
zipBytes2, err = zip.CompressRaw({ "a.txt": "hello", "b.txt": file.ReadFile("/tmp/external-file-name.txt")~ })

```

func Contains

func Contains(s string, substr string) bool

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

func ContainsAny

func ContainsAny(s string, chars string) bool

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

func Cos

func Cos(x float64) float64

Cos 三角函数 Cos

func Count

func Count(s string, substr string) int

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

func CsrfOptWithHTTPS

func CsrfOptWithHTTPS(b bool) csrfConfig

https 手动设置请求报文是否为HTTPS类型 Example: ``` csrfPoc, err = csrf.Generate("POST / HTTP/1.1\r\nHost:example.com\r\nContent-Type:application/x-www-form-urlencoded\r\n\r\nname=1&age=2", csrf.HTTPS(true)) ```

func CsrfOptWithMultipartDefaultValue

func CsrfOptWithMultipartDefaultValue(b bool) csrfConfig

multipartDefaultValue 手动设置请求报文是否为multipart/form-data类型 如果设置为true,则会生成使用JavaScript提交的漏洞验证(POC) Example: ``` csrfPoc, err = csrf.Generate("POST / HTTP/1.1\r\nHost:example.com\r\nContent-Type:application/x-www-form-urlencoded\r\n\r\nname=1&age=2", csrf.MultipartDefaultValue(true)) ```

func DebugMockTCPFromScan

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

func DebugMockTCPProtocol

func DebugMockTCPProtocol(name string) (string, int)

func DebugMockUDP

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

func DebugMockUDPFromScan

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

func DebugMockUDPProtocol

func DebugMockUDPProtocol(name string) (string, int)

func DebugMockUDPWithTimeout

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

func DeleteRiskByID

func DeleteRiskByID(id int64) error

DeleteRiskByID 根据风险记录ID删除风险记录

func DeleteRiskByTarget

func DeleteRiskByTarget(addr string) error

DeleteRiskByTarget 根据目标(ip或ip:port)删除风险记录 Example: ``` risk.DeleteRiskByTarget("example.com") ```

func DownloadMMDB

func DownloadMMDB() error

func DownloadOnlineAuthProxy

func DownloadOnlineAuthProxy(baseUrl string) error

func EndsWith

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

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

func EqualFold(s string, t string) bool

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

func Executable

func Executable() (string, error)

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

func Exit

func Exit(code int)

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

func ExpandEnv

func ExpandEnv(s string) string

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

func Fields

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

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)

Generate 根据传入的原始请求报文生成跨站请求伪造(CSRF)类型的漏洞验证(POC),返回生成的POC HTML字符串与错误 Example: ``` csrfPoc, err = csrf.Generate("POST / HTTP/1.1\r\nHost:example.com\r\nContent-Type:application/x-www-form-urlencoded\r\n\r\nname=1&age=2") ```

func GetDefaultDNSServers

func GetDefaultDNSServers() []string

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

func GetExtYakitLibByClient

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

func GetExtYakitLibByOutput

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

func GetHomeDir

func GetHomeDir() string

GetHomeDir 获取当前用户的家目录 Example: ``` os.GetHomeDir() // "/Users/yaklang" ```

func GetLocalAddress

func GetLocalAddress() []string

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

func GetLocalIPv4Address

func GetLocalIPv4Address() []string

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

func GetLocalIPv6Address

func GetLocalIPv6Address() []string

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

func GetMachineID

func GetMachineID() string

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

func GetRandomAvailableTCPPort

func GetRandomAvailableTCPPort() int

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

func GetRandomAvailableUDPPort

func GetRandomAvailableUDPPort() int

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

func GetStatementType

func GetStatementType(st interface{}) string

func Getegid

func Getegid() int

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

func Getenv

func Getenv(key string) string

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

func Geteuid

func Geteuid() int

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

func Getgid

func Getgid() int

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

func Getpid

func Getpid() int

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

func Getppid

func Getppid() int

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

func Getuid

func Getuid() int

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

func Getwd

func Getwd() (string, error)

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

func Hostname

func Hostname() (name string, err error)

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

func Index

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

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

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

func InitYakit(y *YakitClient)

func IsNaN

func IsNaN(x float64) bool

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

func IsNewYakFunction

func IsNewYakFunction(i interface{}) bool

func IsRemoteTCPPortOpen

func IsRemoteTCPPortOpen(host string, p int) bool

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

func IsTCPPortAvailable

func IsTCPPortAvailable(p int) bool

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

func IsTCPPortOpen

func IsTCPPortOpen(p int) bool

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

func IsUDPPortAvailable

func IsUDPPortAvailable(p int) bool

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

func IsUDPPortOpen

func IsUDPPortOpen(p int) bool

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

func IsYakFunction

func IsYakFunction(i interface{}) bool

func Join

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

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

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

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

func LookupEnv(key string) (string, bool)

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

func MarshalYakitOutput

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

func NaN

func NaN() float64

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

func NewCond

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 NewJsonConfig

func NewJsonConfig() *jsonConfig

func NewLocalReverseHTTPSUrl

func NewLocalReverseHTTPSUrl() string

NewLocalReverseHTTPSUrl 返回一个本地 Bridge 的反向 HTTPS URL Example: ``` url := risk.NewLocalReverseHTTPSUrl() ```

func NewLocalReverseHTTPUrl

func NewLocalReverseHTTPUrl() string

NewLocalReverseHTTPUrl 返回一个本地 Bridge 的反向 HTTP URL Example: ``` url := risk.NewLocalReverseHTTPUrl() ```

func NewLocalReverseRMIUrl

func NewLocalReverseRMIUrl() string

NewLocalReverseRMIUrl 返回一个本地 Bridge 的反向 RMI URL Example: ``` url := risk.NewLocalReverseRMIUrl() ```

func NewLock

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

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

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

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

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) *schema.Port

func NewPortFromSpaceEngineResult

func NewPortFromSpaceEngineResult(f *base.NetSpaceEngineResult) *schema.Port

func NewPortFromSynScanResult

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

func NewPublicReverseHTTPSUrl

func NewPublicReverseHTTPSUrl() string

NewPublicReverseHTTPSUrl 返回一个公网 Bridge 的反向 HTTPS URL Example: ``` url := risk.NewPublicReverseHTTPSUrl() ```

func NewPublicReverseHTTPUrl

func NewPublicReverseHTTPUrl() string

NewPublicReverseHTTPUrl 返回一个公网 Bridge 的反向 HTTP URL Example: ``` url := risk.NewPublicReverseHTTPUrl() ```

func NewPublicReverseRMIUrl

func NewPublicReverseRMIUrl() string

NewPublicReverseRMIUrl 返回一个公网 Bridge 的反向 RMI URL Example: ``` url := risk.NewPublicReverseRMIUrl() ```

func NewRWMutex

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

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

func NewSizedWaitGroup(size int, ctxs ...context.Context) *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

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

func Pow(x, y float64) float64

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

func Pow10

func Pow10(n int) float64

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

func Query

func Query(filter string, opts ..._spaceEngineConfigOpt) (chan *base.NetSpaceEngineResult, error)

func QueryIP

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

func QueryIPForISP

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

func QueryRisks

func QueryRisks(opts ...yakit.RiskParamsOpt) chan *schema.Risk

QueryRisks 根据风险记录的结构体查询风险记录,返回风险记录的管道 Example: ``` for risk := range risk.QueryRisks(risk.severity("high"), risk.type("sqli"), risk.title("SQL注入漏洞")) { println(risk) } ```

func QueryRisksByKeyword

func QueryRisksByKeyword(keyword string, opts ...yakit.RiskParamsOpt) chan *schema.Risk

QueryRisksByKeyword 根据关键字查询风险记录,返回风险记录的管道 Example: ``` for risk := range risk.QueryRisksByKeyword("SQL注入", risk.severity("high")) { println(risk) } ```

func RawHandlerToExecOutput

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

func Recursive

func Recursive(i any, cb func(isDir bool, pathName string, info os.FileInfo) error) error

Recursive Decompress decompresses a zip file to a directory Example: ```

zip.Decompress("/tmp/abc.zip", (isDir, pathName, info) => {
		log.info("isDir: %v, pathName: %v, info: %v", isDir, pathName, info.Name())
})~

```

func RecursiveFromRaw

func RecursiveFromRaw(i any, cb func(isDir bool, pathName string, info os.FileInfo) error) error

RecursiveFromRaw decompresses a zip file to a directory Example: ```

raw = file.ReadFile("/tmp/abc.zip")~
zip.RecursiveFromRawBytes(raw, (isDir, pathName, info) => {
		log.info("isDir: %v, pathName: %v, info: %v", isDir, pathName, info.Name())
})

```

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 Remove

func Remove(name string) error

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

func RemoveAll

func RemoveAll(name string) error

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

func Rename

func Rename(oldpath, newpath string) error

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

func Repeat

func Repeat(s string, count int) string

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

func Replace

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

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

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

func Round

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

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

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

func SetEngineInterface

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

func Setenv(key, value string) error

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

func Sin

func Sin(x float64) float64

Sin 三角函数 sin

func Sinh

func Sinh(x float64) float64

Sinh 双曲正弦函数

func Split

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

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

func SplitAfter

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

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

func SplitAfterN

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

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

func Sqrt(x float64) float64

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

func StartsWith

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 Tan

func Tan(x float64) float64

Tan 三角函数 Tan

func TempDir

func TempDir() string

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

func Title

func Title(s string) string

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

func ToLower

func ToLower(s string) string

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

func ToTitle

func ToTitle(s string) string

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

func ToUpper

func ToUpper(s string) string

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

func ToValidUTF8

func ToValidUTF8(s string, replacement string) string

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

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

func Trim

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

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

func TrimPrefix(s string, prefix string) string

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

func TrimRight

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

func TrimSpace(s string) string

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

func TrimSuffix

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

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

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

func YakitNewRiskBuilder

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

NewRisk 创建一条漏洞记录结构体并保存到数据库中,第一个参数是目标URL,后面可以传入零个或多个选项参数,用于指定 risk 的结构 Example: ``` risk.NewRisk("http://example.com", risk.title("SQL注入漏洞"), risk.type("sqli"), risk.severity("high"), risk.description(""), risk.solution("")) ```

func YakitOutputToExecResult

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

func YieldPayload

func YieldPayload(raw any, extra ...any) chan string

YieldPayload means

func YieldRiskByCreateAt

func YieldRiskByCreateAt(timestamp int64) chan *schema.Risk

YieldRiskByCreateAt 根据创建时间戳获取风险记录,返回风险记录的管道 Example: ``` ts = time.Parse("2006-01-02 15:04:05", "2020-01-01 00:00:00")~.Unix() for risk := range risk.YieldRiskByCreateAt(ts) { println(risk) } ```

func YieldRiskByIds

func YieldRiskByIds(ids []int) chan *schema.Risk

YieldRiskByIds 根据 Risk ID 获取风险记录,返回风险记录的管道 Example: ``` for risk := range risk.YieldRiskByIds([1,2,3]) { println(risk) } ```

func YieldRiskByRuntimeId

func YieldRiskByRuntimeId(runtimeId string) chan *schema.Risk

YieldRiskByRuntimeId 根据 RuntimeID 获取风险记录,返回风险记录的管道 Example: ``` for risk := range risk.YieldRiskByRuntimeId("161c5372-3e75-46f6-a6bf-1a3182da625e") { println(risk) } ```

func YieldRiskByScriptName

func YieldRiskByScriptName(scriptName string) chan *schema.Risk

YieldRiskByScriptName 根据插件名戳获取风险记录,返回风险记录的管道 Example: ``` for risk := range risk.YieldRiskByScriptName("基础 XSS 检测") { println(risk) } ```

func YieldRiskByTarget

func YieldRiskByTarget(target string) chan *schema.Risk

YieldRiskByTarget 根据目标(ip或ip:port)获取风险记录,返回风险记录的管道 Example: ``` for risk := range risk.YieldRiskByTarget("example.com") { println(risk) } ```

Types

type CustomDNSLog

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

func NewCustomDNSLog

func NewCustomDNSLog(opts ..._dnslogConfigOpt) *CustomDNSLog

func (*CustomDNSLog) CheckDNSLogByToken

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

func (*CustomDNSLog) GetSubDomainAndToken

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

type DownloadHotPatchTemplateRequest

type DownloadHotPatchTemplateRequest struct {
	Name         string `json:"name"`
	TemplateType string `json:"type"`
}

type DownloadOnlinePluginRequest

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

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 HotPatchTemplate

type HotPatchTemplate struct {
	Name         string `json:"name"`
	Content      string `json:"content"`
	TemplateType string `json:"type"`
}

type HttpFlowShare

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

type HttpFlowShareRequest

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 HttpServerConfigOpt

type HttpServerConfigOpt func(c *_httpServerConfig)

type IEngine

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

type JsRunConfig

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

type JsonOpt

type JsonOpt func(opt *jsonConfig)

type MitmConfigOpt

type MitmConfigOpt func(config *mitmConfig)

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) DownloadHotPatchTemplate

func (s *OnlineClient) DownloadHotPatchTemplate(
	name, templateType string,
) (*HotPatchTemplate, error)

func (*OnlineClient) DownloadNewOnlinePlugins

func (s *OnlineClient) DownloadNewOnlinePlugins(
	ctx context.Context,
	token string,
	isPrivate []bool,
	keywords string,
	pluginType []string,
	tags []string,
	userName string,
	userId int64,
	timeSearch string,
	group []string,
	listType string,
	status []int64,
	uuid []string,
	scriptName []string,
) *OnlineDownloadStream

func (*OnlineClient) DownloadOnlinePluginByPluginName

func (s *OnlineClient) DownloadOnlinePluginByPluginName(
	ctx context.Context, token string, scriptName []string) *OnlineDownloadStream

func (*OnlineClient) DownloadOnlinePluginByUUID

func (s *OnlineClient) DownloadOnlinePluginByUUID(token, uuid string) (*OnlinePlugin, error)

func (*OnlineClient) DownloadOnlinePluginsBatch

func (s *OnlineClient) DownloadOnlinePluginsBatch(
	ctx context.Context, token string,
	isPrivate []bool,
	keywords string,
	pluginType []string,
	tags []string,
	userName string,
	userId int64,
	timeSearch string,
	group []string,
	listType string,
	status []int64,
	uuid []string,
	scriptName []string,

) *OnlineDownloadStream

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

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

func (*OnlineClient) HttpFlowShareWithToken

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) SaveToOnline

func (s *OnlineClient) SaveToOnline(ctx context.Context, req *ypb.SaveYakScriptToOnlineRequest, plugin *schema.YakScript) error

func (*OnlineClient) SaveYakScriptToOnline

func (s *OnlineClient) SaveYakScriptToOnline(ctx context.Context,
	token string, scriptName string, pluginType, content, params, help, tags string, enablePluginSelector bool, pluginSelectorTypes string, isGeneralModule, isPrivate bool, riskDetail string, isCorePlugin bool, pluginSupplement, pluginEnvKey string) error

func (*OnlineClient) UploadHTTPFlowToOnline

func (s *OnlineClient) UploadHTTPFlowToOnline(ctx context.Context, token, projectName, projectDescription string, content []byte) error

func (*OnlineClient) UploadHotPatchTemplateToOnline

func (s *OnlineClient) UploadHotPatchTemplateToOnline(ctx context.Context, token string, data []byte) error

func (*OnlineClient) UploadRiskToOnline

func (s *OnlineClient) UploadRiskToOnline(ctx context.Context,
	token string, projectName string, content []byte) error

func (*OnlineClient) UploadRiskToOnlineWithToken

func (s *OnlineClient) UploadRiskToOnlineWithToken(ctx context.Context, req *ypb.UploadRiskToOnlineRequest, risk []byte) error

func (*OnlineClient) UploadScreenRecordersToOnline

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

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

type OnlineCollaboratorInfo

type OnlineCollaboratorInfo struct {
	HeadImg  string `json:"head_img"`
	UserName string `json:"user_name"`
}

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"`
	RiskInfo             []*OnlineRiskDetail       `json:"riskInfo"`
	IsCorePlugin         bool                      `json:"isCorePlugin"`
	CollaboratorInfo     []*OnlineCollaboratorInfo `json:"collaborator"`
	PluginEnvKey         []string                  `json:"pluginEnvKey"`
}

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"`
	MethodType   string `json:"method_type"`
}

type OnlineRiskDetail

type OnlineRiskDetail struct {
	Description string `json:"description"`
	Solution    string `json:"solution"`
	Level       string `json:"level"`
	TypeVerbose string `json:"typeVerbose"`
	CVE         string `json:"cve"`
}

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 QueryHTTPFlowOnlineRequest

type QueryHTTPFlowOnlineRequest struct {
	ProjectName        string `json:"projectName"`
	Content            []byte `json:"content"`
	ProjectDescription string `json:"projectDescription"`
}

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 {
	ProjectName string `json:"projectName"`
	Content     []byte `json:"content"`
}

type RegisterOutputFuncType

type RegisterOutputFuncType func(tag string, cb _outputCallback)

type ResponseErr

type ResponseErr struct {
	Form   string `json:"form"`
	Reason string `json:"reason"`
	Ok     bool   `json:"ok"`
}

type SaveYakScriptOnlineRequest

type SaveYakScriptOnlineRequest struct {
	ScriptName           string               `json:"script_name"`
	Type                 string               `json:"type"`
	Content              string               `json:"content"`
	Params               []*OnlinePluginParam `json:"params"`
	Help                 string               `json:"help"`
	Tags                 []string             `json:"tags"`
	EnablePluginSelector bool                 `json:"enable_plugin_selector"`
	PluginSelectorTypes  string               `json:"plugin_selector_types"`
	IsGeneralModule      bool                 `json:"is_general_module"`
	IsPrivate            bool                 `json:"is_private"`
	RiskInfo             []*OnlineRiskDetail  `json:"riskInfo"`
	IsCorePlugin         bool                 `json:"isCorePlugin"`
	PluginSupplement     string               `json:"pluginSupplement"`
	PluginEnvKey         []string             `json:"pluginEnvKey"`
}

type ScreenRecordersUploadToOnlineRequest

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 StdPrinter

type StdPrinter struct{}

func (*StdPrinter) Error

func (s *StdPrinter) Error(msg string)

func (*StdPrinter) Log

func (s *StdPrinter) Log(msg string)

func (*StdPrinter) Warn

func (s *StdPrinter) Warn(msg string)

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 TcpServerConfigOpt

type TcpServerConfigOpt func(c *tcpServerConfig)

type UdpServerOpt

type UdpServerOpt func(config *udpServerConfig)

func UdpWithCallback

func UdpWithCallback(cb func(*udpConnection, []byte)) UdpServerOpt

func UdpWithContext

func UdpWithContext(ctx context.Context) UdpServerOpt

func UdpWithTimeout

func UdpWithTimeout(f float64) UdpServerOpt

type UnregisterOutputFuncType

type UnregisterOutputFuncType func(tag string)

type UploadHotPatchTemplateToOnlineRequest

type UploadHotPatchTemplateToOnlineRequest struct {
	Content []byte `json:"content"`
}

type WaitGroupProxy

type WaitGroupProxy struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

func NewWaitGroup

func NewWaitGroup(ctxs ...context.Context) *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

func (wg *WaitGroupProxy) Add(deltas ...int)

func (*WaitGroupProxy) Done

func (wg *WaitGroupProxy) Done()

func (*WaitGroupProxy) SetContext

func (wg *WaitGroupProxy) SetContext(ctx context.Context)

SetContext sets the context for the WaitGroup. ! If Call twice or more, any of the previous context Done will cause the WaitGroup to be SetZero.

func (*WaitGroupProxy) SetZero

func (wg *WaitGroupProxy) SetZero()

type YakLogger

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

func CreateYakLogger

func CreateYakLogger(yakFiles ...string) *YakLogger

func (*YakLogger) SetEngine

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 NewVirtualYakitClientWithRuntimeID

func NewVirtualYakitClientWithRuntimeID(h func(i *ypb.ExecResult) error, runtimeID string) *YakitClient

func NewYakitClient

func NewYakitClient(addr string) *YakitClient

func (*YakitClient) Output

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

func (*YakitClient) RawSend

func (c *YakitClient) RawSend(i any) error

func (*YakitClient) SendRaw

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

func (*YakitClient) SetYakLog

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

func (*YakitClient) StatusCard

func (c *YakitClient) StatusCard(id string, data interface{}, tags ...string)

func (*YakitClient) Stream

func (c *YakitClient) Stream(streamType string, streamId string, stream io.Reader, extra ...any)

func (*YakitClient) YakitCode

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

func (*YakitClient) YakitDebug

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

func (*YakitClient) YakitDraw

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

func (*YakitClient) YakitError

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

func (*YakitClient) YakitFile

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

func (*YakitClient) YakitInfo

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

func (*YakitClient) YakitLog

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

输入

func (*YakitClient) YakitMarkdown

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

func (*YakitClient) YakitReport

func (c *YakitClient) YakitReport(i int)

func (*YakitClient) YakitSetProgress

func (c *YakitClient) YakitSetProgress(f float64)

func (*YakitClient) YakitSetProgressEx

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

func (*YakitClient) YakitSuccess

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

func (*YakitClient) YakitTextBlock

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

func (*YakitClient) YakitWarn

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
	Name string             `json:"name"`
	Type string             `json:"type"`
	Data []*yakitGraphValue `json:"data"`
}

设置基本图形

func NewBarGraph

func NewBarGraph(graphName ...string) *YakitGraph

func NewLineGraph

func NewLineGraph(graphName ...string) *YakitGraph

func NewPieGraph

func NewPieGraph(graphName ...string) *YakitGraph

func NewWordCloud

func NewWordCloud(graphName ...string) *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"`
}

var yakitClientInstance YakitClient

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)

type YakitTextTabData

type YakitTextTabData struct {
	TableName string `json:"table_name"`
	Data      string `json:"data"`
}

Directories

Path Synopsis
codegrpc/doc command

Jump to

Keyboard shortcuts

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