Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(x float64) float64
- func BuildTlsConfig(crt, key interface{}, cas ...interface{}) *tls.Config
- func Ceil(x float64) float64
- func Chdir(dir string) error
- func Chmod(name string, mode os.FileMode) error
- func Chown(name string, uid, gid int) error
- func Clearenv()
- func Compare(a string, b string) int
- func Contains(s string, substr string) bool
- func ContainsAny(s string, chars string) bool
- func Count(s string, substr string) int
- func CsrfOptWithHTTPS(b bool) csrfConfig
- func CsrfOptWithMultipartDefaultValue(b bool) csrfConfig
- func DebugMockTCPFromScan(du time.Duration, responses map[string][][]byte) (string, int)
- func DebugMockTCPProtocol(name string) (string, int)
- func DebugMockUDP(rsp []byte) (string, int)
- func DebugMockUDPFromScan(du time.Duration, responses map[string][][]byte) (string, int)
- func DebugMockUDPProtocol(name string) (string, int)
- func DebugMockUDPWithTimeout(du time.Duration, rsp []byte) (string, int)
- func DownloadMMDB() error
- func DownloadOnlineAuthProxy(baseUrl string) error
- func EndsWith(s string, suffix string) bool
- func Environ() []string
- func EqualFold(s string, t string) bool
- func Executable() (string, error)
- func Exit(code int)
- func ExpandEnv(s string) string
- func Fields(s string) []string
- func Floor(x float64) float64
- func GenerateCSRFPoc(raw interface{}, opts ...csrfConfig) (string, error)
- func GetDefaultDNSServers() []string
- func GetExtYakitLibByClient(client *YakitClient) map[string]interface{}
- func GetExtYakitLibByOutput(Output func(d any) error) map[string]interface{}
- func GetLocalAddress() []string
- func GetLocalIPv4Address() []string
- func GetLocalIPv6Address() []string
- func GetMachineID() string
- func GetRandomAvailableTCPPort() int
- func GetRandomAvailableUDPPort() int
- func GetStatementType(st interface{}) string
- func Getegid() int
- func Getenv(key string) string
- func Geteuid() int
- func Getgid() int
- func Getpid() int
- func Getppid() int
- func Getuid() int
- func Getwd() (string, error)
- func Hostname() (name string, err error)
- func Index(s string, substr string) int
- func IndexAny(s string, chars string) int
- func IndexByte(s string, c byte) int
- func InitYakit(y *YakitClient)
- func IsNaN(x float64) bool
- func IsRemoteTCPPortOpen(host string, p int) bool
- func IsTCPPortAvailable(p int) bool
- func IsTCPPortOpen(p int) bool
- func IsUDPPortAvailable(p int) bool
- func IsUDPPortOpen(p int) bool
- func Join(i interface{}, d interface{}) (defaultResult string)
- func JsonRawByteToMap(jbyte json.RawMessage) (map[string]interface{}, error)
- func JsonStrToVarList(jstr string) ([]interface{}, error)
- func JsonStreamToMapList(reader io.Reader) []map[string]interface{}
- func JsonStreamToMapListWithDepth(reader io.Reader, i int) []map[string]interface{}
- func JsonToMap(line string) map[string]string
- func JsonToMapList(line string) []map[string]string
- func JsonbToMap(jb postgres.Jsonb) (map[string]interface{}, error)
- func JsonbToString(jb postgres.Jsonb) (string, error)
- func JsonbToVarList(jb postgres.Jsonb) ([]interface{}, error)
- func LastIndex(s string, substr string) int
- func LastIndexAny(s string, chars string) int
- func LastIndexByte(s string, c byte) int
- func LookupEnv(key string) (string, bool)
- func MarshalYakitOutput(t interface{}) (string, string)
- func NaN() float64
- func NewCond() *sync.Cond
- func NewJsonConfig() *jsonConfig
- func NewLock() *sync.Mutex
- func NewMap() *sync.Map
- func NewMutex() *sync.Mutex
- func NewOnce() *sync.Once
- func NewPool(newFunc ...func() any) *sync.Pool
- func NewPortFromMatchResult(f *fp.MatchResult) *schema.Port
- func NewPortFromSpaceEngineResult(f *base.NetSpaceEngineResult) *schema.Port
- func NewPortFromSynScanResult(f *synscan.SynScanResult) *schema.Port
- func NewRWMutex() *sync.RWMutex
- func NewReader(s string) *strings.Reader
- func NewSizedWaitGroup(size int, ctxs ...context.Context) *utils.SizedWaitGroup
- func NewYakitLogExecResult(level string, data string, items ...interface{}) *ypb.ExecResult
- func NewYakitProgressExecResult(id string, progress float64) *ypb.ExecResult
- func NewYakitStatusCardExecResult(status, data string, items ...string) *ypb.ExecResult
- func ParamsGetOr(i map[string]string, key, defaultValue string) string
- func Pipe() (r *os.File, w *os.File, err error)
- func Pow(x, y float64) float64
- func Pow10(n int) float64
- func Query(filter string, opts ..._spaceEngineConfigOpt) (chan *base.NetSpaceEngineResult, error)
- func QueryIP(ip string) (*geo.City, error)
- func QueryIPForISP(ip string) (*geo.ISP, error)
- func RawHandlerToExecOutput(h func(any) error) func(result *ypb.ExecResult) error
- func RegexpMatchEmail(i interface{}) []string
- func RegexpMatchHostPort(i interface{}) []string
- func RegexpMatchIP(i interface{}) []string
- func RegexpMatchIPv4(i interface{}) []string
- func RegexpMatchIPv6(i interface{}) []string
- func RegexpMatchMac(i interface{}) []string
- func RegexpMatchPathParam(i interface{}) []string
- func RegexpMatchTTY(i interface{}) []string
- func RegexpMatchURL(i interface{}) []string
- func Remove(name string) error
- func RemoveAll(name string) error
- func Rename(oldpath, newpath string) error
- func Repeat(s string, count int) string
- func Replace(s string, old string, new string, n int) string
- func ReplaceAll(s string, old string, new string) string
- func Round(x float64) float64
- func RoundToEven(x float64) float64
- func SetEngineClient(e *antlr4yak.Engine, client *YakitClient)
- func SetEngineInterface(engine IEngine)
- func SetYakitServer_LogHandler(h func(level string, info string)) func(s *YakitServer)
- func SetYakitServer_ProgressHandler(h func(id string, progress float64)) func(s *YakitServer)
- func Setenv(key, value string) error
- func Split(s string, sep string) []string
- func SplitAfter(s string, sep string) []string
- func SplitAfterN(s string, sep string, n int) []string
- func SplitN(s string, sep string, n int) []string
- func Sqrt(x float64) float64
- func StartsWith(s string, prefix string) bool
- func TempDir() string
- func Title(s string) string
- func ToLower(s string) string
- func ToTitle(s string) string
- func ToUpper(s string) string
- func ToValidUTF8(s string, replacement string) string
- func Trim(s string, cutset string) string
- func TrimLeft(s string, cutset string) string
- func TrimPrefix(s string, prefix string) string
- func TrimRight(s string, cutset string) string
- func TrimSpace(s string) string
- func TrimSuffix(s string, suffix string) string
- func Unsetenv(key string) error
- func WaitConnect(addr string, timeout float64) error
- func YakitMessageGenerator(i interface{}) ([]byte, error)
- func YakitNewAliveHost(target string, opts ...yakit.AliveHostParamsOpt)
- func YakitNewRiskBuilder(client *YakitClient) func(target string, opts ...yakit.RiskParamsOpt)
- func YakitOutputToExecResult(i interface{}) *ypb.ExecResult
- func YieldPayload(raw any, extra ...any) chan string
- type CustomDNSLog
- type DownloadOnlinePluginRequest
- type GrokResult
- type HttpFlowShare
- type HttpFlowShareRequest
- type HttpServerConfigOpt
- type IEngine
- type JsRunConfig
- type JsonOpt
- type MitmConfigOpt
- type OnlineClient
- func (s *OnlineClient) DownloadNewOnlinePlugins(ctx context.Context, token string, isPrivate []bool, keywords string, ...) *OnlineDownloadStream
- func (s *OnlineClient) DownloadOnlinePluginByPluginName(ctx context.Context, token string, scriptName []string) *OnlineDownloadStream
- func (s *OnlineClient) DownloadOnlinePluginByUUID(token, uuid string) (*OnlinePlugin, error)
- func (s *OnlineClient) DownloadOnlinePluginsBatch(ctx context.Context, token string, isPrivate []bool, keywords string, ...) *OnlineDownloadStream
- func (s *OnlineClient) DownloadYakitPluginAll(ctx context.Context) *OnlineDownloadStream
- func (s *OnlineClient) DownloadYakitPluginAllWithToken(ctx context.Context, token string, keywords string, pluginType string, ...) *OnlineDownloadStream
- func (s *OnlineClient) DownloadYakitPluginById(id string, token string) (*OnlinePlugin, error)
- func (s *OnlineClient) DownloadYakitPluginByIdWithToken(id string, token string) (*OnlinePlugin, error)
- func (s *OnlineClient) DownloadYakitPluginIDWithToken(ctx context.Context, token string, ids ...string) *OnlineDownloadStream
- func (s *OnlineClient) DownloadYakitPluginWithTokenBindMe(ctx context.Context, token string, keywords string, pluginType string, ...) *OnlineDownloadStream
- func (s *OnlineClient) DownloadYakitPluginsEx(ctx context.Context, all bool, ids []string, userToken string, bindMe bool, ...) *OnlineDownloadStream
- func (s *OnlineClient) DownloadYakitScriptName(ctx context.Context, token string, scriptName ...string) *OnlineDownloadStream
- func (s *OnlineClient) HttpFlowShare(ctx context.Context, token string, expiredTime int64, module string, ...) (*HttpFlowShare, error)
- func (s *OnlineClient) HttpFlowShareWithToken(ctx context.Context, token string, expiredTime int64, module string, ...) (*HttpFlowShare, error)
- func (s *OnlineClient) Save(db *gorm.DB, plugins ...*OnlinePlugin) error
- func (s *OnlineClient) SaveToOnline(ctx context.Context, req *ypb.SaveYakScriptToOnlineRequest, ...) error
- func (s *OnlineClient) SaveYakScriptToOnline(ctx context.Context, token string, scriptName string, ...) error
- func (s *OnlineClient) UploadHTTPFlowToOnline(ctx context.Context, token, projectName string, content []byte) error
- func (s *OnlineClient) UploadRiskToOnline(ctx context.Context, token string, projectName string, content []byte) error
- func (s *OnlineClient) UploadRiskToOnlineWithToken(ctx context.Context, req *ypb.UploadRiskToOnlineRequest, risk []byte) error
- func (s *OnlineClient) UploadScreenRecordersToOnline(ctx context.Context, token string, file os.File, noteInfo string, ...) error
- func (s *OnlineClient) UploadScreenRecordersWithToken(ctx context.Context, token string, file os.File, ...) error
- type OnlineCollaboratorInfo
- type OnlineDownloadStream
- type OnlinePaging
- type OnlinePlugin
- type OnlinePluginItem
- type OnlinePluginParam
- type OnlineRiskDetail
- type ProtobufRecord
- type ProtobufRecords
- func (r *ProtobufRecords) Error() error
- func (r *ProtobufRecords) Find(index int) []*ProtobufRecord
- func (r *ProtobufRecords) FuzzEveryIndex(callback func(index int, typ string, data interface{}) interface{}) ([][]byte, error)
- func (r *ProtobufRecords) FuzzIndex(index int, callback func(index int, typ string, data interface{}) interface{}) ([][]byte, error)
- func (r *ProtobufRecords) MarshalJSON() ([]byte, error)
- func (r *ProtobufRecords) MarshalYAML() (interface{}, error)
- func (r *ProtobufRecords) String() string
- func (r *ProtobufRecords) ToBytes() []byte
- func (r *ProtobufRecords) ToHex() string
- func (r *ProtobufRecords) ToJSON() string
- func (r *ProtobufRecords) ToYAML() string
- func (r *ProtobufRecords) UnmarshalJSON(data []byte) error
- func (r *ProtobufRecords) UnmarshalYAML(node *yaml.Node) error
- type QueryHTTPFlowOnlineRequest
- type QueryOnlinePluginRequest
- type QueryUploadRiskOnlineRequest
- type RegisterOutputFuncType
- type SaveYakScriptOnlineRequest
- type ScreenRecordersUploadToOnlineRequest
- type StdPrinter
- type TagAndTypeValue
- type TagStat
- type TagValue
- type TcpServerConfigOpt
- type UdpServerOpt
- type UnregisterOutputFuncType
- type WaitGroupProxy
- type YakLogger
- type YakitClient
- func AutoInitYakit() *YakitClient
- func GetYakitClientInstance() *YakitClient
- func NewVirtualYakitClient(h func(i *ypb.ExecResult) error) *YakitClient
- func NewVirtualYakitClientWithRiskCount(h func(i *ypb.ExecResult) error, riskCounter *uint32) *YakitClient
- func NewYakitClient(addr string) *YakitClient
- func (c *YakitClient) AddCounter() uint32
- func (c *YakitClient) Output(i interface{}) error
- func (c *YakitClient) SendRaw(y *YakitLog) error
- func (c *YakitClient) SetYakLog(logger *YakLogger)
- func (c *YakitClient) Stream(streamType string, streamId string, stream io.Reader, extra ...any)
- func (c *YakitClient) YakitDebug(tmp string, items ...interface{})
- func (c *YakitClient) YakitDraw(level string, data interface{})
- func (c *YakitClient) YakitError(tmp string, items ...interface{})
- func (c *YakitClient) YakitFile(fileName string, desc ...interface{})
- func (c *YakitClient) YakitInfo(tmp string, items ...interface{})
- func (c *YakitClient) YakitLog(level string, tmp string, items ...interface{}) error
- func (c *YakitClient) YakitMarkdown(tmp interface{})
- func (c *YakitClient) YakitReport(i int)
- func (c *YakitClient) YakitSetProgress(f float64)
- func (c *YakitClient) YakitSetProgressEx(id string, f float64)
- func (c *YakitClient) YakitTextBlock(tmp interface{})
- func (c *YakitClient) YakitWarn(tmp string, items ...interface{})
- type YakitFeature
- type YakitFixedTableData
- type YakitGraph
- type YakitHTTPFlowRisk
- type YakitLog
- type YakitMessage
- type YakitProgress
- type YakitServer
- type YakitStatusCard
- type YakitTable
- type YakitTextTabData
Constants ¶
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" )
const YAKIT_TAG_STATS = "YAKIT_TAG_STATS"
Variables ¶
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) )
var ( HTTPServer_Serve = _httpServe HTTPServer_ServeOpt_Context = _httpServerOptContext HTTPServer_ServeOpt_Callback = _httpServerOptCallback )
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]+))`) )
var ARCH = runtime.GOARCH
ARCH 当前操作系统的运行架构:它的值可能是386、amd64、arm、s390x等
var BotExports = map[string]interface{}{ "New": bot.New, "FromEnv": bot.FromEnv, "webhook": bot.WithWebhook, "webhookWithSecret": bot.WithWebhookWithSecret, "workwx": bot.WithWebhook, "ding": bot.WithWebhookWithSecret, }
var BufioExport = map[string]interface{}{
"NewBuffer": _newBuffer,
"NewReader": _newReader,
"NewReaderSize": _newReaderSize,
"NewWriter": _newWriter,
"NewWriterSize": _newWriterSize,
"NewReadWriter": _newReadWriter,
"NewScanner": _newScanner,
}
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 =
var CSRFExports = map[string]interface{}{ "Generate": GenerateCSRFPoc, "multipartDefaultValue": CsrfOptWithMultipartDefaultValue, "https": CsrfOptWithHTTPS, }
var CliExports = cli.CliExports
var CodecExports = map[string]interface{}{}/* 125 elements not displayed */
var ContextExports = map[string]interface{}{
"Seconds": _seconds,
"New": _newContext,
"Background": _background,
"WithCancel": _withCancel,
"WithTimeout": _withTimeout,
"WithTimeoutSeconds": _withTimeoutSeconds,
"WithDeadline": _withDeadline,
"WithValue": _withValue,
}
var DNSLogExports = map[string]interface{}{ "NewCustomDNSLog": NewCustomDNSLog, "QueryCustomScript": queryCustomScript, "LookupFirst": netx.LookupFirst, "random": randomDNSLogPlatforms, "mode": setMode, "local": setLocal, "script": setScript, }
var DatabaseExports = map[string]interface{}{ "DownloadGeoIP": DownloadMMDB, "QueryIPCity": QueryIP, "QueryIPForIPS": QueryIPForISP, "SaveHTTPFlowFromRaw": saveHTTPFlowFromRaw, "SaveHTTPFlowFromRawWithType": saveHTTPFlowFromRawWithType, "SaveHTTPFlowFromNative": saveCrawler, "SaveHTTPFlowFromNativeWithType": saveHTTPFlowWithType, "SaveHTTPFlowFromRawWithOption": saveHTTPFlowFromRawWithOption, "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, "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, }
var DictUtilExports = map[string]interface{}{
"Mix": _dictMix,
}
var Discard = ioutil.Discard
Discard 是一个 writer,它将所有写入的数据都丢弃掉
var DnsExports = map[string]interface{}{
"QueryIP": _dnsQueryIP,
"QueryIPAll": _dnsQueryIPAll,
"QueryNS": _dnsQueryNS,
"QueryTXT": _dnsQueryTxt,
"QuertAxfr": _dnsQueryAxfr,
"timeout": _dnsConfigOpt_WithTimeout,
"dnsServers": _dnsConfigOpt_WithDNSServers,
}
var EOF = io.EOF
EOF 是一个错误,表示读取到了 EOF
var EmptyBytesSlice = make([][]byte, 0)
var EnvExports = map[string]interface{}{
"Get": _getEnv,
"Set": _setEnv,
}
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, }
系统命令执行导出接口
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, }
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) }, }
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, }
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 }, }
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,
}
var GrokExports = map[string]interface{}{ "ExtractIPv4": RegexpMatchIPv4, "ExtractIPv6": RegexpMatchIPv6, "ExtractIP": RegexpMatchIP, "ExtractEmail": RegexpMatchEmail, "ExtractPath": RegexpMatchPathParam, "ExtractTTY": RegexpMatchTTY, "ExtractURL": RegexpMatchURL, "ExtractHostPort": RegexpMatchHostPort, "ExtractMac": RegexpMatchMac, }
var GzipExports = map[string]interface{}{ "Compress": utils.GzipCompress, "Decompress": utils.GzipDeCompress, "IsGzip": utils.IsGzip, }
var HttpExports = yakhttp.HttpExports
var HttpPoolExports = mutate.HttpPoolExports
var HttpServeExports = map[string]interface{}{
"Serve": _httpServe,
"tlsCertAndKey": _httpServerOptCaAndKey,
"context": _httpServerOptContext,
"handler": _httpServerOptCallback,
"LocalFileSystemServe": _localFileSystemServe,
}
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, }
var IsPrivileged = privileged.GetIsPrivileged()
IsPrivileged 当前是否是特权模式
var JSOttoExports = map[string]interface{}{ "PoweredBy": "github.com/dop251/goja", "New": _jsNewEngine, "Run": _run, "CallFunctionFromCode": _jsCallFuncFromCode, "libCryptoJSV3": _libCryptoJSV3, "libCryptoJSV4": _libCryptoJSV4, "libJSRSASign": _libJSRSASign, "libJsEncrypt": _libJsEncrypt, "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), }
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, }
var LdapExports = map[string]interface{}{
"Login": _login,
"port": optLdap_Port,
"username": optLdap_Username,
"password": optLdap_Password,
}
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, }
var MathExport = map[string]interface{}{ "Round": Round, "Sqrt": Sqrt, "Pow": Pow, "Pow10": Pow10, "Floor": Floor, "Ceil": Ceil, "RoundToEven": RoundToEven, "Abs": Abs, "NaN": NaN, "IsNaN": IsNaN, "Pi": math.Pi, "Ln10": math.Ln10, "Ln2": math.Ln2, "E": math.E, "Sqrt2": math.Sqrt2, "SqrtPi": math.SqrtPi, "SqrtE": math.SqrtE, }
var MitmConfigContext = mitmConfigContext
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,
}
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 }, }
var OS = runtime.GOOS
OS 当前操作系统名
var OrderedMapExports = map[string]interface{}{ "New": orderedmap.New, }
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,
}
var PoCExports = poc.PoCExports
var RdpExports = map[string]interface{}{ "Login": bruteutils.RDPLogin, "Version": extrafp.RDPVersion, }
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,
}
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, }
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, }
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, }
var ( RiskExports = map[string]interface{}{ "CreateRisk": yakit.CreateRisk, "Save": yakit.SaveRisk, "NewRisk": YakitNewRiskBuilder(GetYakitClientInstance()), "RegisterBeforeRiskSave": yakit.RegisterBeforeRiskSave, "YieldRiskByTarget": func(target string) chan *schema.Risk { return yakit.YieldRisksByTarget(consts.GetGormProjectDatabase(), context.Background(), target) }, "YieldRiskByRuntimeId": func(runtimeId string) chan *schema.Risk { return yakit.YieldRisksByRuntimeId(consts.GetGormProjectDatabase(), context.Background(), runtimeId) }, "YieldRiskByCreateAt": func(timestamp int64) chan *schema.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, "NewHTTPLog": yakit.NewHTTPLog, "CheckDNSLogByToken": yakit.CheckDNSLogByToken, "CheckHTTPLogByToken": yakit.CheckHTTPLogByToken, "CheckRandomTriggerByToken": yakit.CheckRandomTriggerByToken, "CheckICMPTriggerByLength": yakit.CheckICMPTriggerByLength, "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, } )
var SEP = string(filepath.Separator)
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,
}
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, }
var Stderr = os.Stderr
Stderr 标准错误
var Stdin = os.Stdin
Stdin 标准输入
var Stdout = os.Stdout
Stdout 标准输出
var StringsExport = map[string]interface{}{}/* 120 elements not displayed */
var SyncExport = map[string]interface{}{ "NewWaitGroup": NewWaitGroup, "NewSizedWaitGroup": NewSizedWaitGroup, "NewMutex": NewMutex, "NewLock": NewLock, "NewMap": NewMap, "NewOnce": NewOnce, "NewRWMutex": NewRWMutex, "NewPool": NewPool, "NewCond": NewCond, }
var SystemExports = map[string]interface{}{ "IsTCPPortOpen": IsTCPPortOpen, "IsUDPPortOpen": IsUDPPortOpen, "LookupHost": lookupHost, "LookupIP": lookupIP, "IsTCPPortAvailable": IsTCPPortAvailable, "IsUDPPortAvailable": IsUDPPortAvailable, "GetRandomAvailableTCPPort": GetRandomAvailableTCPPort, "GetRandomAvailableUDPPort": GetRandomAvailableUDPPort, "IsRemoteTCPPortOpen": IsRemoteTCPPortOpen, "GetMachineID": GetMachineID, "Remove": Remove, "RemoveAll": RemoveAll, "Rename": Rename, "TempDir": TempDir, "Getwd": Getwd, "Getpid": Getpid, "Getppid": Getppid, "Getuid": Getuid, "Geteuid": Geteuid, "Getgid": Getgid, "Getegid": Getegid, "Environ": Environ, "Hostname": Hostname, "Unsetenv": Unsetenv, "LookupEnv": LookupEnv, "Clearenv": Clearenv, "Setenv": Setenv, "Getenv": Getenv, "Exit": Exit, "Args": 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, }
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, }
var Tcp_Server_Callback = _tcpServeCallback
var Tcp_Server_Context = _tcpServeContext
var Tcp_Server_Tls = _tcpServerTls
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,
}
var TimeZoneExports = map[string]interface{}{
"Get": _timezoneLoadLocation,
"Now": _timezoneNow,
}
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, }
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, }
var UDPExport = map[string]interface{}{ "MockUDPProtocol": DebugMockUDPProtocol, "Connect": connectUdp, "clientTimeout": clientTimeout, "clientLocalAddr": clientLocalAddr, "Serve": udpServe, "serverTimeout": UdpWithTimeout, "serverContext": UdpWithContext, "serverCallback": UdpWithCallback, }
var XMLExports = map[string]interface{}{ "Escape": utils.XmlEscape, "dumps": utils.XmlDumps, "loads": utils.XmlLoads, }
var YakitExports = map[string]interface{}{ "NewClient": NewYakitClient, "NewTable": NewTable, "NewLineGraph": NewLineGraph, "NewBarGraph": NewBarGraph, "NewPieGraph": NewPieGraph, "NewWordCloud": NewWordCloud, "NewHTTPFlowRisk": NewHTTPFlowRisk, "InitYakit": InitYakit, "UpdateOnlineYakitStore": updateOnlineYakitStore, "UpdateYakitStore": updateYakitStore, "UpdateYakitStoreLocal": yakit.LoadYakitFromLocalDir, "UpdateYakitStoreFromGit": yakit.LoadYakitThirdpartySourceScripts, "GenerateYakitMITMHooksParams": generateYakitMITMHookParams, "GetHomeDir": consts.GetDefaultYakitBaseDir, "GetHomeTempDir": consts.GetDefaultYakitBaseTempDir, "GetOnlineBaseUrl": consts.GetOnlineBaseUrl, "SetOnlineBaseUrl": consts.SetOnlineBaseUrl, "Info": emptyVirtualClient.YakitInfo, "Warn": emptyVirtualClient.YakitWarn, "Debug": emptyVirtualClient.YakitDebug, "Error": emptyVirtualClient.YakitError, "Text": emptyVirtualClient.YakitTextBlock, "Markdown": emptyVirtualClient.YakitMarkdown, "Report": emptyVirtualClient.YakitReport, "File": emptyVirtualClient.YakitFile, "Stream": emptyVirtualClient.Stream, "Output": emptyVirtualClient.Output, "SetProgress": emptyVirtualClient.YakitSetProgress, "SetProgressEx": emptyVirtualClient.YakitSetProgressEx, }
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 }, }
var ZipExports = map[string]interface{}{ "Decompress": ziputil.DeCompress, "Compress": func(zipName string, filenames ...string) error { return ziputil.CompressByName(filenames, zipName) }, }
Functions ¶
func BuildTlsConfig ¶
func Ceil ¶ added in v1.2.9
Ceil 返回不小于x的最小整数 Example: ``` math.Ceil(1.5) // 2 math.Ceil(-1.5) // -1 ```
func Chmod ¶ added in v1.2.9
Chmod 改变指定文件或目录的权限 Example: ``` err = os.Chmod("/tmp/test.txt", 0777) ```
func Chown ¶ added in v1.2.9
Chown 改变指定文件或目录的所有者和所属组 Example: ``` err = os.Chown("/var/www/html/test.txt", 1000, 1000) ```
func Compare ¶ added in v1.2.8
Compare 按照ascii码表顺序逐个比较字符串a和b中的每个字符,如果a==b,则返回0,如果a<b,则返回-1,如果a>b,则返回1 Example: ``` str.Compare("hello yak", "hello yak") // 0 str.Compare("hello yak", "hello") // 1 str.Compare("hello", "hello yak") // -1 ```
func Contains ¶ added in v1.2.8
Contains 判断字符串s是否包含substr Example: ``` str.Contains("hello yakit", "yak") // true ```
func ContainsAny ¶ added in v1.2.8
ContainsAny 判断字符串s是否包含chars中的任意字符 Example: ``` str.ContainsAny("hello yak", "ly") // true str.ContainsAny("hello yak", "m") // false ```
func Count ¶ added in v1.2.8
Count 返回字符串s中substr出现的次数 Example: ``` str.Count("hello yak", "l") // 2 ```
func CsrfOptWithHTTPS ¶ added in v1.2.4
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 ¶ added in v1.2.4
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 ¶ added in v1.2.7
func DebugMockTCPProtocol ¶ added in v1.2.7
func DebugMockUDP ¶ added in v1.2.3
func DebugMockUDPFromScan ¶ added in v1.2.3
func DebugMockUDPProtocol ¶ added in v1.2.3
func DebugMockUDPWithTimeout ¶ added in v1.2.3
func DownloadMMDB ¶
func DownloadMMDB() error
func DownloadOnlineAuthProxy ¶
func EndsWith ¶ added in v1.2.8
EndsWith / HasSuffix 判断字符串s是否以suffix结尾 Example: ``` str.EndsWith("Hello Yak", "Yak") // true str.EndsWith("Hello Yak", "Hello") // false ```
func Environ ¶ added in v1.2.9
func Environ() []string
Environ 获取表示环境变量的字符串切片,格式为"key=value" Example: ``` for env in os.Environ() { value = env.SplitN("=", 2) printf("key = %s, value = %v\n", value[0], value[1]) } ```
func EqualFold ¶ added in v1.2.8
EqualFold 判断字符串s和t是否相等,忽略大小写 Example: ``` str.EqualFold("hello Yak", "HELLO YAK") // true ```
func Executable ¶ added in v1.2.9
Executable 获取当前可执行文件的路径 Example: ``` path, err = os.Executable() ```
func ExpandEnv ¶ added in v1.2.9
ExpandEnv 将字符串中的${var}或$var替换为其对应环境变量名的值 Example: ``` os.ExpandEnv("PATH = $PATH") ```
func Fields ¶ added in v1.2.8
Fields 返回将字符串s按照空白字符('\t', '\n', '\v', '\f', '\r', ' ', 0x85, 0xA0)分割的字符串切片 Example: ``` str.Fields("hello world\nhello yak\tand\vyakit") // [hello", "world", "hello", "yak", "and", "yakit"] ```
func Floor ¶ added in v1.2.9
Floor 返回不大于x的最大整数 Example: ``` math.Floor(1.5) // 1 math.Floor(-1.5) // -2 ```
func GenerateCSRFPoc ¶
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 ¶ added in v1.2.9
func GetDefaultDNSServers() []string
GetDefaultDNSServers 获取默认的DNS服务器ip对应的字符串切片 Example: ``` os.GetDefaultDNSServers() ```
func GetExtYakitLibByClient ¶
func GetExtYakitLibByClient(client *YakitClient) map[string]interface{}
func GetExtYakitLibByOutput ¶ added in v1.2.7
func GetLocalAddress ¶ added in v1.2.9
func GetLocalAddress() []string
GetLocalAddress 获取本地IP地址 Example: ``` os.GetLocalAddress() // ["192.168.1.103", "fe80::605a:5ff:fefb:5405"] ```
func GetLocalIPv4Address ¶ added in v1.2.9
func GetLocalIPv4Address() []string
GetLocalIPv4Address 获取本地IPv4地址 Example: ``` os.GetLocalIPv4Address() // ["192.168.3.103"] ```
func GetLocalIPv6Address ¶ added in v1.2.9
func GetLocalIPv6Address() []string
GetLocalIPv6Address 获取本地IPv6地址 Example: ``` os.GetLocalIPv6Address() // ["fe80::605a:5ff:fefb:5405"] ```
func GetMachineID ¶ added in v1.2.9
func GetMachineID() string
GetMachineID 获取每个机器唯一的标识符 Example: ``` os.GetMachineID() ```
func GetRandomAvailableTCPPort ¶ added in v1.2.9
func GetRandomAvailableTCPPort() int
GetRandomAvailableTCPPort 获取随机可用的TCP端口 Example: ``` tcp.Serve("127.0.0.1", os.GetRandomAvailableTCPPort()) ```
func GetRandomAvailableUDPPort ¶ added in v1.2.9
func GetRandomAvailableUDPPort() int
GetRandomAvailableUDPPort 获取随机可用的UDP端口 Example: ``` udp.Serve("127.0.0.1", os.GetRandomAvailableTCPPort()) ```
func GetStatementType ¶ added in v1.3.2
func GetStatementType(st interface{}) string
func Getegid ¶ added in v1.2.9
func Getegid() int
Getegid 获取当前进程的有效组ID Example: ``` os.Getegid() ```
func Getenv ¶ added in v1.2.9
Getenv 获取指定的环境变量的值,如果不存在则返回空字符串 Example: ``` value = os.Getenv("PATH") ```
func Geteuid ¶ added in v1.2.9
func Geteuid() int
Geteuid 获取当前进程的有效用户ID Example: ``` os.Geteuid() ```
func Getppid ¶ added in v1.2.9
func Getppid() int
Getppid 获取当前进程的父进程ID Example: ``` os.Getppid() ```
func Index ¶ added in v1.2.8
Index 返回字符串s中substr第一次出现的位置的索引,如果字符串中不存在substr,则返回-1 Example: ``` str.Index("hello yak", "yak") // 6 str.Index("hello world", "yak") // -1 ```
func IndexAny ¶ added in v1.2.8
IndexAny 返回字符串s中chars任意字符首次出现的位置的索引,如果字符串中不存在chars,则返回-1 Example: ``` str.IndexAny("Hello world", "world") // 2,因为l在第三个字符中首次出现 str.IndexAny("Hello World", "Yak") // -1 ```
func IndexByte ¶ added in v1.2.8
IndexByte 返回字符串s中第一个等于c的字符的索引,如果字符串中不存在c,则返回-1 Example: ``` str.IndexByte("hello yak", 'y') // 6 str.IndexByte("hello yak", 'm') // -1 ```
func InitYakit ¶ added in v1.2.2
func InitYakit(y *YakitClient)
func IsNaN ¶ added in v1.2.9
IsNaN 判断一个数是否是NaN Example: ``` math.IsNaN(1) // false math.IsNaN(math.NaN()) // true ```
func IsRemoteTCPPortOpen ¶ added in v1.2.9
IsRemoteTCPPortOpen 检查远程TCP端口是否开放 Example: ``` os.IsRemoteTCPPortOpen("yaklang.com", 443) // true ```
func IsTCPPortAvailable ¶ added in v1.2.9
IsTCPPortAvailable 检查TCP端口是否可用 Example: ``` os.IsTCPPortAvailable(80) ```
func IsTCPPortOpen ¶ added in v1.2.9
IsTCPPortOpen 检查TCP端口是否开放 Example: ``` os.IsTCPPortOpen(80) ```
func IsUDPPortAvailable ¶ added in v1.2.9
IsUDPPortAvailable 检查UDP端口是否可用 Example: ``` os.IsUDPPortAvailable(80) ```
func IsUDPPortOpen ¶ added in v1.2.9
IsUDPPortOpen 检查UDP端口是否开放 Example: ``` os.IsUDPPortOpen(80) ```
func Join ¶ added in v1.2.8
func Join(i interface{}, d interface{}) (defaultResult string)
Join 将i中的元素用d连接,如果传入的参数不是字符串,会自动将其转为字符串,再将其用d连接。如果连接失败,则会返回i的字符串形式。 Example: ``` str.Join([]string{"hello", "yak"}, " ") // hello yak str.Join([]int{1, 2, 3}, " ") // 1 2 3 ```
func JsonRawByteToMap ¶
func JsonRawByteToMap(jbyte json.RawMessage) (map[string]interface{}, error)
func JsonStrToVarList ¶
func JsonStreamToMapList ¶
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 JsonToMap ¶
JsonToMap 将 json 字符串 line 解析为 map Example: ``` str.JsonToMap(`{"a":1,"b":2}`) // map[a:1 b:2] ```
func JsonToMapList ¶
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 JsonbToVarList ¶
func LastIndex ¶ added in v1.2.8
LastIndex 返回字符串s中substr最后一次出现的位置的索引,如果字符串中不存在substr,则返回-1 Example: ``` str.LastIndex("hello yak", "l") // 3 str.LastIndex("hello yak", "m") // -1 ```
func LastIndexAny ¶ added in v1.2.8
LastIndexAny 返回字符串s中chars任意字符最后一次出现的位置的索引,如果字符串中不存在chars,则返回-1 Example: ``` str.LastIndexAny("hello yak", "ly") // 6 str.LastIndexAny("hello yak", "m") // -1 ```
func LastIndexByte ¶ added in v1.2.8
LastIndexByte 返回字符串s中最后一个等于c的字符的索引,如果字符串中不存在c,则返回-1 Example: ``` str.LastIndexByte("hello yak", 'l') // 3 str.LastIndexByte("hello yak", 'm') // -1 ```
func LookupEnv ¶ added in v1.2.9
LookupEnv 获取指定的环境变量的值 Example: ``` value, ok = os.LookupEnv("PATH") ```
func MarshalYakitOutput ¶
func NewCond ¶ added in v1.2.9
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 ¶ added in v1.3.0
func NewJsonConfig() *jsonConfig
func NewLock ¶ added in v1.2.9
NewLock 创建一个 Mutex 结构体引用,用于实现互斥锁,其帮助我们避免多个并发任务访问同一个资源时出现数据竞争问题 它实际是 NewMutex 的别名 Example: ``` m = sync.NewMutex() newMap = make(map[string]string) go func{ for { m.Lock() // 请求锁 defer m.Unlock() // 释放锁 newMap["key"] = "value" // 防止多个并发任务同时修改 newMap } } for { println(newMap["key"]) } ```
func NewMap ¶ added in v1.2.9
NewMap 创建一个 Map 结构体引用,这个 Map 是并发安全的 Example: ``` m = sync.NewMap() go func { for { m.Store("key", "value2") } } for { m.Store("key", "value") v, ok = m.Load("key") if ok { println(v) } } ```
func NewMutex ¶ added in v1.2.9
NewMutex 创建一个 Mutex 结构体引用,用于实现互斥锁,其帮助我们避免多个并发任务访问同一个资源时出现数据竞争问题 Example: ``` m = sync.NewMutex() newMap = make(map[string]string) go func{ for { m.Lock() // 请求锁 defer m.Unlock() // 释放锁 newMap["key"] = "value" // 防止多个并发任务同时修改 newMap } } for { println(newMap["key"]) } ```
func NewOnce ¶ added in v1.2.9
NewOnce 创建一个 Once 结构体引用,其帮助我们确保某个函数只会被执行一次 Example: ``` o = sync.NewOnce() for i in 10 { o.Do(func() { println("this message will only print once") }) } ```
func NewPool ¶ added in v1.2.9
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 NewRWMutex ¶ added in v1.2.9
NewRWMutex 创建一个 RWMutex 结构体引用,用于实现读写锁,其帮助我们避免多个并发任务访问同一个资源时出现数据竞争问题 Example: ``` m = sync.NewRWMutex() newMap = make(map[string]string) go func{ for { m.Lock() // 请求写锁 defer m.Unlock() // 释放写锁 newMap["key"] = "value" // 防止多个并发任务同时修改 newMap } } for { m.RLock() // 请求读锁 defer m.RUnlock() // 释放读锁 println(newMap["key"]) } ```
func NewReader ¶ added in v1.2.8
NewReader 返回一个从字符串s读取数据的*Reader Example: ``` r = str.NewReader("hello yak") buf = make([]byte, 256) _, err = r.Read(buf) die(err) println(sprintf("%s", buf)) // hello yak ```
func NewSizedWaitGroup ¶ added in v1.2.3
func NewSizedWaitGroup(size int, 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 ¶
ParamsGetOr 从 map 中获取 key 对应的值,如果不存在则返回 defaultValue Example: ``` str.ParamsGetOr({"a": "1"}, "a", "2") // 1 str.ParamsGetOr({"a": "1"}, "b", "2") // 2 ```
func Pipe ¶ added in v1.2.9
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 Pow10 ¶ added in v1.2.9
Pow10 返回10的n次方 Example: ``` math.Pow10(2) // 100 math.Pow10(-1) // 0.1 ```
func Query ¶ added in v1.2.9
func Query(filter string, opts ..._spaceEngineConfigOpt) (chan *base.NetSpaceEngineResult, error)
func RawHandlerToExecOutput ¶ added in v1.2.2
func RawHandlerToExecOutput(h func(any) error) func(result *ypb.ExecResult) error
func RegexpMatchEmail ¶
func RegexpMatchEmail(i interface{}) []string
ExtractEmail 提取字符串中所有的 Email 地址 Example: ``` re.ExtractEmail("hello your email is anonymous@yaklang.io") // ["anonymous@yaklang.io"] ```
func RegexpMatchHostPort ¶
func RegexpMatchHostPort(i interface{}) []string
ExtractHostPort 提取字符串中所有的 Host:Port Example: ``` re.ExtractHostPort("Open Host:Port\n127.0.0.1:80\n127.0.0.1:443") // ["127.0.0.1:80", "127.0.0.1:443"] ```
func RegexpMatchIP ¶
func RegexpMatchIP(i interface{}) []string
ExtractIP 提取字符串中所有的 IP 地址 Example: ``` re.ExtractIP("hello your local ip is 127.0.0.1, your local ipv6 ip is fe80::1") // ["127.0.0.1", "fe80::1"] ```
func RegexpMatchIPv4 ¶
func RegexpMatchIPv4(i interface{}) []string
ExtractIPv4 提取字符串中所有的 IPv4 地址 Example: ``` re.ExtractIPv4("hello your local ip is 127.0.0.1, your public ip is 1.1.1.1") // ["127.0.0.1", "1.1.1.1"] ```
func RegexpMatchIPv6 ¶
func RegexpMatchIPv6(i interface{}) []string
ExtractIPv6 提取字符串中所有的 IPv6 地址 Example: ``` re.ExtractIPv6("hello your local ipv6 ip is fe80::1, your public ipv6 ip is 2001:4860:4860::8888") // ["fe80::1", "2001:4860:4860::8888"] ```
func RegexpMatchMac ¶
func RegexpMatchMac(i interface{}) []string
ExtractMac 提取字符串中所有的 MAC 地址 Example: ``` re.ExtractMac("hello your mac is 00:00:00:00:00:00") // ["00:00:00:00:00:00"] ```
func RegexpMatchPathParam ¶
func RegexpMatchPathParam(i interface{}) []string
ExtractPath 提取URL中的路径和查询字符串 Example: ``` re.ExtractPath("visit this website: yaklang.com/docs/api/re?name=anonymous") // ["/docs/api/re?name=anonymous"] ```
func RegexpMatchTTY ¶
func RegexpMatchTTY(i interface{}) []string
ExtractTTY 提取字符串中所有的Linux/Unix系统中的设备文件路径 Example: ``` re.ExtractTTY("hello your tty is /dev/pts/1") // ["/dev/pts/1"] ```
func RegexpMatchURL ¶
func RegexpMatchURL(i interface{}) []string
ExtractURL 提取字符串中所有的 URL 地址 Example: ``` re.ExtractURL("Yak official website: https://yaklang.com and https://yaklang.io") // ["https://yaklang.com", "https://yaklang.io"] ```
func Rename ¶ added in v1.2.9
Rename 重命名文件或目录,可以用于移动文件或目录 Example: ``` os.Rename("/tmp/test.txt", "/tmp/test2.txt") os.Rename("/tmp/test", "/root/test") ```
func Repeat ¶ added in v1.2.8
Repeat 返回将字符串s重复count次的字符串 Example: ``` str.Repeat("hello", 3) // hellohellohello ```
func Replace ¶ added in v1.2.8
Replace 返回将字符串s中前n个old字符串替换为new字符串的字符串 Example: ``` str.Replace("hello yak", "l", "L", 1) // heLlo yak ```
func ReplaceAll ¶ added in v1.2.8
ReplaceAll 返回将字符串s中所有old字符串替换为new字符串的字符串 Example: ``` str.ReplaceAll("hello yak", "yak", "yakit") // hello yakit ```
func Round ¶ added in v1.2.9
Round 返回四舍五入到最近的整数 存在一些特殊情况:Round(±0) = ±0,Round(±Inf) = ±Inf,Round(NaN) = NaN Example: ``` math.Round(1.5) // 2 math.Round(1.4) // 1 ```
func RoundToEven ¶ added in v1.2.9
RoundToEven 返回四舍五入到最近的偶整数 Example: ``` math.RoundToEven(1.5) // 2 math.RoundToEven(2.5) // 2 math.RoundToEven(3.5) // 4 math.RoundToEven(4.5) // 4 ```
func SetEngineClient ¶ added in v1.2.2
func SetEngineClient(e *antlr4yak.Engine, client *YakitClient)
func SetEngineInterface ¶ added in v1.2.6
func SetEngineInterface(engine IEngine)
func SetYakitServer_LogHandler ¶
func SetYakitServer_LogHandler(h func(level string, info string)) func(s *YakitServer)
func SetYakitServer_ProgressHandler ¶
func SetYakitServer_ProgressHandler(h func(id string, progress float64)) func(s *YakitServer)
func Setenv ¶ added in v1.2.9
Setenv 设置指定的环境变量 Example: ``` os.Setenv("PATH", "/usr/local/bin:/usr/bin:/bin") ```
func Split ¶ added in v1.2.8
Split 将字符串s按照sep分割成字符串切片 Example: ``` str.Split("Hello Yak", " ") // [Hello", "Yak"] ```
func SplitAfter ¶ added in v1.2.8
SplitAfter 将字符串s按照sep分割成字符串切片,但是每个元素都会保留sep Example: ``` str.SplitAfter("Hello-Yak", "-") // [Hello-", "Yak"] ```
func SplitAfterN ¶ added in v1.2.8
SplitAfterN 将字符串s按照sep分割成字符串切片,但是每个元素都会保留sep,最多分为n个元素 Example: ``` str.SplitAfterN("Hello-Yak-and-World", "-", 2) // [Hello-", "Yak-and-World"] ```
func SplitN ¶ added in v1.2.8
SplitN 将字符串s按照sep分割成字符串切片,最多分为n个元素 Example: ``` str.SplitN("Hello-Yak-and-World", "-", 2) // [Hello", "Yak-and-World"] ```
func Sqrt ¶ added in v1.2.9
Sqrt 返回一个数的平方根 如果x < 0,返回NaN Example: ``` math.Sqrt(4) // 2 math.Sqrt(-1) // NaN ```
func StartsWith ¶ added in v1.2.8
StartsWith / HasPrefix 判断字符串s是否以prefix开头 Example: ``` str.StartsWith("Hello Yak", "Hello") // true str.StartsWith("Hello Yak", "Yak") // false ```
func TempDir ¶ added in v1.2.9
func TempDir() string
TempDir 获取用于存放临时文件的默认目录路径 Example: ``` os.TempDir() ```
func Title ¶ added in v1.2.8
Title 返回字符串s的标题化版本,即所有单词的首字母都是大写的 Example: ``` str.Title("hello yak") // Hello Yak ```
func ToLower ¶ added in v1.2.8
ToLower 返回字符串s的小写形式 Example: ``` str.ToLower("HELLO YAK") // hello yak ```
func ToTitle ¶ added in v1.2.8
ToTitle 返回字符串s的标题化版本,其中所有Unicode字母都会被转换为其大写 Example: ``` str.ToTitle("hello yak") // HELLO YAK ```
func ToUpper ¶ added in v1.2.8
ToUpper 返回字符串s的大写形式 Example: ``` str.ToUpper("hello yak") // HELLO YAK ```
func ToValidUTF8 ¶ added in v1.2.8
ToValidUTF8 返回将字符串s中无效的UTF-8编码替换为replacement的字符串 Example: ```
str.ToValidUTF8("hello yak", "?") // hello yak ```
func Trim ¶ added in v1.2.8
Trim 返回将字符串s两侧所有包含cutset字符串中的字符都去掉的字符串 Example: ``` str.Trim("Hello Yak", "Hk") // ello Ya str.Trim("HelloYakHello", "Hello") // Yak ```
func TrimLeft ¶ added in v1.2.8
TrimLeft 返回将字符串s左侧所有包含cutset字符串中的字符都去掉的字符串 Example: ``` str.TrimLeft("Hello Yak", "H") // ello Yak str.TrimLeft("HelloYak", "Hello") // Yak ```
func TrimPrefix ¶ added in v1.2.8
TrimPrefix 返回将字符串s前缀prefix去掉的字符串 Example: ``` str.TrimPrefix("Hello Yak", "Hello") // Yak str.TrimPrefix("HelloYak", "Hello") // Yak ```
func TrimRight ¶ added in v1.2.8
TrimRight 返回将字符串s右侧所有包含cutset字符串中的字符都去掉的字符串 Example: ``` str.TrimRight("Hello Yak", "k") // Hello Ya str.TrimRight("HelloYak", "Yak") // Hello ```
func TrimSpace ¶ added in v1.2.8
TrimSpace 返回将字符串s两侧所有的空白字符都去掉的字符串 Example: ``` str.TrimSpace(" \t\n Hello Yak \n\t\r\n") // Hello Yak ```
func TrimSuffix ¶ added in v1.2.8
TrimSuffix 返回将字符串s后缀suffix去掉的字符串 Example: ``` str.TrimSuffix("Hello Yak", "ak") // Hello Y str.TrimSuffix("HelloYak", "Yak") // Hello ```
func WaitConnect ¶
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 YakitNewAliveHost ¶ added in v1.2.7
func YakitNewAliveHost(target string, opts ...yakit.AliveHostParamsOpt)
func YakitNewRiskBuilder ¶ added in v1.2.7
func YakitNewRiskBuilder(client *YakitClient) func(target string, opts ...yakit.RiskParamsOpt)
func YakitOutputToExecResult ¶ added in v1.2.7
func YakitOutputToExecResult(i interface{}) *ypb.ExecResult
func YieldPayload ¶ added in v1.3.3
YieldPayload means
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 DownloadOnlinePluginRequest ¶ added in v1.2.9
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 ¶
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
type HttpFlowShare ¶ added in v1.2.2
type HttpFlowShare struct {}
type HttpFlowShareRequest ¶ added in v1.2.2
type HttpFlowShareRequest struct {}
type HttpServerConfigOpt ¶ added in v1.3.1
type HttpServerConfigOpt func(c *_httpServerConfig)
type IEngine ¶ added in v1.2.6
type IEngine interface {
ExecuteEx(code string, params map[string]interface{}) (*antlr4yak.Engine, error)
}
var EngineInterface IEngine
type JsRunConfig ¶ added in v1.3.2
type JsRunConfig struct {
// contains filtered or unexported fields
}
type MitmConfigOpt ¶ added in v1.3.1
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) DownloadNewOnlinePlugins ¶ added in v1.2.9
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 ¶ added in v1.2.9
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 ¶ added in v1.2.9
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 (*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 (*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 (*OnlineClient) HttpFlowShareWithToken ¶ added in v1.2.2
func (*OnlineClient) Save ¶
func (s *OnlineClient) Save(db *gorm.DB, plugins ...*OnlinePlugin) error
func (*OnlineClient) SaveToOnline ¶ added in v1.2.9
func (s *OnlineClient) SaveToOnline(ctx context.Context, req *ypb.SaveYakScriptToOnlineRequest, plugin *schema.YakScript) error
func (*OnlineClient) SaveYakScriptToOnline ¶ added in v1.2.9
func (*OnlineClient) UploadHTTPFlowToOnline ¶ added in v1.3.3
func (*OnlineClient) UploadRiskToOnline ¶
func (*OnlineClient) UploadRiskToOnlineWithToken ¶
func (s *OnlineClient) UploadRiskToOnlineWithToken(ctx context.Context, req *ypb.UploadRiskToOnlineRequest, risk []byte) error
func (*OnlineClient) UploadScreenRecordersToOnline ¶ added in v1.2.2
func (*OnlineClient) UploadScreenRecordersWithToken ¶ added in v1.2.2
func (s *OnlineClient) UploadScreenRecordersWithToken(ctx context.Context, token string, file os.File, screenRecorders *schema.ScreenRecorder) error
type OnlineCollaboratorInfo ¶ added in v1.2.9
type OnlineDownloadStream ¶
type OnlineDownloadStream struct { Total int64 Page int64 PageTotal int64 Limit int64 Chan chan *OnlinePluginItem }
type OnlinePaging ¶
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"` }
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 ¶ added in v1.2.9
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) FuzzEveryIndex ¶
func (r *ProtobufRecords) FuzzEveryIndex(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) 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 ¶ added in v1.3.3
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 RegisterOutputFuncType ¶
type RegisterOutputFuncType func(tag string, cb _outputCallback)
type SaveYakScriptOnlineRequest ¶ added in v1.2.9
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"` }
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 StdPrinter ¶ added in v1.3.2
type StdPrinter struct{}
func (*StdPrinter) Error ¶ added in v1.3.2
func (s *StdPrinter) Error(msg string)
func (*StdPrinter) Log ¶ added in v1.3.2
func (s *StdPrinter) Log(msg string)
func (*StdPrinter) Warn ¶ added in v1.3.2
func (s *StdPrinter) Warn(msg string)
type TagAndTypeValue ¶
type TagStat ¶
type TagStat struct {
// contains filtered or unexported fields
}
func NewTagStat ¶
func (*TagStat) ForceUpdate ¶
type TcpServerConfigOpt ¶ added in v1.3.1
type TcpServerConfigOpt func(c *tcpServerConfig)
type UdpServerOpt ¶ added in v1.3.1
type UdpServerOpt func(config *udpServerConfig)
func UdpWithCallback ¶ added in v1.3.1
func UdpWithCallback(cb func(*udpConnection, []byte)) UdpServerOpt
func UdpWithContext ¶ added in v1.3.1
func UdpWithContext(ctx context.Context) UdpServerOpt
func UdpWithTimeout ¶ added in v1.3.1
func UdpWithTimeout(f float64) UdpServerOpt
type UnregisterOutputFuncType ¶
type UnregisterOutputFuncType func(tag string)
type WaitGroupProxy ¶ added in v1.2.3
func NewWaitGroup ¶ added in v1.2.3
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 ¶ added in v1.2.3
func (wg *WaitGroupProxy) Add(deltas ...int)
func (*WaitGroupProxy) Done ¶ added in v1.3.2
func (wg *WaitGroupProxy) Done()
func (*WaitGroupProxy) SetContext ¶ added in v1.3.2
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 ¶ added in v1.3.2
func (wg *WaitGroupProxy) SetZero()
type YakLogger ¶ added in v1.2.8
func CreateYakLogger ¶
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 NewVirtualYakitClientWithRiskCount ¶ added in v1.3.1
func NewVirtualYakitClientWithRiskCount(h func(i *ypb.ExecResult) error, riskCounter *uint32) *YakitClient
func NewYakitClient ¶
func NewYakitClient(addr string) *YakitClient
func (*YakitClient) AddCounter ¶ added in v1.3.1
func (c *YakitClient) AddCounter() uint32
func (*YakitClient) Output ¶
func (c *YakitClient) Output(i interface{}) error
func (*YakitClient) SendRaw ¶
func (c *YakitClient) SendRaw(y *YakitLog) error
func (*YakitClient) SetYakLog ¶ added in v1.2.8
func (c *YakitClient) SetYakLog(logger *YakLogger)
func (*YakitClient) YakitDebug ¶ added in v1.2.8
func (c *YakitClient) YakitDebug(tmp string, items ...interface{})
func (*YakitClient) YakitDraw ¶ added in v1.2.8
func (c *YakitClient) YakitDraw(level string, data interface{})
func (*YakitClient) YakitError ¶ added in v1.2.8
func (c *YakitClient) YakitError(tmp string, items ...interface{})
func (*YakitClient) YakitFile ¶ added in v1.2.8
func (c *YakitClient) YakitFile(fileName string, desc ...interface{})
func (*YakitClient) YakitInfo ¶ added in v1.2.8
func (c *YakitClient) YakitInfo(tmp string, items ...interface{})
func (*YakitClient) YakitLog ¶ added in v1.2.8
func (c *YakitClient) YakitLog(level string, tmp string, items ...interface{}) error
输入
func (*YakitClient) YakitMarkdown ¶ added in v1.2.8
func (c *YakitClient) YakitMarkdown(tmp interface{})
func (*YakitClient) YakitReport ¶ added in v1.2.8
func (c *YakitClient) YakitReport(i int)
func (*YakitClient) YakitSetProgress ¶ added in v1.2.8
func (c *YakitClient) YakitSetProgress(f float64)
func (*YakitClient) YakitSetProgressEx ¶ added in v1.2.8
func (c *YakitClient) YakitSetProgressEx(id string, f float64)
func (*YakitClient) YakitTextBlock ¶ added in v1.2.8
func (c *YakitClient) YakitTextBlock(tmp interface{})
func (*YakitClient) YakitWarn ¶ added in v1.2.8
func (c *YakitClient) YakitWarn(tmp string, items ...interface{})
type YakitFeature ¶
type YakitFixedTableData ¶
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 (*YakitHTTPFlowRisk) SetFragment ¶
func (y *YakitHTTPFlowRisk) SetFragment(item ...string)
func (*YakitHTTPFlowRisk) SetLevel ¶
func (y *YakitHTTPFlowRisk) SetLevel(l string)
type YakitMessage ¶
type YakitMessage struct { Type string `json:"type"` Content json.RawMessage `json:"content"` }
var yakitClientInstance YakitClient
type YakitProgress ¶
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 YakitTable ¶
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 ¶ added in v1.3.0
Source Files
¶
- base_funcs.go
- bot.go
- bufio.go
- cli.go
- codec.go
- context.go
- csrf.go
- db.go
- dictutil.go
- dns.go
- dnslog.go
- env.go
- exec.go
- file.go
- funk.go
- fuzz.go
- geojson.go
- global.go
- grok.go
- gzip.go
- hook.go
- http.go
- http_pool.go
- http_server.go
- httpex.go
- httpflow_online.go
- httpflow_share.go
- icmp.go
- ioutil.go
- jpath.go
- js.go
- js_printer.go
- json.go
- ldap.go
- log.go
- math.go
- mitm.go
- mmdb.go
- orderedmap.go
- ping.go
- poc.go
- rdp.go
- redis.go
- regen.go
- regexp.go
- regexp2.go
- regexp_extract.go
- risk.go
- risk_online.go
- smb.go
- spacengine.go
- strings.go
- sync.go
- system.go
- tcp.go
- tcp_serve.go
- tcp_util.go
- time.go
- timezone.go
- tls.go
- traceroute.go
- udp.go
- upload_screenrecorders.go
- xml.go
- yakit.go
- yakit_client.go
- yakit_client_stream.go
- yakit_db.go
- yakit_online.go
- yakit_tags.go
- yakit_viewer.go
- yaml.go
- zip.go