Mygod/VPNHotspot

Support Non-Rooting devices

IHNEL opened this issue ยท 21 comments

IHNEL commented

Hi @Mygod
I understand that this code need to execute some commands with super-user permission and it only works on rooted devices. But I'm curious to make it work on non-rooted device too.

Is there any way to make internet sharing via Wifi Direct on non-rooted devices? Any hint are appreciated.

Cheers

Mygod commented

This app requires root to make changes to iptables and ip rule. This restriction is imposed by Linux kernel.

If you want to create a Wi-Fi repeater, you can try alternatives like PdaNet+ and NetShare-no-root-tethering. (note: these apps are neither free nor open source)

But if you don't feel like paying for those apps or you just want to share your VPN (for WLAN or mobile hotspot), you can alternatively use this app with a proxy server, e.g. Proxy Server (disclaimer: I have not tried this app), and set up your clients to use your Android device as proxy.

By the way, here are some other features you should be able to get with this app without root:

  • View connected devices for system tethering and monitor them; (also get country flags based on their MAC addresses)
  • Create a hotspot that has only LAN connections;
  • Turn on/off system tethering if you can't do it already;
  • Play around with settings and the user interface in general. ๐Ÿ˜›

@Mygod
Thanks for this answer. This is something I am VERY interested in.
I have 2 questions, please:

  • When you say "Toggle tether switches if you can't do it already", what do you mean?
  • The Proxy Server app works (I tried it: in conjunction with a WiFi-direct connection and some elementary client side configuration, traffic is routed to the Internet) but isn't open source. Do you know of some code that could help us build a simple proxy server?

This app requires root to make changes to iptables and ip rule. This restriction is imposed by Linux kernel. To share Wi-Fi without root, you can try alternatives like PdaNet+ and NetShare-no-root-tethering. (note: these apps are neither free nor open source)

But if you don't feel like paying for those apps, you can alternatively use this app with a proxy server, e.g. Proxy Server (disclaimer: I have not tried this app), and set up your clients to use your Android device as proxy.

By the way, here are some other features you should be able to get with this app without root:

  • View connected devices for system tethering and monitor them;
  • Create a hotspot that has only LAN connections;
  • Toggle tether switches if you can't do it already;
  • Play around with settings and the user interface in general. ๐Ÿ˜›

Another remark:
Using the Proxy Server way only works if you want to repeat a WiFi network on which you are connected, it seems to me. If you try while being connected on 4G, it won't work. Correct me if I am wrong :).

Mygod commented

When you say "Toggle tether switches if you can't do it already", what do you mean?

I updated the original comment.

The Proxy Server app works (I tried it: in conjunction with a WiFi-direct connection and some elementary client side configuration, traffic is routed to the Internet) but isn't open source. Do you know of some code that could help us build a simple proxy server?

https://lmgtfy.com/?q=linux+proxy+server

Using the Proxy Server way only works if you want to repeat a WiFi network on which you are connected, it seems to me. If you try while being connected on 4G, it won't work. Correct me if I am wrong :).

You are wrong. :)

It's theoretically possible at least but for now I'm not interested.

IHNEL commented

@Mygod
Could you please lets me know if we are able to support non-rooted devices by using custom iptable command?
Below is the link to another open source which use the custom iptable seems.

ref: https://github.com/staf621/ki4a/blob/3e3099ebbfa08cdad18fde064f6c5751227068ec/src/main/java/com/staf621/ki4a/ki4aService.java#L439

Mygod commented

You do not need root to run iptables binary. You need root to communicate to the kernel to modify iptables. If you can bypass that, it would be considered a security loophole.

IHNEL commented

Does it make sense if we will modify the iptables first out side , then execute it in app?

FYI: I am investigating about the possibility of solution to route all network traffics.

Mygod commented

You either find a way to talk to kernel directly or talk to netd indirectly. Either way, I'm sure Google will be happy to give you money if you managed to do that (and probably fix it in their next security update).

Anyone have luck going rootless using Shizuku?

Ordered a new Pixel 8 pro, and don't want to root this time, so looking into alternatives for root abilities without rooting to run some of my favorite apps.

@Mygod I would also like to see Shizuku support. In some cases, ADB can be executed as root, thereby granting Shizuku root privileges, enabling it to modify iptables.

Already checked, does not give access to use iptables. Just gives the ability to see the filesystem

Meaning technically no luck, even if they are willing to look into it further?

Already checked, does not give access to use iptables. Just gives the ability to see the filesystem

did you start shizuku in root mode through adb? while adb has full root access, there is nothing that can limit shizuku to run iptables.

photo_2024-03-31_22-07-04

You would need root access for that feature.

This thread is for rootless

I'm using lineageos that allows to run adb in root mode. I'm looking for the shizuku support because I don't want to install magisk.

Correct, unless another rootless method is found, this isn't possible for now. On the bright side, i switched to using pairvpn. It's made by the people who created PDAnet. It's pretty much the same concept of this just 1 extra step. 1. Start your hotspot 2. Connect the client 3. Start/Connect PairVPN It creates a vpn tunnel from the client to the phone via the hotspot so all traffic comes from the phone bypassing the tether counter. Works great and is just as fast and reliable as being just in the hotspot, and unlike 0danet or other alternatives, doesn't require config or proxys

I need my phone to be already on VPN and share the vpn connection back to my desktop. Pairvpn doesn't seem to allow me to do it. It rather says, "This device has an active VPN connection. You need to disconnect it first before connecting PairVPN because chained VPN is not supported."

I'm using lineageos that allows to run adb in root mode. I'm looking for the shizuku support because I don't want to install magisk.

There are plenty of su managers out there that only need root like supersu.

Correct, unless another rootless method is found, this isn't possible for now. On the bright side, i switched to using pairvpn. It's made by the people who created PDAnet. It's pretty much the same concept of this just 1 extra step. 1. Start your hotspot 2. Connect the client 3. Start/Connect PairVPN It creates a vpn tunnel from the client to the phone via the hotspot so all traffic comes from the phone bypassing the tether counter. Works great and is just as fast and reliable as being just in the hotspot, and unlike 0danet or other alternatives, doesn't require config or proxys

I need my phone to be already on VPN and share the vpn connection back to my desktop. Pairvpn doesn't seem to allow me to do it. It rather says, "This device has an active VPN connection. You need to disconnect it first before connecting PairVPN because chained VPN is not supported."

Do you need the VPN to access services or resources behind it?

If it's just to hide tether, then it's no longer needed.

If you need to access local services behind the VPN, then you can try using a proxy or wireguard.

There is software like proxifier that can tunnel all or selected apps through a proxy, or wireguard which should be able to be ran alongside the vpn

There are plenty of su managers out there that only need root like supersu.

I don't want to use su managers. I'd like to enable root access only via adb and shizuku. Don't ask why.

There are plenty of su managers out there that only need root like supersu.

I don't want to use su managers. I'd like to enable root access only via adb and shizuku. Don't ask why.

Well shizuku i don't think it's the right tool for you then. It only gives access to the filesystem, nothing beyond that.

Also it looks like the github repo might be dead

AppOps or tasker may be able to do something for you though but not sure