yaklib

package
v1.2.6-sp1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: AGPL-3.0 Imports: 99 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 (
	//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 (
	Args []string
)
View Source
var BotExports = map[string]interface{}{
	"New":               bot.New,
	"FromEnv":           bot.FromEnv,
	"webhook":           bot.WithWebhook,
	"webhookWithSecret": bot.WithWebhookWithSecret,
	"workwx":            bot.WithWebhook,
	"ding":              bot.WithWebhookWithSecret,
}
View Source
var BufioExport = map[string]interface{}{
	"NewReader":     _newReader,
	"NewReaderSize": _newReaderSize,
	"NewWriter":     _newWriter,
	"NewWriterSize": _newWriterSize,
	"NewReadWriter": _newReadWriter,
	"NewScanner":    _newScanner,
}
View Source
var CNCountry = struct {
	GeoNameID         uint              `maxminddb:"geoname_id"`
	IsInEuropeanUnion bool              `maxminddb:"is_in_european_union"`
	IsoCode           string            `maxminddb:"iso_code"`
	Names             map[string]string `maxminddb:"names"`
}(struct {
	GeoNameID         uint
	IsInEuropeanUnion bool
	IsoCode           string
	Names             map[string]string
}{GeoNameID: 1814991, IsInEuropeanUnion: false, IsoCode: "CN", Names: map[string]string{

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

var CNCountry =

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

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

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

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

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

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

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

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

		}
	},
}
View Source
var CodecExports = map[string]interface{}{}/* 122 elements not displayed */
View Source
var ContextExports = map[string]interface{}{
	"Seconds":      utils.TimeoutContextSeconds,
	"New":          context.Background,
	"Background":   context.Background,
	"WithCancel":   context.WithCancel,
	"WithTimeout":  context.WithTimeout,
	"WithDeadline": context.WithDeadline,
	"WithValue":    context.WithValue,
}
View Source
var CrawlerExports = map[string]interface{}{}
View Source
var DNSLogExports = map[string]interface{}{
	"NewCustomDNSLog":   NewCustomDNSLog,
	"QueryCustomScript": queryCustomScript,
	"LookupFirst":       netx.LookupFirst,
	"random":            randomDNSLogPlatforms,
	"mode":              setMode,
	"local":             setLocal,
	"script":            setScript,
}
View Source
var DatabaseExports = map[string]interface{}{

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

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

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

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

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

	"GetYakitPluginByName": queryYakitPluginByName,

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

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

	"CreateTemporaryYakScript": yakit.CreateTemporaryYakScript,
}
View Source
var DictUtilExports = map[string]interface{}{
	"Mix": _dictMix,
}
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 EmptyBytesSlice = make([][]byte, 0)
View Source
var EnvExports = map[string]interface{}{
	"Get": func(key string) string {
		return os.Getenv(key)
	},
	"Set": func(key string, value string) {
		_ = os.Setenv(key, value)
	},
}
View Source
var ExecExports = map[string]interface{}{
	"CommandContext": _execStringToCommand,
	"Command": func(i string) (*exec.Cmd, error) {
		return _execStringToCommand(context.Background(), i)
	},

	"CheckCrash": _checkExecCrash,

	"SystemBatch": _execSystemBatch,

	"SystemContext": _execSystem,

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

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

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

系统命令执行导出接口

View Source
var FileExport = map[string]interface{}{
	"ReadLines":  readLines,
	"GetDirPath": filepath.Dir,
	"Split":      filepath.Split,
	"IsExisted": func(name string) bool {
		ret, _ := utils.PathExists(name)
		return ret
	},
	"IsFile": func(file string) bool {
		if info, err := os.Stat(file); err != nil {
			return false
		} else {
			if info.IsDir() {
				return false
			}

			return true
		}
	},
	"IsAbs":  filepath.IsAbs,
	"IsLink": _fileIsLink,
	"IsDir":  _fileIsDir,
	"Join":   filepath.Join,

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

	"ReadAll":  ioutil.ReadAll,
	"ReadFile": ioutil.ReadFile,
	"TempFile": _tempFile,
	"TempFileName": func() (string, error) {
		f, err := _tempFile()
		if err != nil {
			return "", err
		}
		f.Close()
		return f.Name(), nil
	},
	"Mkdir": func(name string) error {
		return os.Mkdir(name, os.ModePerm)
	},
	"MkdirAll": func(name string) error {
		return os.MkdirAll(name, os.ModePerm)
	},
	"Rename": os.Rename,
	"Remove": os.RemoveAll,
	"Create": func(name string) (*_yakFile, error) {
		f, err := os.Create(name)
		if err != nil {
			return nil, err
		}
		return &_yakFile{file: f}, nil
	},

	"Open": func(name string) (*_yakFile, error) {
		file, err := os.OpenFile(name, os.O_CREATE|os.O_RDWR, os.ModePerm)
		if err != nil {
			return nil, err
		}
		return &_yakFile{file: file}, nil
	},
	"OpenFile": func(name string, flag int, perm os.FileMode) (*_yakFile, error) {
		f, err := os.OpenFile(name, flag, perm)
		if err != nil {
			return nil, err
		}
		return &_yakFile{file: f}, nil
	},
	"Stat":  os.Stat,
	"Lstat": os.Lstat,
	"Save":  _saveFile,
	"SaveJson": func(name string, i interface{}) error {
		switch ret := i.(type) {
		case []byte:
			return _saveFile(name, ret)
		case string:
			return _saveFile(name, ret)
		case []string:
			return _saveFile(name, ret)
		default:
			raw, err := json.Marshal(i)
			if err != nil {
				return utils.Errorf("marshal %v failed: %s", spew.Sdump(i), err)
			}
			return _saveFile(name, raw)
		}
	},

	"Cat": func(i string) {
		raw, err := ioutil.ReadFile(i)
		_diewith(err)
		fmt.Print(string(raw))
	},
	"TailF": func(i string, line func(i string)) {
		t, err := tail.TailFile(i, tail.Config{
			MustExist: false,
			Follow:    true,
			Logger:    tail.DiscardingLogger,
		})
		if err != nil {
			log.Errorf("tail failed: %s", err)
			return
		}
		for {
			select {
			case l, ok := <-t.Lines:
				if !ok {
					return
				}
				if line != nil {
					line(l.Text)
				}
			}
		}
	},
	"Mv":  os.Rename,
	"Rm":  os.RemoveAll,
	"Cp":  _fileCopy,
	"Dir": _lsDir,
	"Ls":  _lsDir,

	"Abs": func(i string) string {
		raw, err := filepath.Abs(i)
		if err != nil {
			log.Errorf("fetch abs path failed for[%v]: %s", i, raw)
			return i
		}
		return raw
	},
	"ReadFileInfoInDirectory": utils.ReadFilesRecursively,
	"ReadDirInfoInDirectory":  utils.ReadDirsRecursively,
	"NewMultiFileLineReader":  mfreader.NewMultiFileLineReader,
}
View Source
var FunkExports = map[string]interface{}{
	"WaitConnect": WaitConnect,

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

	"fail": _failed,
	"die":  _diewith,
	"uuid": func() string {
		return uuid.New().String()
	},
	"timestamp": func() int64 {
		return time.Now().Unix()
	},
	"nanotimestamp": func() int64 {
		return time.Now().UnixNano()
	},
	"datetime": func() string {
		return time.Now().Format("2006-01-02 15:04:05")
	},
	"date": func() string {
		return time.Now().Format("2006-01-02")
	},
	"now": time.Now,

	"timestampToDatetime": func(tValue int64) string {
		tm := time.Unix(tValue, 0)
		return tm.Format("2006-01-02 15:04:05")
	},
	"datetimeToTimestamp": func(str string) (int64, error) {
		t, err := time.Parse("2006-01-02 15:04:05", str)
		if err != nil {
			return 0, err
		}
		return t.Unix(), nil
	},
	"timestampToTime": func(i int64) time.Time {
		return time.Unix(i, 0)
	},
	"dump": func(i ...interface{}) {
		spew.Dump(i...)
	},
	"sdump": func(i ...interface{}) string {
		return spew.Sdump(i...)
	},
	"randn": func(min, max int) int {
		if min > max {
			panic(_sfmt("randn failed; min: %v max: %v", min, max))
		}
		return min + rand.Intn(max-min)
	},
	"randstr": func(length int) string {
		return utils.RandStringBytes(length)
	},
	"sleep": sleep,
	"wait": func(i interface{}) {
		switch ret := i.(type) {
		case context.Context:
			select {
			case <-ret.Done():
			}
		case string:
			sleep(parseFloat(ret))
		case float64:
			sleep(ret)
		case float32:
			sleep(float64(ret))
		case int:
			sleep(float64(ret))
		default:
			panic(fmt.Sprintf("cannot wait %v", spew.Sdump(ret)))
		}

	},
	"assert":     _assert,
	"assertTrue": _assert,
	"isEmpty": func(i interface{}) bool {
		if i == nil || i == spec.Undefined {
			return true
		}
		return false
	},
	"assertEmpty": func(i interface{}) {
		if i == nil || i == spec.Undefined {
			return
		}
		panic(_sfmt("expect nil but got %v", spew.Sdump(i)))
	},
	"assertf": func(b bool, f string, items ...interface{}) {
		if !b {
			panic(_sfmt(f, items))
		}
	},

	"parseInt":     parseInt,
	"parseStr":     parseString,
	"parseString":  parseString,
	"parseBool":    parseBool,
	"parseBoolean": parseBool,
	"parseFloat":   parseFloat,
	"atoi":         strconv.Atoi,
	"parseTime":    time.Parse,
	"input":        _input,

	"tick1s": tick1s,

	"desc":    _desc,
	"descStr": _descToString,
	"chr": func(i interface{}) string {
		return string([]byte{byte(parseInt(utils.InterfaceToString(i)))})
	},
	"ord": func(i interface{}) int {
		switch ret := i.(type) {
		case byte:
			return int(ret)
		default:
			strRaw := utils.InterfaceToString(i)
			if strRaw == "" {
				return -1
			}

			if r := []rune(strRaw); r != nil {
				return int(r[0])
			}

			return int(strRaw[0])
		}
	},
	"typeof": func(i interface{}) reflect.Type {
		return reflect.TypeOf(i)
	},
}
View Source
var GrokExports = map[string]interface{}{
	"ExtractIPv4":     RegexpMatchIPv4,
	"ExtractIPv6":     RegexpMatchIPv6,
	"ExtractIP":       RegexpMatchIP,
	"ExtractEmail":    RegexpMatchEmail,
	"ExtractPath":     RegexpMatchPathParam,
	"ExtractTTY":      RegexpMatchTTY,
	"ExtractURL":      RegexpMatchURL,
	"ExtractHostPort": RegexpMatchHostPort,
	"ExtractMac":      RegexpMatchMac,
}
View Source
var GzipExports = map[string]interface{}{
	"Compress":   utils.GzipCompress,
	"Decompress": utils.GzipDeCompress,
	"IsGzip":     utils.IsGzip,
}
View Source
var HTTPServer_Serve = _httpServe
View Source
var HTTPServer_ServeOpt_Callback = _httpServerOptCallback
View Source
var HTTPServer_ServeOpt_Context = _httpServerOptContext
View Source
var HttpExports = yakhttp.HttpExports
View Source
var HttpPoolExports = mutate.HttpPoolExports
View Source
var HttpServeExports = map[string]interface{}{
	"Serve":                _httpServe,
	"tlsCertAndKey":        _httpServerOptCaAndKey,
	"context":              _httpServerOptContext,
	"handler":              _httpServerOptCallback,
	"LocalFileSystemServe": _localFileSystemServe,
}
View Source
var IoExports = map[string]interface{}{
	"ReadAll":  ioutil.ReadAll,
	"ReadFile": ioutil.ReadFile,
	"ReadEvery1s": func(c context.Context, reader io.Reader, f func([]byte) bool) {
		utils.ReadWithContextTickCallback(c, reader, f, 1*time.Second)
	},

	"NopCloser":   ioutil.NopCloser,
	"Copy":        io.Copy,
	"CopyN":       io.CopyN,
	"Discard":     ioutil.Discard,
	"EOF":         io.EOF,
	"LimitReader": io.LimitReader,
	"MultiReader": io.MultiReader,

	"Pipe": io.Pipe,

	"TeeReader":   io.TeeReader,
	"WriteString": io.WriteString,
	"ReadStable": func(conn net.Conn, float float64) []byte {
		return utils.StableReader(conn, utils.FloatSecondDuration(float), 10*1024*1024)
	},
}
View Source
var (
	JSOttoExports = map[string]interface{}{
		"PoweredBy":            "github.com/robertkrimen/otto",
		"New":                  _jsNewEngine,
		"Run":                  otto.Run,
		"CallFunctionFromCode": _jsCallFuncFromCode,
		"NullValue":            otto.NullValue,
		"UndefinedValue":       otto.UndefinedValue,
		"FalseValue":           otto.FalseValue,
		"ToValue":              otto.ToValue,
		"NaNValue":             otto.NaNValue,
		"TrueValue":            otto.TrueValue,
		"ASTWalk":              javascript.BasicJavaScriptASTWalker,
		"Parse":                _Pares,
		"GetSTType":            javascript.GetStatementType,
	}
)
View Source
var JsonExports = map[string]interface{}{
	"New":     _yakJson,
	"Marshal": json.Marshal,
	"dumps":   _jsonDumps,
	"loads":   _jsonLoad,

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

	"port":     optLdap_Port,
	"username": optLdap_Username,
	"password": optLdap_Password,
}
View Source
var LogExports = map[string]interface{}{
	"info":     log.Infof,
	"setLevel": setLogLevel,
	"debug":    log.Debugf,
	"warn":     log.Warningf,
	"error":    log.Errorf,
}
View Source
var MathExport = map[string]interface{}{
	"Round":       math.Round,
	"Sqrt":        math.Sqrt,
	"Pow":         math.Pow,
	"Pow10":       math.Pow10,
	"Floor":       math.Floor,
	"Ceil":        math.Ceil,
	"RoundToEven": math.RoundToEven,
	"Abs":         math.Abs,
	"NaN":         math.NaN,
	"IsNaN":       math.IsNaN,
	"Pi":          math.Pi,
	"Ln10":        math.Ln10,
	"Ln2":         math.Ln2,
	"E":           math.E,
	"Sqrt2":       math.Sqrt2,
	"SqrtPi":      math.SqrtPi,
	"SqrtE":       math.SqrtE,
}
View Source
var (
	MitmExports = map[string]interface{}{
		"Start":  startMitm,
		"Bridge": startBridge,

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

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

			c.Country = CNCountry
		}
		return &c, nil
	},
}
View Source
var PingExports = map[string]interface{}{
	"Scan": _pingScan,
	"Ping": _ping,

	"excludeHosts": _pingConfigOpt_excludeHosts,
	"onResult":     _pingConfigOpt_onResult,
	"dnsTimeout":   _pingConfigOpt_withDNSTimeout,
	"timeout":      _pingConfigOpt_withTimeout,
	"dnsServers":   _pingConfigOpt_dnsServers,
	"scanCClass":   _pingConfigOpt_scanCClass,
	"skip":         _pingConfigOpt_skipped,
	"concurrent":   _pingConfigOpt_concurrent,
	"tcpPingPorts": _pingConfigOpt_tcpPingPorts,
	"proxy":        _pingConfigOpt_proxy,
}
View Source
var PoCExports = map[string]interface{}{}/* 107 elements not displayed */
View Source
var PoCOptWithFromPlugin = _pocOptWithFromPlugin
View Source
var PoCOptWithProxy = _pocOptWithProxy
View Source
var PoCOptWithRuntimeId = _pocOptWithRuntimeId
View Source
var PoCOptWithSaveHTTPFlow = _pocOptWithSave
View Source
var PoCOptWithSource = _pocOptWIthSource
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,
	"MustGenerate": regen.MustGenerate,
}
View Source
var Regexp2Export = map[string]interface{}{
	"QuoteMeta": regexp2.Escape,
	"Compile":   re2Compile,
	"CompileWithOption": func(rule string, opt int) (*regexp2.Regexp, error) {
		return regexp2.Compile(rule, regexp2.RegexOptions(opt))
	},
	"OPT_None":                    regexp2.None,
	"OPT_IgnoreCase":              regexp2.IgnoreCase,
	"OPT_Multiline":               regexp2.Multiline,
	"OPT_ExplicitCapture":         regexp2.ExplicitCapture,
	"OPT_Compiled":                regexp2.Compiled,
	"OPT_Singleline":              regexp2.Singleline,
	"OPT_IgnorePatternWhitespace": regexp2.IgnorePatternWhitespace,
	"OPT_RightToLeft":             regexp2.RightToLeft,
	"OPT_Debug":                   regexp2.Debug,
	"OPT_ECMAScript":              regexp2.ECMAScript,
	"OPT_RE2":                     regexp2.RE2,

	"Find":               re2Find,
	"FindAll":            re2FindAll,
	"FindSubmatch":       re2FindSubmatch,
	"FindSubmatchAll":    re2FindSubmatchAll,
	"FindGroup":          re2ExtractGroups,
	"FindGroupAll":       re2ExtractGroupsAll,
	"ReplaceAll":         re2ReplaceAll,
	"ReplaceAllWithFunc": re2ReplaceAllFunc,
}
View Source
var RegexpExport = map[string]interface{}{
	"QuoteMeta":        regexp.QuoteMeta,
	"Compile":          regexp.Compile,
	"CompilePOSIX":     regexp.CompilePOSIX,
	"MustCompile":      regexp.MustCompile,
	"MustCompilePOSIX": regexp.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,
		"RegisterBeforeRiskSave": yakit.RegisterBeforeRiskSave,
		"NewRisk":                yakitNewRisk,
		"YieldRiskByTarget": func(target string) chan *yakit.Risk {
			return yakit.YieldRisksByTarget(consts.GetGormProjectDatabase(), context.Background(), target)
		},
		"YieldRiskByRuntimeId": func(runtimeId string) chan *yakit.Risk {
			return yakit.YieldRisksByRuntimeId(consts.GetGormProjectDatabase(), context.Background(), runtimeId)
		},
		"YieldRiskByCreateAt": func(timestamp int64) chan *yakit.Risk {
			return yakit.YieldRisksByCreateAt(consts.GetGormProjectDatabase(), context.Background(), timestamp)
		},
		"DeleteRiskByTarget": func(addr string) {
			yakit.DeleteRiskByTarget(consts.GetGormProjectDatabase(), addr)
		},
		"DeleteRiskByID": func(id any) {
			var err = yakit.DeleteRiskByID(consts.GetGormProjectDatabase(), int64(codec.Atoi(utils.InterfaceToString(id))))
			if err != nil {
				log.Errorf("delete risk by id error: %v", err)
			}
		},
		"NewUnverifiedRisk":         yakit.NewUnverifiedRisk,
		"NewPublicReverseRMIUrl":    yakit.NewPublicReverseProtoUrl("rmi"),
		"NewPublicReverseHTTPSUrl":  yakit.NewPublicReverseProtoUrl("https"),
		"NewPublicReverseHTTPUrl":   yakit.NewPublicReverseProtoUrl("http"),
		"NewLocalReverseRMIUrl":     yakit.NewLocalReverseProtoUrl("rmi"),
		"NewLocalReverseHTTPSUrl":   yakit.NewLocalReverseProtoUrl("https"),
		"NewLocalReverseHTTPUrl":    yakit.NewLocalReverseProtoUrl("http"),
		"HaveReverseRisk":           yakit.HaveReverseRisk,
		"NewRandomPortTrigger":      yakit.NewRandomPortTrigger,
		"NewDNSLogDomain":           yakit.NewDNSLogDomain,
		"CheckDNSLogByToken":        yakit.CheckDNSLogByToken,
		"CheckRandomTriggerByToken": yakit.CheckRandomTriggerByToken,
		"CheckICMPTriggerByLength":  yakit.CheckICMPTriggerByLength,
		"ExtractTokenFromUrl":       yakit.ExtractTokenFromUrl,
		"payload":                   yakit.WithRiskParam_Payload,
		"title":                     yakit.WithRiskParam_Title,
		"type":                      yakit.WithRiskParam_RiskType,
		"titleVerbose":              yakit.WithRiskParam_TitleVerbose,
		"description":               yakit.WithRiskParam_Description,
		"solution":                  yakit.WithRiskParam_Solution,
		"typeVerbose":               yakit.WithRiskParam_RiskVerbose,
		"parameter":                 yakit.WithRiskParam_Parameter,
		"token":                     yakit.WithRiskParam_Token,
		"details":                   yakit.WithRiskParam_Details,
		"request":                   yakit.WithRiskParam_Request,
		"response":                  yakit.WithRiskParam_Response,
		"runtimeId":                 yakit.WithRiskParam_RuntimeId,
		"potential":                 yakit.WithRiskParam_Potential,
		"cve":                       yakit.WithRiskParam_CVE,
		"severity":                  yakit.WithRiskParam_Severity,
		"level":                     yakit.WithRiskParam_Severity,
		"fromYakScript":             yakit.WithRiskParam_FromScript,
		"ignore":                    yakit.WithRiskParam_Ignore,
	}
)
View Source
var SambaExports = map[string]interface{}{
	"username":    _smbConfig_Username,
	"password":    _smbConfig_Password,
	"domain":      _smbConfig_Domain,
	"workstation": _smbConfig_Workstation,
	"hash":        _smbConfig_Hash,
	"debug":       _smbConfig_Debug,
	"Connect":     smbConn,
}
View Source
var SpaceEngineExports = map[string]interface{}{
	"ShodanQuery":  _shodan,
	"FofaQuery":    _fofa,
	"QuakeQuery":   _quake,
	"HunterQuery":  _hunter,
	"ZoomeyeQuery": _zoomeye,

	"maxPage":   _spaceEngine_MaxPage,
	"maxRecord": _spaceEngine_MaxRecord,
	"pageSize":  _spaceEngine_PageSize,
}
View Source
var (
	StringsExport = map[string]interface{}{}/* 112 elements not displayed */

)
View Source
var SyncExport = map[string]interface{}{
	"NewWaitGroup":      NewWaitGroup,
	"NewSizedWaitGroup": NewSizedWaitGroup,
	"NewMutex": func() *sync.Mutex {
		return new(sync.Mutex)
	},
	"NewLock": func() *sync.Mutex {
		return new(sync.Mutex)
	},
	"NewMap": func() *sync.Map {
		return new(sync.Map)
	},
	"NewOnce": func() *sync.Once {
		return new(sync.Once)
	},
	"NewRWMutex": func() *sync.RWMutex {
		return new(sync.RWMutex)
	},
	"NewPool": func() *sync.Pool {
		return new(sync.Pool)
	},
	"NewCond": func() *sync.Cond {
		return sync.NewCond(new(sync.Mutex))
	},
}
View Source
var SystemExports = map[string]interface{}{
	"IsTCPPortOpen": func(p int) bool {
		return !utils.IsTCPPortAvailable(p)
	},
	"IsUDPPortOpen": func(p int) bool {
		return !utils.IsUDPPortAvailable(p)
	},
	"LookupHost":                lookupHost,
	"LookupIP":                  lookupIP,
	"IsTCPPortAvailable":        utils.IsTCPPortAvailable,
	"IsUDPPortAvailable":        utils.IsUDPPortAvailable,
	"GetRandomAvailableTCPPort": utils.GetRandomAvailableTCPPort,
	"GetRandomAvailableUDPPort": utils.GetRandomAvailableUDPPort,
	"IsRemoteTCPPortOpen": func(host string, p int) bool {
		return utils.IsTCPPortOpen(host, p)
	},

	"GetMachineID": utils.GetMachineCode,

	"Remove":       os.Remove,
	"RemoveAll":    os.RemoveAll,
	"Rename":       os.Rename,
	"TempDir":      os.TempDir,
	"Getwd":        os.Getwd,
	"Getpid":       os.Getpid,
	"Getppid":      os.Getppid,
	"Getuid":       os.Getuid,
	"Geteuid":      os.Geteuid,
	"Getgid":       os.Getgid,
	"Getegid":      os.Getegid,
	"Environ":      os.Environ,
	"Hostname":     os.Hostname,
	"Unsetenv":     os.Unsetenv,
	"LookupEnv":    os.LookupEnv,
	"Clearenv":     os.Clearenv,
	"Setenv":       os.Setenv,
	"Getenv":       os.Getenv,
	"Exit":         os.Exit,
	"Args":         os.Args,
	"Stdout":       os.Stdout,
	"Stdin":        os.Stdin,
	"Stderr":       os.Stderr,
	"Executable":   os.Executable,
	"ExpandEnv":    os.ExpandEnv,
	"Pipe":         os.Pipe,
	"Chdir":        os.Chdir,
	"Chmod":        os.Chmod,
	"Chown":        os.Chown,
	"OS":           runtime.GOOS,
	"ARCH":         runtime.GOARCH,
	"IsPrivileged": privileged.GetIsPrivileged(),
	"GetDefaultDNSServers": func() []string {
		return netx.NewDefaultReliableDNSConfig().SpecificDNSServers
	},
	"WaitConnect": utils.WaitConnect,
}
View Source
var TcpExports = map[string]interface{}{
	"MockServe": utils.DebugMockHTTP,
	"Connect":   _tcpConnect,

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

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

	"Forward": _tcpPortForward,
}
View Source
var TimeExports = map[string]interface{}{
	"Now":              time.Now,
	"now":              time.Now,
	"GetCurrentMonday": utils.GetCurrentWeekMonday,
	"GetCurrentDate":   utils.GetCurrentDate,
	"sleep":            sleep,
	"Sleep":            sleep,
	"Parse":            time.Parse,
	"ParseDuration":    time.ParseDuration,
	"Unix":             time.Unix,
	"After": func(i float64) <-chan time.Time {
		return time.After(utils.FloatSecondDuration(i))
	},
	"AfterFunc": time.AfterFunc,
	"NewTimer": func(i float64) *time.Timer {
		return time.NewTimer(utils.FloatSecondDuration(i))
	},
	"NewTicker": func(i float64) *time.Ticker {
		return time.NewTicker(utils.FloatSecondDuration(i))
	},
	"Until": time.Until,
	"Since": time.Since,
}
View Source
var TimeZoneExports = map[string]interface{}{
	"Get": time.LoadLocation,
	"Now": func(i string) time.Time {
		loc, err := time.LoadLocation(i)
		if err != nil {
			return time.Now()
		}
		return time.Now().In(loc)
	},
}
View Source
var TlsExports = map[string]interface{}{
	"GenerateRSAKeyPair":     tlsutils.RSAGenerateKeyPair,
	"GenerateRSA1024KeyPair": rsaWithBitSize(1024),
	"GenerateRSA2048KeyPair": rsaWithBitSize(2048),
	"GenerateRSA4096KeyPair": rsaWithBitSize(4096),
	"GenerateSM2KeyPair":     tlsutils.SM2GenerateKeyPair,
	"GenerateRootCA": func(commonName string) (ca []byte, key []byte, _ error) {
		return tlsutils.GenerateSelfSignedCertKeyWithCommonName(commonName, "", nil, nil)
	},
	"SignX509ServerCertAndKey": tlsutils.SignServerCrtNKey,
	"SignX509ClientCertAndKey": tlsutils.SignClientCrtNKey,
	"SignServerCertAndKey": func(ca []byte, key []byte) (cert []byte, sKey []byte, _ error) {
		return tlsutils.SignServerCrtNKeyWithParams(ca, key, "Server", time.Now().Add(time.Hour*24*365*99), false)
	},
	"SignClientCertAndKey": func(ca []byte, key []byte) (cert []byte, sKey []byte, _ error) {
		return tlsutils.SignClientCrtNKeyWithParams(ca, key, "Server", time.Now().Add(time.Hour*24*365*99), false)
	},
	"Inspect":             tlsutils.TLSInspect,
	"EncryptWithPkcs1v15": tlsutils.PemPkcs1v15Encrypt,
	"DecryptWithPkcs1v15": tlsutils.PemPkcs1v15Decrypt,
}
View Source
var UDPExport = map[string]interface{}{
	"MockUDPProtocol": DebugMockUDPProtocol,
	"Connect":         connectUdp,
	"clientTimeout":   clientTimeout,
	"clientLocalAddr": clientLocalAddr,

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

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

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

	"Info":          yakitInfo(emptyVirtualClient),
	"Warn":          yakitWarn(emptyVirtualClient),
	"Error":         yakitError(emptyVirtualClient),
	"Text":          yakitError(emptyVirtualClient),
	"Markdown":      yakitMarkdown(emptyVirtualClient),
	"Report":        yakitReport(emptyVirtualClient),
	"File":          yakitFile(emptyVirtualClient),
	"Output":        yakitOutput(emptyVirtualClient),
	"SetProgress":   yakitSetProgress(emptyVirtualClient),
	"SetProgressEx": yakitSetProgressEx(emptyVirtualClient),
}
View Source
var YamlExports = map[string]interface{}{
	"Marshal": yaml.Marshal,
	"Unmarshal": func(b []byte) (interface{}, error) {
		var i interface{}
		err := yaml.Unmarshal(b, &i)
		if err != nil {
			return nil, err
		}
		return i, nil
	},
	"UnmarshalStrict": func(b []byte) (interface{}, error) {
		var i interface{}
		err := yaml.UnmarshalStrict(b, &i)
		if err != nil {
			return nil, err
		}
		return i, nil
	},
}
View Source
var ZipExports = map[string]interface{}{
	"Decompress": ziputil.DeCompress,
	"Compress": func(zipName string, filenames ...string) error {
		return ziputil.CompressByName(filenames, zipName)
	},
}

