chisel icon indicating copy to clipboard operation
chisel copied to clipboard

How to use in Android?

Open simonho234 opened this issue 5 years ago • 33 comments

simonho234 avatar Mar 13 '19 07:03 simonho234

An Android app developer would need to develop an app using chisel

On Wed, 13 Mar 2019 at 18:25, simonho234 [email protected] wrote:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jpillora/chisel/issues/86, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmr8xCES0bzheCeG4FOLbLwXr3GAwWVks5vWKflgaJpZM4bsj3f .

jpillora avatar Mar 13 '19 11:03 jpillora

You can take chisel binary for android arm from here. Copy it to your device, e.g.:

adb push chisel_android_arm /data/local/tmp

Then, make it executable there and run as a commandline utility like in any other OS (using adb, if android device is connected to your desktop or laptop, or with the help of terminal emulator app, if it is not).

Of course, to make it more comfortable, you'll need a wrapper android app with appropriate UI.

Meteorite avatar Mar 20 '19 20:03 Meteorite

@Meteorite Do you know any way to use chisel as VPN, to make all traffic flow through it?

berkant avatar Jan 21 '20 14:01 berkant

How about using Terminal app like TERMUX on Android ?? Can you explain how to do it ??

ingnelson avatar Feb 01 '20 16:02 ingnelson

You can take chisel binary for android arm from here. Copy it to your device, e.g.:

adb push chisel_android_arm /data/local/tmp

Then, make it executable there and run as a commandline utility like in any other OS (using adb, if android device is connected to your desktop or laptop, or with the help of terminal emulator app, if it is not).

Of course, to make it more comfortable, you'll need a wrapper android app with appropriate UI.

@Meteorite can you create a mini tutorial or the commands line to use Chisel on Android , maybe using the Terminal Termux app , please. https://play.google.com/store/apps/details?id=com.termux

Do you have a telegram account I can contact you ?.

ingnelson avatar Feb 01 '20 16:02 ingnelson

@ingnelson That should work as long as you have the terminal. Either compile it yourself for ARM or download precompiled executables from releases page. Then cd in terminal to where executable is and run it.

berkant avatar Feb 02 '20 14:02 berkant

@Meteorite Do you know any way to use chisel as VPN, to make all traffic flow through it?

@0xbkt On rooted device you can use ProxyDroid, like I do (it is not a VPN, just traffic redirection via iptables). On non rooted device you can try smth, that intercepts traffic with the help of VpnService like this (I have not tried it though).

Meteorite avatar Feb 03 '20 19:02 Meteorite

@Meteorite Meteorite can you give me the commands to try it on Android using the Terminal Termux , please. I am not a programmer , I hope.you help me.

ingnelson avatar Feb 08 '20 05:02 ingnelson

I forked a recent fork of socksdroid and added chisel client support https://github.com/kawaiiDango/chiselsocksdroid (download link in readme). The apk size is large because it contains 4 copies of chisel, one for for each architecture.

kawaiiDango avatar Apr 16 '20 16:04 kawaiiDango

@kawaiiDango I just try the chisel app for Android and works very very well ! This app work better than a VPN . Thanks very much. This app it is great . I just sent to you a email with 2 questions . My email: [email protected] Or send me a telegram message at : https://t.me/Trader_Nelson I am trying to contact you. I hope your answer.

ingnelson avatar Apr 23 '20 15:04 ingnelson

I wonder whom you mailed to, since I didn't receive any and I dont have a publicly visible email address on my profile. Create an issue on my repo if this is related to the app and we will discuss there.

kawaiiDango avatar Apr 23 '20 15:04 kawaiiDango

@kawaiiDango look that GitHub do not let create an issue on your repo maybe because it is a for of a fork , and if I try to create a request it send me to sockdroid repo so I create it there . https://github.com/ycmmonkey/socksdroid/pull/1 I don't know if it was correct create it there . I will wait your answer.

ingnelson avatar Apr 23 '20 23:04 ingnelson

That is an unmerged pull request. I tried with --header "Foo: Bar" and it just gave the help text. The current version of chisel doesn't support headers except the host header through --host but I don't see a common use case for that, so I didn't implement a UI for it

kawaiiDango avatar Apr 24 '20 00:04 kawaiiDango

@kawaiiDango if the app has "http header" option I can add a "host" header that is not block by the firewall and the firewall think I am visiting the websites allowed . By the way if the app has a "server name indication" (SNI) option , I can add a host that the firewall allowed me to visit to bypass it, otherwise the firewall block me because it doesn't recognize the "server URL" from Chisel. IMG_20200424_091759

ingnelson avatar Apr 24 '20 15:04 ingnelson

It works perfectly even on a non-rooted android in Termux. Absolutely no issues. I used chisel_arm64 binary on Xiaomi A2lite. EDIT: For me it was enough get its embedded socks server working. About tunneling all the apps through Chisel client - no idea.

ezbik avatar Sep 07 '20 21:09 ezbik

@Meteorite Hello how do you use chisel with proxy droid?

It's working with chiselsocks proxy but with this solution I don't use local dns on my network despite I have create a remote port in chisel client on local dns so I would test another solution

