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

gnirehtet can not run as service in Android #40

Closed
Biswa96 opened this issue Sep 10, 2017 · 18 comments
Closed

gnirehtet can not run as service in Android #40

Biswa96 opened this issue Sep 10, 2017 · 18 comments

Comments

@Biswa96
Copy link

Biswa96 commented Sep 10, 2017

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?

@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2017

See #5 (comment).

@Biswa96
Copy link
Author

Biswa96 commented Sep 10, 2017

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
Copy link
Collaborator

rom1v commented Sep 10, 2017

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.

@Biswa96
Copy link
Author

Biswa96 commented Sep 10, 2017

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
Copy link
Collaborator

rom1v commented Sep 10, 2017

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.

@Biswa96
Copy link
Author

Biswa96 commented Sep 10, 2017

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
Copy link
Collaborator

rom1v commented Sep 10, 2017

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.

@Biswa96
Copy link
Author

Biswa96 commented Apr 15, 2018

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.

@timea-techgirl
Copy link

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.

@Biswa96
Copy link
Author

Biswa96 commented Nov 16, 2019

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.

@timea-techgirl
Copy link

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

@xyl-san
Copy link

xyl-san commented Dec 21, 2019

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.

@Biswa96
Copy link
Author

Biswa96 commented Dec 21, 2019

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

@xyl-san
Copy link

xyl-san commented Dec 22, 2019

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

@Biswa96
Copy link
Author

Biswa96 commented Dec 22, 2019

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

@adityakaushal5nov
Copy link

@Biswa96 Thanks for the help :)

@tvinki899
Copy link

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

@Hevin007
Copy link

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

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

8 participants
@rom1v @timea-techgirl @Hevin007 @adityakaushal5nov @Biswa96 @tvinki899 @xyl-san and others