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

How to use in Android? #86

Open
simonho234 opened this issue Mar 13, 2019 · 33 comments
Open

How to use in Android? #86

simonho234 opened this issue Mar 13, 2019 · 33 comments

Comments

@simonho234
Copy link

No description provided.

@jpillora
Copy link
Owner

jpillora commented Mar 13, 2019 via email

@Meteorite
Copy link
Contributor

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.

@berkant
Copy link

berkant commented Jan 21, 2020

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

@ingnelson
Copy link

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

@ingnelson
Copy link

ingnelson commented Feb 1, 2020

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 ?.

@berkant
Copy link

berkant commented Feb 2, 2020

@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.

@Meteorite
Copy link
Contributor

Meteorite commented Feb 3, 2020

@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).

@ingnelson
Copy link

@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.

@kawaiiDango
Copy link

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.

@ingnelson
Copy link

ingnelson commented Apr 23, 2020

@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: ingnelson86@gmail.com
Or send me a telegram message at : https://t.me/Trader_Nelson
I am trying to contact you.
I hope your answer.

@kawaiiDango
Copy link

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.

@ingnelson
Copy link

@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 .
ycmmonkey/socksdroid#1
I don't know if it was correct create it there .
I will wait your answer.

@kawaiiDango
Copy link

kawaiiDango commented Apr 24, 2020

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

@ingnelson
Copy link

ingnelson commented Apr 24, 2020

@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

@ezbik
Copy link

ezbik commented Sep 7, 2020

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.

@vincentDcmps
Copy link

vincentDcmps commented Mar 3, 2021

@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

@excelsi
Copy link

excelsi commented Jul 17, 2022

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

@vetch101
Copy link

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.

@excelsi
Copy link

excelsi commented Jul 18, 2022

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

@vincentDcmps
Copy link

Hello,

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

@vetch101
Copy link

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).

@excelsi
Copy link

excelsi commented Jul 18, 2022

@vetch101 Thanks, will try!

@excelsi
Copy link

excelsi commented Jul 18, 2022

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..

@vetch101
Copy link

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

@excelsi
Copy link

excelsi commented Jul 18, 2022

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

@vetch101
Copy link

Fair enough; good luck

@excelsi
Copy link

excelsi commented Jul 18, 2022

Solved my problem now with the required commands and syntax 😉

chmod +x chisel
and
./chisel
to call

@vetch101
Copy link

Ah yeah; makes sense.

Glad it's working for you now.

@essoojay
Copy link

essoojay commented Dec 9, 2022

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

@0xE232FE
Copy link

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 ...

@essoojay
Copy link

essoojay commented Dec 26, 2022

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 ...

Thank you for your response, I appreciate. I ran the proot command and fix2 threw up this error:

can't sanitize binding "/data/data/com.termux/files/usr/etc/resolv.conf": No such file or directory

Am a complete noob, hopefully you can help here too

Thank you

@MasterKia
Copy link

The ultimate solution to run Chisel on Android using Termux (thanks to @essoojay)

Download the ARM64 version of Chisel for GNU/Linux and make it executable.
Enter:
nano $PREFIX/etc/resolv.conf

File content should be:
nameserver 1.1.1.1

Then save the file and use:
proot -b $PREFIX/etc/resolv.conf:/etc/resolv.conf ./chisel client ...

@MasterKia
Copy link

termux/termux-packages#9721 (comment):

The fix in this PR does not apply to pre-built binaries or build for other platform than Android. We won't fix for these cases.

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