• Stars
    star
    6,200
  • Rank 6,469 (Top 0.2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gnirehtet provides reverse tethering for Android

Gnirehtet (v2.5)

This project provides reverse tethering over adb for Android: it allows devices to use the internet connection of the computer they are plugged on. It does not require any root access (neither on the device nor on the computer). It works on GNU/Linux, Windows and Mac OS.

Currently, it relays TCP and UDP over IPv4 traffic, but it does not support IPv6 (yet?).

This project is not actively maintained anymore, only major blockers (like build issues) are fixed. It should still work, though.

Flavors

Two implementations of Gnirehtet are available:

  • one in Java;
  • one in Rust.

Which one to choose?

Use the Rust implementation. The native binary consumes less CPU and memory, and does not require a Java runtime environment.

The relay server of Gnirehtet was initially only implemented in Java. As a benefit, the same "binary" runs on every platform having Java 8 runtime installed. It is still maintained to provide a working alternative in case of problems with the Rust version.

Requirements

The Android application requires at least API 21 (Android 5.0).

For the Java version only, Java 8 (JRE) is required on your computer. On Debian-based distros, install the package openjdk-8-jre.

adb

You need a recent version of adb (where adb reverse is implemented, it works with 1.0.36).

It is available in the Android SDK platform tools.

On Debian-based distros, you can alternatively install the package android-tools-adb.

On Windows, if you need adb only for this application, just download the platform-tools and extract the following files to the gnirehtet directory:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll

Make sure you enabled adb debugging on your device(s).

Get the app

Homebrew

If you use Homebrew, getting up and running is very quick. To install the Rust version:

brew install gnirehtet

Download

Download the latest release in the flavor you want.

Rust

Then extract it.

The Linux and MacOS archives contain:

  • gnirehtet.apk
  • gnirehtet

The Windows archive contains:

  • gnirehtet.apk
  • gnirehtet.exe
  • gnirehtet-run.cmd

Java

  • All platforms: gnirehtet-java-v2.5.zip
    (SHA-256: c65fc1a35e6b169ab6aa45e695c043e933f6fd650363aea7c2add0ecb0db27ca)

Then extract it. The archive contains:

  • gnirehtet.apk
  • gnirehtet.jar
  • gnirehtet
  • gnirehtet.cmd
  • gnirehtet-run.cmd

Run (simple)

Note: On Windows, replace ./gnirehtet by gnirehtet in the following commands.

The application has no UI, and is intended to be controlled from the computer only.

If you want to activate reverse tethering for exactly one device, just execute:

./gnirehtet run

Reverse tethering remains active until you press Ctrl+C.

On Windows, for convenience, you can double-click on gnirehtet-run.cmd instead (it just executes gnirehtet run, without requiring to open a terminal).

The very first start should open a popup to request permission:

request

A "key" logo appears in the status bar whenever Gnirehtet is active:

key

Alternatively, you can enable reverse tethering for all connected devices (present and future) by calling:

./gnirehtet autorun

Run

You can execute the actions separately (it may be useful if you want to reverse tether several devices simultaneously).

Start the relay server and keep it open:

./gnirehtet relay

Install the apk on your Android device:

./gnirehtet install [serial]

In another terminal, for each client, execute:

./gnirehtet start [serial]

To stop a client:

./gnirehtet stop [serial]

To reset the tunnel (useful to get the connection back when a device is unplugged and plugged back while gnirehtet is active):

./gnirehtet tunnel [serial]

The serial parameter is required only if adb devices outputs more than one device.

For advanced options, call ./gnirehtet without arguments to get more details.

Run manually

The gnirehtet program exposes a simple command-line interface that executes lower-level commands. You can call them manually instead.

To start the relay server:

./gnirehtet relay

To install the apk:

adb install -r gnirehtet.apk

To start a client:

adb reverse localabstract:gnirehtet tcp:31416
adb shell am start -a com.genymobile.gnirehtet.START \
    -n com.genymobile.gnirehtet/.GnirehtetActivity

To stop a client:

adb shell am start -a com.genymobile.gnirehtet.STOP \
    -n com.genymobile.gnirehtet/.GnirehtetActivity

Environment variables

ADB defines a custom path to the adb executable:

ADB=/path/to/my/adb ./gnirehtet run

GNIREHTET_APK defines a custom path to gnirehtet.apk:

GNIREHTET_APK=/usr/share/gnirehtet/gnirehtet.apk ./gnirehtet run

Why gnirehtet?

rev <<< tethering

(in Bash)

Developers

Read the developers page.

Licence

Copyright (C) 2017 Genymobile

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Articles

More Repositories

1

scrcpy

Display and control your Android device
C
107,934
star
2

mirror

Easy reflection for Java and Android
Java
343
star
3

genymotion-gradle-plugin

A plugin that allows you to control, simply, all your Genymotion devices from your Gradle scripts
Groovy
164
star
4

genymotion-device-web-player

Genymotion Virtual Device Web Player
JavaScript
89
star
5

genymotion-kernel

C
89
star
6

copydeps

Analyze and copy library dependencies of ELF binaries
Python
77
star
7

genymotion-binocle

Java
43
star
8

gm_pr

A multi project Github pull request viewer
Python
41
star
9

genymotion-saas-github-action

Set up your GitHub Actions workflow with a specific Genymotion Cloud SaaS
JavaScript
9
star
10

.github

Android as a Service
4
star
11

genymotion-cloud-ssl-tool

Shell
3
star
12

genymotion_platform_vendor_genymotion_security_public

This repo contains dev-keys and release-keys to sign Genymotion Desktop/Paas images.
Makefile
3
star
13

bitrise-step-genymotion-cloud-saas-stop

Go
2
star
14

f2ut_device_fairphone_FP2

C
2
star
15

bitrise-step-genymotion-cloud-saas-start

Go
2
star
16

genymotion-saas-orb

Shell
2
star
17

hiredis

C
2
star
18

f2ut_private_platform_manifest

2
star
19

f2ut_system_qcom

1
star
20

f2ut_platform_build

Makefile
1
star
21

f2ut_device_fairphone_sepolicy

1
star
22

f2ut_platform_frameworks_native

C++
1
star
23

f2ut_platform_vendor_fairphone

Makefile
1
star
24

f2ut_device_qcom_common

C
1
star
25

terraform-provider-genymotion

Terraform Genymotion provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
Go
1
star
26

f2ut_platform_hardware_qcom_display

1
star
27

f2ut_platform_system_extras

1
star
28

f2ut_device_fairphone_common

1
star
29

f2ut_platform_vendor_cm

1
star
30

f2ut_platform_platform_bionic

C
1
star
31

f2ut_system_vold

1
star
32

f2ut_device_fairphone

1
star
33

f2ut_platform_frameworks_base

1
star
34

f2ut_system_core

C
1
star
35

f2ut_kernel_fairphone

C
1
star
36

f2ut_platform_frameworks_av

C++
1
star
37

bitrise-step-genymotion-saas-install-gmsaas-cli

Go
1
star
38

f2ut_platform_hardware_qcom_audio

1
star