Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.11k stars 564 forks source link

Auto-Stop and WiFi-Simulation #328

Open simonferndriger opened 3 years ago

simonferndriger commented 3 years ago

All-in-all a great app. What would make it perfect for me are the following two feature requests:

Auto-Stop Once, gnirehtet is running on my phone, it runs. So, when I plug the USB cable out of my phone, with gnirehtet running, my mobile phone is unable to use the mobile internet connection. It only works again after I (manually) stop gnirehtet. So it would be awesome if gnirehtet would stop itself automatically, after the USB cable is pulled out of the phone.

WiFi-Simulation Unfortunately, still some major apps rely specifically on a WiFi connection (or are unable to run with reverse tethering) like the Play Store, Google Contact Sync or MIUI updater. So it would be immensly cool if gnirehtet could pretend to be a WiFi connection so these stupid apps (telling me I have no internet connection while using gnirehtet) would finally work as they are supposed to.

Biswa96 commented 3 years ago

In my case, Google Play Store works since beginning, tested with Android 6 and 10.

simonferndriger commented 3 years ago

Well, the store "works" for me in that way, that I can search for apps etc. But updating and installing doesn't work (Android 8.1.0) - it always says "Waiting for download..." (I can't update to Android 10 unfortunately, since MIUI 11 is the latest version I can install today), but great that it will work with 10!

rom1v commented 3 years ago

See #51 and #102

Close on disconnect is not implemented yet. I have no solution for the PlayStore issue.

simonferndriger commented 3 years ago

Well, that's at least some good news - maybe Google Play Store will work soon on my phone too. So with #51 coming up that will be awesome! 👍

simonferndriger commented 3 years ago

In my case, Google Play Store works since beginning, tested with Android 6 and 10.

PlayStore works sometimes, sometimes it doesn't. It's almost like the developers enjoy playing with people's emotions. Currently, I run 22.4.25-21 [0] [PR] 337959405 and it doesn't work at all with gnirehtet :(

imonlygitting commented 3 years ago

shame play store issue is not yet circumventable...

also having issues with whatsapp where web.whatsapp.com on browser does not update (or shows 'phone not connected' message), but works again once i turn wifi back on on the phone. anyone with similar issues, and know how to get round it?

simonferndriger commented 3 years ago

@imonlygitting I also get the web.whatsapp problem sometimes, however, unpluging and re-pluging the phone to the USB cable and/or closing web.whatsapp and reopening it again does the trick for me usually.

hDmtP commented 3 years ago

After running gnirehtet run command in my cmd it works as it is expected. Reverse tethering works properly. But in case of some Google PlayStore App, it notifies that a data network or wifi is required. Even my Android System update demands the same thing claiming there is no network connection although gnirehtet.cmd is running properly. But in other cases, this package works like a charm.

imonlygitting commented 3 years ago

Also want to ask dev whether having 1) multiple phones connected to same gnirehtet window causes problems in any way (i do get whatsapp/playstore issues); and 2) having gnirehtet windows on multiple pcs (eg home pc and work pc) causes problems in any way (or put another way, code takes care of these complexities)?

this program is a life saver and i use it all the time... thanks to the community for continued support

rom1v commented 3 years ago

multiple phones connected to same gnirehtet window causes problems in any way

It should not.

having gnirehtet windows on multiple pcs (eg home pc and work pc)

What do you mean? If it's installed on one computer, it could not conflict with the one on another computer. :thinking:

GameDevIvan commented 3 years ago

You can use Aurora Store (get it from F-Droid), it's a proxy for the google play store. Works with all free apps.

LeeBinder commented 2 years ago

Robin Christianne Juson has solved the Play Store issue in his/ her Tetrd app, verified by me in LineageOS 18.1/ Android 11 on my Nokia 6.1 with different versions of the Play Store app. Both, updating existing apps and installing new ones, work. No extra fakeWifi app necessary. Tetrd uses a IP v.4 VPN in the 10.x subnet. IP v.6 can remain inactive (default).

@rom1v maybe you have a chance to look at its code for inspiration :)

rom1v commented 2 years ago

maybe you have a chance to look at its code for inspiration :)

It looks like a proprietary app, it's not open source (the code is not published).

rom1v commented 2 years ago

After a quick look at the API, maybe calling ConnectivityManager.bindProcessToNetwork() here may help:

https://github.com/Genymobile/gnirehtet/blob/f5c0710c751f7ca82ce413058abc57d9af7208c3/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java#L157

