Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.44k stars 590 forks source link

broken on torsocks #558

Open bruceleerabbit opened 1 month ago

bruceleerabbit commented 1 month ago

This works fine, which is the normal case over clearnet:

GNIREHTET_APK=/my_apk_files/gnirehtet_v25.apk /usr/local/bin/gnirehtet run

But if gnirehtet is run on torsocks to proxy over tor, it falls apart because gnirehtet needs to make local connections:

$ GNIREHTET_APK=/my_apk_files/gnirehtet_v25.apk torsocks /usr/local/bin/gnirehtet run
... WARNING torsocks[…]: [connect] Connection to a local address are denied since it might be a TCP DNS query to a local DNS server. Rejecting it for safety reasons. (in tsocks_connect() at connect.c:191)
error: could not install *smartsocket* listener: Address already in use

* failed to start daemon
error: cannot connect to daemon
ERROR Main: Cannot stop client: Command adb ["shell", "am", "start", "-a", "com.genymobile.gnirehtet.STOP", "-n", "com.genymobile.gnirehtet/.GnirehtetActivity"] returned with value 1

This is related to bug #329 by @Kardshadow. The readme shows some manual ways of running gnirehtet. I’m sure just one of those commands needs to run on torsocks, but whichever command that is, it’s likely also broken in this regard because it will need to talk locally.

Gnirehtet really needs specific support for proxying.

It’s an important feature. Mind boggling that it was not built into the original design because Android devices are “chatty”. When running gnirehtet it’s immediately clear that there are unnecessary connections phoning home to Google. So the very first concern should be a way to anonymise that traffic and also to (egress) firewall it to stop the data leaks.