Functions

func BuildTlsConfig

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

func CreateYakLogger

func CreateYakLogger(yakFile string) *yakLogger

func CsrfOptWithHTTPS added in v1.2.4

func CsrfOptWithHTTPS(b bool) csrfConfig

func CsrfOptWithMultipartDefaultValue added in v1.2.4

func CsrfOptWithMultipartDefaultValue(b bool) csrfConfig

func DebugMockUDP added in v1.2.3

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

func DebugMockUDPFromScan added in v1.2.3

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

func DebugMockUDPProtocol added in v1.2.3

func DebugMockUDPProtocol(name string) (string, int)

func DebugMockUDPWithTimeout added in v1.2.3

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

func DownloadMMDB

func DownloadMMDB() error

func DownloadOnlineAuthProxy

func DownloadOnlineAuthProxy(baseUrl string) error

func Escape added in v1.2.4

func Escape(s []byte) string

func GenerateCSRFPoc

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

func GetExtYakitLibByClient

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

func InitYakit added in v1.2.2

func InitYakit(y *YakitClient)

func InjectCliArgs added in v1.2.6

func InjectCliArgs(args []string)

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{}

func JsonStreamToMapListWithDepth

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

func JsonToMap

func JsonToMap(line string) map[string]string

func JsonToMapList

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

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 MarshalYakitOutput

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

