Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting errors when trying to build reverse-ssh for android with an other arch than arm64 on Mac OS. #36

Open
anyoneoruser opened this issue Dec 29, 2024 · 0 comments

Comments

@anyoneoruser
Copy link

Hello visitor, could you help me please !

When i am trying to build the reverse shell for android/arm64(alias arm64-v8a), everything works fine

RS_PUB="$(cat /path/to/my/key.pub)" RS_PASS="anybody-who-look-at-this-is-malicious" GOOS="android" GOARCH="arm64" make compressed
rm -f bin/*reverse-ssh*
CGO_ENABLED=0 					go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/ .
CGO_ENABLED=0 GOARCH=amd64	GOOS=linux	go build -ldflags=" -X 'ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/reverse-sshx64 .
CGO_ENABLED=0 GOARCH=386	GOOS=linux	go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/reverse-sshx86 .
CGO_ENABLED=0 GOARCH=amd64	GOOS=windows	go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/reverse-sshx64.exe .
CGO_ENABLED=0 GOARCH=386	GOOS=windows	go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/reverse-sshx86.exe .

But for others archs i get that:

RS_PUB="$(cat /path/to/my/key.pub)" RS_PASS="anybody-who-look-at-this-is-malicious" GOOS="android" GOARM=7 GOARCH="arm" make compressed
rm -f bin/*reverse-ssh*
CGO_ENABLED=0 					go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/ .
android/arm requires external (cgo) linking, but cgo is not enabled
make: *** [build] Error 1

After changing this in the Makefile i got this:

RS_PUB="$(cat /path/to/my/key.pub)" RS_PASS="anybody-who-look-at-this-is-malicious" GOOS="android" GOARM=7 GOARCH="arm" make compressed
rm -f bin/*reverse-ssh*
CGO_ENABLED=1 					go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/ .
# runtime/cgo
clang: error: argument unused during compilation: '-marm' [-Werror,-Wunused-command-line-argument]
make: *** [build] Error 1

I tried the script printed by Makefile with the necessary changes and i got this:

GOOS="android" GOARCH=amd64 CGO_ENABLED=1  go build -ldflags=" -X 'main.authorizedKey=GOOS="android" GOARCH=amd64 CGO_ENABLED=1  go build -ldflags=" -X 'main.authorizedKey=ssh-ed25519 lllllllllllloooooooonnnnnnnnggggg-ppppppppuuuuuuubbbbbbbbkkkkkkkkeeeeeeeyyyyyyyy [email protected]' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/
# runtime/cgo
gcc_android.c:6:10: fatal error: 'android/log.h' file not found' -X 'main.localPassword=anybody-who-look-at-this-is-malicious' -s -w" -o bin/
# runtime/cgo
gcc_android.c:6:10: fatal error: 'android/log.h' file not found

And a last thing: on my computer, my NDK tools are in /usr/local/share/android-commandlinetools/ndk/magisk. I wonder there is something wrong in my Android SDK installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant