wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.08k stars 1.21k forks source link

Obfuscated Binary doesn't open (nothing happens) #2442

Closed tarun0 closed 1 year ago

tarun0 commented 1 year ago

Description

I am making an obfuscated build and it just doesn't run. There is no error message while building with wails build -obfuscated but on running the binary, windows show a progress circle for an instant and that's it.

wails build works well.

The binary size difference between normal build and obfuscated build is significant and hence, I feel that obfuscated is doing some job for sure.

Can someone direct me to right path on how I can pinpoint the issue? It looks more with garble integration or garble itself than specific wails but not sure. Or maybe in my codebase. I did Google but could not find relevant hints.

To Reproduce

Typical build steps

  1. wails build -obfuscated

Expected behaviour

Obfuscated build should also run fine.

Screenshots

No response

Attempted Fixes

Tried garbleflags -literals -tiny -seed=random -debug Nothing throws error

System Details

DEB | Using go webview2loader
Wails CLI v2.3.1

Scanning system - Please wait (this may take a long time)...Done.

# System

OS           | Windows 10 Enterprise
Version      | 2009 (Build: 19045)
ID           | 22H2
Go Version   | go1.20
Platform     | windows
Architecture | amd64

# Wails

Version | v2.3.1

# Dependencies

Dependency | Package Name | Status    | Version
WebView2   | N/A          | Installed | 110.0.1587.57
npm        | N/A          | Installed | 9.3.1
*upx       | N/A          | Available |
*nsis      | N/A          | Installed | v3.08
* - Optional Dependency

# Diagnosis

Your system is ready for Wails development!
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/

Additional context

Should I create an issue in garble repo? Looks similar to this issue https://github.com/burrowers/garble/issues/599

leaanthony commented 1 year ago

You installed garble right? And it's on your path?

tarun0 commented 1 year ago

You installed garble right? And it's on your path?

Yes, It's on Path as well. I verified. Like I said, no error is showed and -debug flag also showed logs where files are being hashed.

C:\>garble
Garble obfuscates Go code by wrapping the Go toolchain.

        garble [garble flags] command [go flags] [go arguments]

For example, to build an obfuscated program:

        garble build ./cmd/foo

Similarly, to combine garble flags and Go build flags:

        garble -literals build -tags=purego ./cmd/foo

The following commands are supported:

        build          replace "go build"
        test           replace "go test"
        reverse        de-obfuscate output such as stack traces
        version        print the version and build settings of the garble binary

To learn more about a command, run "garble help <command>".

garble accepts the following flags before a command:

  -debug
        Print debug logs to stderr
  -debugdir string
        Write the obfuscated source to a directory, e.g. -debugdir=out
  -literals
        Obfuscate literals such as strings
  -seed value
        Provide a base64-encoded seed, e.g. -seed=o9WDTZ4CN4w
        For a random seed, provide -seed=random
  -tiny
        Optimize for binary size, losing some ability to reverse the process

For more information, see https://github.com/burrowers/garble.
BigCatGit commented 1 year ago

我也遇到 了相同的问题:

Building target: windows/amd64

• Generating obfuscated bindings: Done. • Installing frontend dependencies: Done. • Compiling frontend: Done. • Generating application assets: Done. • Compiling application: # changeme cannot get modified linker: expected 2 applied patches, actually 0:

正在检查补丁 cmd/link/internal/ld/pcln.go... 正在检查补丁 cmd/link/internal/ld/pcln.go... 成功应用补丁 cmd/link/internal/ld/pcln.go。 成功应用补丁 cmd/link/internal/ld/pcln.go。

exit status 1 ERROR exit status 1

marcio199226 commented 1 year ago

I have the same issue with obfuscated builds:

wails build -upx -obfuscated -v 2 -clean
Wails CLI v2.4.0

# Build Options

Platform(s)        | linux/amd64                                             
Compiler           | /home/oskar/go/bin/go                                   
Skip Bindings      | false                                                   
Build Mode         | production                                              
Frontend Directory | /home/oskar/projects/mchat/mchat-desktop-client/frontend
Obfuscated         | true                                                    
Garble Args        | -literals -tiny -seed=random                            
Skip Frontend      | false                                                   
Compress           | true                                                    
Package            | true                                                    
Clean Bin Dir      | true                                                    
LDFlags            |                                                         
Tags               | []                                                      
Race Detector      | false                                                   

# Building target: linux/amd64

  • Generating obfuscated bindings:  INFO  
Done.
  • Installing frontend dependencies: 
 INFO  Install command: 'npm install'
Skipping npm install
Done.
  • Compiling frontend: 
 INFO  Build command: 'npm run build'

    > mchat-desktop@0.0.0 build /home/oskar/projects/mchat/mchat-desktop-client/frontend
    > ng build --configuration production --output-hashing none --aot --build-optimizer --optimization --allowed-common-js-dependencies

    Initial Chunk Files | Names              |  Raw Size | Estimated Transfer Size
    main.js             | main               | 241.49 kB |                64.29 kB
    polyfills.js        | polyfills          |  33.07 kB |                10.67 kB
    runtime.js          | runtime            |   2.68 kB |                 1.24 kB
    styles.css          | styles             |   2.46 kB |               579 bytes

    | Initial Total      | 279.70 kB |                76.77 kB

    Lazy Chunk Files    | Names              |  Raw Size | Estimated Transfer Size
    998.js              | about-about-module |   1.40 kB |               695 bytes
    174.js              | home-home-module   |   1.30 kB |               625 bytes

    Build at: 2023-03-09T10:29:32.532Z - Hash: 04325c507b554d06 - Time: 3739ms

    - Generating browser application bundles (phase: setup)...
    ✔ Browser application bundle generation complete.
    ✔ Browser application bundle generation complete.
    - Copying assets...
    ✔ Copying assets complete.
    - Generating index html...
    ✔ Index html generation complete.