func NewDefaultPoCConfig added in v1.2.2

func NewDefaultPoCConfig() *_pocConfig

func NewPortFromMatchResult

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

func NewPortFromSpaceEngineResult

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

func NewPortFromSynScanResult

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

func NewSizedWaitGroup added in v1.2.3

func NewSizedWaitGroup(size int) *utils.SizedWaitGroup

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, keyValue, defaultValue string) string

func QueryIP

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

func QueryIPForISP

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

func RawHandlerToExecOutput added in v1.2.2

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

func RegexpMatchEmail

func RegexpMatchEmail(i interface{}) []string

func RegexpMatchHostPort

func RegexpMatchHostPort(i interface{}) []string

HOSTPORT

func RegexpMatchIP

func RegexpMatchIP(i interface{}) []string

func RegexpMatchIPv4

func RegexpMatchIPv4(i interface{}) []string

func RegexpMatchIPv6

func RegexpMatchIPv6(i interface{}) []string

func RegexpMatchMac

func RegexpMatchMac(i interface{}) []string

func RegexpMatchPathParam

func RegexpMatchPathParam(i interface{}) []string

PATHPARAM

func RegexpMatchTTY

func RegexpMatchTTY(i interface{}) []string

TTY

func RegexpMatchURL

func RegexpMatchURL(i interface{}) []string