vincentDcmps avatar Mar 03 '21 12:03 vincentDcmps

I tried to run chisel_arm64 binary in termux on my android but it did't recognize it. I copied over the extracted binary (from chisel_1.7.7_linux_arm64.gz) to the $home directory of termux and tried to run it. It didn't recognize the command also after a "chmod +777" on the file. Any help? Thanks!

Update: Do i need to build (with go build) with the source files again on my anroid? I tried that but it said that the go.mod file is missing here.

I wonder if maybe the file names are wrong here because he added somehow a _ infront...

Screenshot_20220717-173420

excelsi avatar Jul 17 '22 08:07 excelsi

I tried to run chisel_arm64 binary in termux on my android but it did't recognize it. I copied over the extracted binary (from chisel_1.7.7_linux_arm64.gz) to the $home directory of termux and tried to run it. It didn't recognize the command also after a "chmod +777" on the file. Any help? Thanks!

Update: Do i need to build (with go build) with the source files again on my anroid? I tried that but it said that the go.mod file is missing here.

I wonder if maybe the file names are wrong here because he added somehow a _ infront...

(https://user-images.githubusercontent.com/8747559/179405712-06b7d9ac-b5c0-440f-807a-a4e55f273f81.png)

I had a similar issue. I was able to get it running on my android by downloading the Android NDK and using that to help go cross-compile to android.

vetch101 avatar Jul 18 '22 10:07 vetch101

Thats nice .. do you have a little guidance for a non android Developer? 😉 Thanks!

excelsi avatar Jul 18 '22 11:07 excelsi

Hello,

I don't know if this can help but on my Android I have used https://github.com/kawaiiDango/chiselsocksdroid

vincentDcmps avatar Jul 18 '22 11:07 vincentDcmps

Thats nice .. do you have a little guidance for a non android Developer? 😉 Thanks!

Honestly, I wouldn't claim to be a developer, let alone an android one, but, I believe this is how I did it running on an Ubuntu box, so the various package names may be different on a different OS... You may also need Android Studio, which I installed around the same time, but I don't believe so,

sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 sudo apt install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python3-clang sudo apt install google-android-ndk-installer cd go/src/github.com/jpillora/chisel/ CGO_ENABLED=1 GOOS=android GOARCH=arm64 CC=/usr/lib/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang go build .

Good luck...

(Having said that, as @vincentDcmps suggests, it may be easier to use something prebuilt like chiselsocksdroid).

vetch101 avatar Jul 18 '22 12:07 vetch101

@vetch101 Thanks, will try!

excelsi avatar Jul 18 '22 14:07 excelsi

The build seems sucessfull but the chisel file that comes out still wasn't recognized as command in termux...maybe a hard computer science problem D: ... Or i missed something important here..

excelsi avatar Jul 18 '22 14:07 excelsi

Sorry to hear that; if you want to try it, here's the version that I built which is working on Termux my phone...

https://drive.google.com/file/d/1C3EmYhrhnMvFhnL9ENWNEMMdXwi0fU3d/view

vetch101 avatar Jul 18 '22 15:07 vetch101

Thanks bur in termux i hit a hard wall any way i try...will try chiselsocksdroid maybe also

excelsi avatar Jul 18 '22 15:07 excelsi

Fair enough; good luck

vetch101 avatar Jul 18 '22 15:07 vetch101

Solved my problem now with the required commands and syntax 😉

chmod +x chisel and ./chisel to call

excelsi avatar Jul 18 '22 16:07 excelsi

Ah yeah; makes sense.

Glad it's working for you now.

vetch101 avatar Jul 18 '22 16:07 vetch101

i got server running with,

chisel server -p 4449 --socks5 --auth xxx:yyy

but couldnt get chiselsocksdroid to work // Ama complete noob. can anyone help to get android app running.

thanks all

essoojay avatar Dec 09 '22 00:12 essoojay

Compile chisel with ENV GOOS=android GOARCH=arm or GOARCH=arm64

If you have Root Permission

Just copy the Binary to your phone and give executable permission. chmod +x chisel

else NO Root Permission

Install Termux from F-Droid (!!!! NOT !!!!! FROM GOOGLE PLAY STORE because Google hosting very old Version!)

Copy the Binary to your phone and then move the binary to your Termux Home Directory. You are only allowed to assign executbale Permission in the Termux Directory Structure.

The only Trick is to fix DNS Resolution because Go Applications looking for File /etc/resolv.cfg to resolv Domain Names. With #Fix2 you can map the /etc/resolv.cinf file from $PREFIX/etc/resolv.conf -> /etc/resolv.conf so Go will find the file! :-) The #Fix1 is kind of emulator and might leak performance of your running application.

Fix#1 You can use the Application termux-chroot this is kind of emulation and will intercept every system call and would make your Application run slower. But on fast phone CPU it doesn't matter.

Fix#2 You can install PROOT and run your command like proot -b $PREFIX/etc/resolv.conf:/etc/resolv.conf ./chisel client ...

0xE232FE avatar Dec 25 '22 10:12 0xE232FE