Done.
  • Compiling application: 
 INFO  Build command: garble -literals -tiny -seed=random build -tags desktop,obfuscated,wv2runtime.download,production -ldflags "-w -s" -o /home/oskar/projects/mchat/mchat-desktop-client/build/bin/mchat-desktop
  • Environment:%!(EXTRA string=CLUTTER_IM_MODULE=xim NVM_DIR=/home/oskar/.nvm LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: LESSCLOSE=/usr/bin/lesspipe %s %s XDG_MENU_PREFIX=gnome- LANG=it_IT.UTF-8 DISPLAY=:0 PYENV_ROOT=/home/oskar/.pyenv GNOME_SHELL_SESSION_MODE=ubuntu COLORTERM=truecolor WASMER_DIR=/home/oskar/.wasmer NVM_CD_FLAGS= USERNAME=oskar XDG_VTNR=2 SSH_AUTH_SOCK=/run/user/1000/keyring/ssh MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path S_COLORS=auto XDG_SESSION_ID=26 USER=oskar DESKTOP_SESSION=ubuntu QT4_IM_MODULE=xim GOPATH=/home/oskar/go TEXTDOMAINDIR=/usr/share/locale/ GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/244e019d_9b15_4ad4_b16b_d0410808731b DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path PWD=/home/oskar/projects/mchat/mchat-desktop-client HOME=/home/oskar GOROOT=/home/oskar/.go TEXTDOMAIN=im-config SSH_AGENT_PID=10768 QT_ACCESSIBILITY=1 LIBVIRT_DEFAULT_URI=qemu:///system XDG_SESSION_TYPE=x11 XDG_DATA_DIRS=/usr/share/ubuntu:/home/oskar/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop XDG_SESSION_DESKTOP=ubuntu GJS_DEBUG_OUTPUT=stderr GTK_MODULES=gail:atk-bridge WINDOWPATH=2 TERM=xterm-256color SHELL=/bin/bash VTE_VERSION=5202 QT_IM_MODULE=ibus XMODIFIERS=@im=ibus IM_CONFIG_PHASE=2 NVM_BIN=/home/oskar/.nvm/versions/node/v14.19.3/bin XDG_CURRENT_DESKTOP=ubuntu:GNOME GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1 GNOME_TERMINAL_SERVICE=:1.114 PYENV_SHELL=bash XDG_SEAT=seat0 SHLVL=1 WASMER_CACHE_DIR=/home/oskar/.wasmer/cache GDMSESSION=ubuntu GNOME_DESKTOP_SESSION_ID=this-is-deprecated LOGNAME=oskar DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus XDG_RUNTIME_DIR=/run/user/1000 XAUTHORITY=/run/user/1000/gdm/Xauthority XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg PATH=/home/oskar/.pyenv/bin:/home/oskar/go/bin:/home/oskar/.wasmer/bin:/home/oskar/.nvm/versions/node/v14.19.3/bin:/home/oskar/.pyenv/shims:/home/oskar/.local/bin:/home/oskar/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/oskar/.pub-cache/bin:/home/oskar/.local/share/JetBrains/Toolbox/scripts:/home/oskar/go/bin:/home/oskar/.wasmer/globals/wapm_packages/.bin NVM_INC=/home/oskar/.nvm/versions/node/v14.19.3/include/node GJS_DEBUG_TOPICS=JS ERROR;JS LOG SESSION_MANAGER=local/CY4-RMOMA078:@/tmp/.ICE-unix/10674,unix/CY4-RMOMA078:/tmp/.ICE-unix/10674 LESSOPEN=| /usr/bin/lesspipe %s GTK_IM_MODULE=ibus _=/home/oskar/go/bin/wails OLDPWD=/home/oskar/projects/mchat/mchat-desktop-client/frontend CGO_CFLAGS= CGO_CXXFLAGS=-I/home/oskar/projects/mchat/mchat-desktop-client/build CGO_ENABLED=1 GOOS=linux GOARCH=amd64)# changeme
cannot get modified linker: expected 2 applied patches, actually 0:

Controllo della patch cmd/link/internal/ld/pcln.go...
Controllo della patch cmd/link/internal/ld/pcln.go...
Patch cmd/link/internal/ld/pcln.go applicata correttamente.
Patch cmd/link/internal/ld/pcln.go applicata correttamente.

exit status 1
  ERROR   exit status 1

  ERROR   exit status 1
 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
tarun0 commented 1 year ago

Guys my issue is different than both yours. I can build the binary. No error is thrown throughout the process. When i double click, nothing happens. Maybe entry point etc got corrupted or something? I'm don't possess enough knowledge in that domain.

leaanthony commented 1 year ago

Has anyone tried an older release? Can you pinpoint what affected it using git bisect?

leaanthony commented 1 year ago

Closing this due to lack of feedback. Feel free to reopen if there's anything else to discuss 👍

ulixcode-labs commented 1 year ago

i have similar issue. On macos. after wails build get the binary, then I double click nothing happens. even without the -obfuscated flag

lysShub commented 4 weeks ago

Guys my issue is different than both yours. I can build the binary. No error is thrown throughout the process. When i double click, nothing happens. Maybe entry point etc got corrupted or something? I'm don't possess enough knowledge in that domain.

don't double-click run the app.exe, on cmd run it, maybe something output

lysShub commented 4 weeks ago

i can't get window.go.main obj when with -obfuscated -garbleargs "-seed=myrandomseed" image

@leaanthony is binding problem?