URL

func SetEngineClient added in v1.2.2

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

func SetEngineInterface added in v1.2.6

func SetEngineInterface(engine IEngine)

func SetYakitServer_LogHandler

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

func SetYakitServer_ProgressHandler

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

func YakitInfo

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

func YakitMessageGenerator

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

Types

type CustomDNSLog added in v1.2.6

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

func NewCustomDNSLog added in v1.2.6

func NewCustomDNSLog(opts ..._dnslogConfigOpt) *CustomDNSLog

func (*CustomDNSLog) CheckDNSLogByToken added in v1.2.6

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

func (*CustomDNSLog) GetSubDomainAndToken added in v1.2.6

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

type GrokResult

type GrokResult map[string][]string

func Grok

func Grok(line string, rule string) GrokResult

func GrokWithMultiPattern

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

func (GrokResult) Get

func (g GrokResult) Get(key string) string

func (GrokResult) GetAll

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

func (GrokResult) GetOr

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

type HttpFlowShare added in v1.2.2

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

type HttpFlowShareRequest added in v1.2.2

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

type IEngine added in v1.2.6

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

type OnlineClient

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

func NewOnlineClient

func NewOnlineClient(baseUrl string) *OnlineClient

func (*OnlineClient) DownloadYakitPluginAll

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

func (*OnlineClient) DownloadYakitPluginAllWithToken

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

func (*OnlineClient) DownloadYakitPluginById

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

func (*OnlineClient) DownloadYakitPluginByIdWithToken

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

func (*OnlineClient) DownloadYakitPluginIDWithToken

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

func (*OnlineClient) DownloadYakitPluginWithTokenBindMe

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

func (*OnlineClient) DownloadYakitPluginsEx

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

func (*OnlineClient) DownloadYakitScriptName

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

func (*OnlineClient) HttpFlowShare added in v1.2.2

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

func (*OnlineClient) HttpFlowShareWithToken added in v1.2.2

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

func (*OnlineClient) Save

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

func (*OnlineClient) UploadRiskToOnline

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

func (*OnlineClient) UploadRiskToOnlineWithToken

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

func (*OnlineClient) UploadScreenRecordersToOnline added in v1.2.2

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

func (*OnlineClient) UploadScreenRecordersWithToken added in v1.2.2

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

type OnlineDownloadStream

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

type OnlinePaging

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

type OnlinePlugin

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

type OnlinePluginItem

type OnlinePluginItem struct {
	Plugin *OnlinePlugin
	Total  int64
}

type OnlinePluginParam

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

type PocConfig

type PocConfig func(c *_pocConfig)

