Genymobile/gnirehtet

gnirehtet can not run as service in Android

Biswa96 opened this issue ยท 18 comments

After running the relay server with javaw -jar relay.jar, I ran the command adb -s %serial% shell am startservice -a com.genymobile.gnirehtet.START --esa dsnServers 8.8.8.8 in command prompt. But that gave some error.

Starting service: Intent { act=com.genymobile.gnirehtet.START (has extras) }
Error: Requires permission android.permission.WRITE_SECURE_SETTINGS

My smartphone is Redmi 3S with MIUI8 and Android 6.0.1. What is that error? How do I solve that?

I can enable USB Debugging in Developer Mode. But enabling USB Debugging Security Settings requires to create MI account. I do not want to create that account. Here is the screenshot of android developer settings.

  • Isn't there a way to reverse tethering just with adb.exe -s %serial% reverse tcp:port tcp:port command and with making a VPN in Android client?
rom1v commented

But enabling USB Debugging Security Settings requires to create MI account.

๐Ÿ˜•

Isn't there a way to reverse tethering just with adb.exe -s %serial% reverse tcp:port tcp:port command and with making a VPN in Android client?

The gnirehtet Android client is intended to be controlled from the computer only, there is no UI.

That's unfortunate that some vendors change some default Android behavior and prevent the settings to be changed without registering an account with them. Currently, I have no good solution.

If you know how to build, as a workaround, you can just remove this android:permission field in AndroidManifest.xml.

I want to reverse tethering with only adb.exe command line tool and not with relay.jar and not with .APK. Is that possible?

rom1v commented

I want to reverse tethering with only adb.exe command line tool and not with reply.jar and not with .APK. Is that possible?

No, that's not possible (otherwise, gniretet would be useless).

The word reverse in adb reverse stands for reverse port forwarding, not reverse tethering.

As you say, I remove the android:permission="android.permission.WRITE_SECURE_SETTINGS" line from AndroidManifest.xml file. And now I am fully able to reverse tethering in my Redmi 3S. My problem is solved. Thank you. ๐Ÿ˜

You should add this tweak in readme file. But I edit that with Apk Editor Pro app. How does this tweak solve my issue? How can I edit that xml file in PC? Notepad++ does not open that xml file as text!

rom1v commented

Cool ๐Ÿ‘

How does this tweak solve my issue?

Gnirehtet requests a WRITE_SECURE_SETTINGS permission for reasons explained in e7b8407.

Your vendor-version of Android refuses to grant it (without enabling some settings that requires to register an account with them), so this tweak just makes Gnirehtet not requesting the permission.

How can I edit that xml file in PC? How can I edit that xml file in PC?

If you download the raw source file, it should. If you tried to open the APK as a zip, yes, AndroidManifest.xml is in some binary XML format.

Is there any automatic build process like Appveyor, Travis etc. where I can build this project. I don't want to setup Android and rust environment in my PC. And I've to edit the manifest file for my Redmi 3S.

But enabling USB Debugging Security Settings requires to create MI account.

๐Ÿ˜•

This can be bypassed if a device has root.
First, run the following commands:
adb shell
su
setprop persist.security.adbinstall 1

If you also want to enable "USB debugging (Security settings)", for granting permissions, simulating UI input, etc. via ADB, run the following command too:
setprop persist.security.adbinput 1

Next, we need to edit the file,
/data/data/com.miui.securitycenter/shared_prefs/remote_provider_preferences.xml

Add the following line to the XML file (with all the other ones, before the closing tag, or change it to true if the line is already there):
<boolean name="security_adb_install_enable" value="true" />

Reboot your device.

This can be bypassed if a device has root.

Anything can be done with root access in any Android device or any PC ๐Ÿ˜Ž Also the main feature of gnirehtet is that it does not require any root access.

Even if you root, it'll still ask you to sign in to enable debugging.
Lots of people, even with root are struggling to enable debugging without creating an account. Not everyone knows everything. It's a tip for root users who don't know about it. :)

As you say, I remove the android:permission="android.permission.WRITE_SECURE_SETTINGS" line from AndroidManifest.xml file. And now I am fully able to reverse tethering in my Redmi 3S. My problem is solved. Thank you. ๐Ÿ˜

You should add this tweak in readme file. But I edit that with Apk Editor Pro app. How does this tweak solve my issue? How can I edit that xml file in PC? Notepad++ does not open that xml file as text!

Sir can you give the build that you use for Your Redmi 3S? I am still a beginner so I cannot understand well what to do. And I can only do it on computer shops which I have access for about 1 hour. I want to use your build for my realme 5. I would really appreciate it sir.

@XylverXVI Added the APK only https://github.com/Biswa96/gnirehtet-miui/releases. Download the server side binary from gnirehtet release page.

Many thanks Sir! I tried it just now. It finally works! Can I share the APK file to my friends Sir?

I am not the original developer. There is no restriction from my side. @rom1v may help.

@Biswa96 Thanks for the help :)

@Biswa96 ty bro! i fucking trying fix this problem all day yesterday

Thanks, this answer fix my problem to enable "USB debugging (Security settings)"