Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.23k stars 571 forks source link

gnirehtet relay in C/C++ language #78

Closed Biswa96 closed 6 years ago

Biswa96 commented 6 years ago

I'm trying to create your project in C++ just for learning. Ive some basic idea about socket and networking. I'm not so familiar with Java or Rust now. In the developer file, you've mentioned some library i.e. Java NIO and Rust mio. Is there any similar library in C/C++?

rom1v commented 6 years ago

I'm trying to create your project in C++ just for learning.

😃

Is there any similar library in C/C++?

In pure C, I think you can't avoid a platform dependent implementation (poll/epoll on Linux, iocp on Windows, kqueue on BSD/MacOS...).

In C++, there is Boost.Asio.

Biswa96 commented 6 years ago

Why is that asynchronous I/O feature needed? Can't I just open and close sockets to pass those network packets? I've recently seen libpcap/Winpcap driver to manipulate raw packets (into osi layer2). Can't just use that?

rom1v commented 6 years ago

Can't I just open and close sockets to pass those network packets?

You need to relay several connections at once, so you typically have several sockets open to different addresses on the Internet. If you use synchronous I/O (i.e. blocking calls) instead of asynchronous I/O, you'll need two threads per socket (for reading and writing).

I've recently seen libpcap/Winpcap driver to manipulate raw packets (into osi layer2). Can't just use that?

To manipulate raw packets, you need to be root (the main purpose of gnirehtet is to provide reverse tethering without root access). See https://github.com/vvviperrr/SimpleRT or https://github.com/google/vpn-reverse-tether.

Biswa96 commented 6 years ago

The readme file of Google VPN said this

This method leverages VpnService API and does not require root access.

rom1v commented 6 years ago

It does not require root access on the device, but it requires root access on the computer (sudo sudo).

Biswa96 commented 6 years ago

As I'm new to this field I'll go with your provided repo. I want to start with a simple one then I'll caome back to your project. Thanks for help... 😉 Closing....

Biswa96 commented 6 years ago

But one issue is common between those and your project. They can't allow Google Play Store to install apps, though one can surf Google Play Store to see apps. Did you find any cause for this issue? I see many user posted this issue in this repo.

rom1v commented 6 years ago

Did you find any cause for this issue?

A priori, it's a PlayStore bug. https://github.com/Genymobile/gnirehtet/issues/37#issuecomment-327212487

Biswa96 commented 5 years ago

@rom1v Is it possible to use gnirehtet's VPN -- to capture packets like Packet Capture or to change DNS like DNS Switch without root. The later two apps also use VPN.

rom1v commented 5 years ago

@Biswa96 gnirehtet (internally) does capture packets (and forward them to the relay server), and also configure a custom DNS (with the -d option).

But its purpose is not to capture/display packet content or change DNS on the device.

Biswa96 commented 5 years ago

Is there any future plan with GUI?