type ProtobufRecord

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

protobuf

func (*ProtobufRecord) String

func (r *ProtobufRecord) String() string

func (*ProtobufRecord) ToBytes

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

type ProtobufRecords

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

func (*ProtobufRecords) Error

func (r *ProtobufRecords) Error() error

func (*ProtobufRecords) Find

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

utils

func (*ProtobufRecords) FuzzEveryIndex

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

func (*ProtobufRecords) FuzzIndex

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

func (*ProtobufRecords) MarshalJSON

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

marshal / unmarshal

func (*ProtobufRecords) MarshalYAML

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

func (*ProtobufRecords) String

func (r *ProtobufRecords) String() string

protobuf convert

func (*ProtobufRecords) ToBytes

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

func (*ProtobufRecords) ToHex

func (r *ProtobufRecords) ToHex() string

func (*ProtobufRecords) ToJSON

func (r *ProtobufRecords) ToJSON() string

func (*ProtobufRecords) ToYAML

func (r *ProtobufRecords) ToYAML() string

func (*ProtobufRecords) UnmarshalJSON

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

func (*ProtobufRecords) UnmarshalYAML

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

type QueryOnlinePluginRequest

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

type QueryUploadRiskOnlineRequest

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

type RegisterOutputFuncType

type RegisterOutputFuncType func(tag string, cb _outputCallback)