LeeBinder commented 2 years ago

yes, proprietary, but still sometimes it's possible to gain some insights nevertheless, even without reversing/ decoding the binary data into readable programming language code. Above all I wanted to let y'all know it's possible.

Great find, that line of code 👍 . Maybe it's easier to solve this issue than thought until now :)

casper commented 1 year ago

Just upgraded to Android 11 and gnirehtet which was working fine on 10 basically stopped working on 11 (only Chrome browsing works). Tetrd or fake wifi is not an option in my case :(

So only option is to downgrade back to 10, or is there some way to do what Tetrd does?

LeeBinder commented 1 year ago

@casper why is Tetrd not an option for you? I also have fiddled endlessly in Android 11; Tetrd proved to be the ONLY working option! The €6,49 in-App purchase for the Pro upgrade was an absolutely worthwhile investment. That small price tag really shouldn't be an obstacle, and I hope that's not why you're hesitant..

Other than that, Google has been deciding with each upgrade that we users have less and less wiggle-room for doing stuff OUR way, faking "security concerns". If you're fine with A10 and don't need any A11/12/13 bells & whistles, then do downgrade to A10. (Many things stopped working in A11, esp. related to scoped storage).

casper commented 1 year ago

Hey @LeeBinder , thanks a lot for your reply. My main problem with Tetrd is that it requires Windows 7+ 64-bit, and I am on an old computer which I cannot upgrade (very long story).

However I will say that after a few hours of fiddling I managed to get Gnirehtet to work on Android 11, but it required a SIM with a data plan, a Xiaomi account, and enabling mobile data while Gnirehtet is running, like posted here on another issue.

With that combo it works, and mobile data is not used while the Gnirehtet VPN is active even through mobile data is on.

Lots of silly tricks. I may still consider to go back to A10. Or maybe better to get a small single board MiniPC, just to run Win10 so I can run Tetrd. Probably what I will have to do. Anyway..for now it kind of works as long as you jump through all the hoops. Thanks.

LeeBinder commented 1 year ago

You're welcome. Ok I understand. Just: why is a "Xiaomi account" required for you - what purpose does it serve in this context?

casper commented 1 year ago

It has something to do with the permission requirements for USB debugging. I guess it's only a Xiaomi issue. See the post here: https://github.com/Genymobile/gnirehtet/issues/5#issuecomment-297045539 .

Those options cannot be enabled without activating a Xiaomi account first (which requires a network connection :) ...there is a chicken and egg issue for you, so a SIM with data is needed also to get past that step).

RNNScientist commented 5 months ago

Try turning on wifi and mobile data while gnirehtet is running. This makes playstore and apps work without gnirehtet without actually having to use mobile data or wifi.

NA0341 commented 4 months ago

"Play Store works since beginning (Android 6 & 10)" "Play Store "works" (can search for apps etc.) but updating and installing doesn't work (Android 8.1.0) - it always says "Waiting for download..." " "PlayStore works sometimes, sometimes it doesn't."

I had the exact same issues with some applications at first. Most of them resolved by themselves. For the Play Store issue, you can swap with Aurora Store

Telegram (Nekogram X) wouldn't connect at first - but magically did after some time. The same goes for (almost) all other applications. And the performace & throughput is amazing on fast connections!

@GameDevIvan said:

You can use Aurora Store (get it from F-Droid), it's a proxy for the google play store. Works with all free apps.

Aurora Store acutally supports logging in with your very own Google account and thus accessing your purchased applications. I don't know about new purchases though.

NA0341 commented 4 months ago

Robin Christianne Juson has solved the Play Store issue in his/ her Tetrd app, verified by me in LineageOS 18.1/ Android 11 on my Nokia 6.1 with different versions of the Play Store app. Both, updating existing apps and installing new ones, work. No extra fakeWifi app necessary. Tetrd uses a IP v.4 VPN in the 10.x subnet. IP v.6 can remain inactive (default).

@rom1v maybe you have a chance to look at its code for inspiration :)

KDE-Connect doesn't connect at all wen using gnirehtet. Maybe it's due to it's peer discovery only scanning IP v.4?

Suggestion: Would it be technically possible to have both a IP v.4 & v.6 - connection? Or to switch between connection types on desktop?

For all who know what KDE-Connect is: You know how much of a Dealbreaker this is ^^

LeeBinder commented 4 months ago

@NA0341 I'm not using KDE-Connect, but have you tried if re-Link allows KDE-Connect to connect between your computer and the mobile device?