type ScreenRecordersUploadToOnlineRequest added in v1.2.2

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

type StringMap added in v1.2.4

type StringMap map[string]interface{}

func (StringMap) MarshalXML added in v1.2.4

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

func (*StringMap) UnmarshalXML added in v1.2.4

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

type TagAndTypeValue

type TagAndTypeValue struct {
	Value string
	Count int
}

type TagStat

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

func NewTagStat

func NewTagStat() (*TagStat, error)

func (*TagStat) All

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

func (*TagStat) ForceUpdate

func (t *TagStat) ForceUpdate() error

func (*TagStat) GetCount

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

func (*TagStat) TopN

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

type TagValue

type TagValue struct {
	Name  string
	Count int
}

type UnregisterOutputFuncType

type UnregisterOutputFuncType func(tag string)

type WaitGroupProxy added in v1.2.3

type WaitGroupProxy struct {
	*sync.WaitGroup
}

func NewWaitGroup added in v1.2.3

func NewWaitGroup() *WaitGroupProxy

func (*WaitGroupProxy) Add added in v1.2.3

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

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 YakitMessageHandleFunc) *YakitClient

func NewVirtualYakitClientWithExecResult added in v1.2.2

func NewVirtualYakitClientWithExecResult(h func(result *ypb.ExecResult) error) *YakitClient

func NewYakitClient

func NewYakitClient(addr string) *YakitClient

func (*YakitClient) Error

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

func (*YakitClient) Info

func (c *YakitClient) Info(info string, items ...interface{}) error

func (*YakitClient) Output

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

func (*YakitClient) OutputLog

func (c *YakitClient) OutputLog(level string, info string, items ...interface{}) error

输入

func (*YakitClient) Save

func (c *YakitClient) Save(t interface{}) error

func (*YakitClient) SendRaw

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

func (*YakitClient) SetProgress

func (c *YakitClient) SetProgress(id string, progress float64) error

func (*YakitClient) Warn

func (c *YakitClient) Warn(info string, items ...interface{}) error

type YakitFeature

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

type YakitFixedTableData

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

type YakitGraph

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

设置基本图形

func NewBarGraph

func NewBarGraph() *YakitGraph

func NewLineGraph

func NewLineGraph() *YakitGraph

func NewPieGraph

func NewPieGraph() *YakitGraph

func NewWordCloud

func NewWordCloud() *YakitGraph

func (*YakitGraph) Add

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

type YakitHTTPFlowRisk

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

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

mitm risk

func NewHTTPFlowRisk

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

func (*YakitHTTPFlowRisk) SetFragment

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

func (*YakitHTTPFlowRisk) SetLevel

func (y *YakitHTTPFlowRisk) SetLevel(l string)

type YakitLog

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

type YakitMessage

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

type YakitMessageHandleFunc

type YakitMessageHandleFunc func(i interface{}) error

type YakitProgress

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

type YakitServer

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

func NewYakitServer

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

func (*YakitServer) Addr

func (s *YakitServer) Addr() string

func (*YakitServer) Shutdown

func (s *YakitServer) Shutdown()

func (*YakitServer) Start

func (s *YakitServer) Start()

type YakitStatusCard

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

type YakitTable

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

yaktable

func NewTable

func NewTable(head ...string) *YakitTable

func (*YakitTable) Append

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

func (*YakitTable) SetHead

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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