Home » Android » java – Android http Tunnel using VpnService

java – Android http Tunnel using VpnService

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m trying to redirect the whole android network traffic through HTTP Tunnel, and there is no tutorial or Github Repository on how to do it.

Simply just get the host, port, username, and password from the user and tunnel the whole device to that host programmatically.

I have configured an HTTP-Proxy server with squid, just need a client to connect to it.

I don’t want an Open-VPN solution or StrongSwan, this app named TOOFAN Tunnel, is doing what exactly I need, but it’s only available in some countries and it is not an open-source project.

Just need someone to show me the path or put me in the right direction, I appreciate it in advance.

I know about Android’s VpnServise, and how it redirects the traffic, I just don’t know to implement a socket to transfer packets through an HTTP proxy with credentials.

I had built and tested more than 20 repositories but none worked. Some of them are:
SSLSocks, TunProxy, VpnProxy, SmartProxy, NetDroidProxy, LocalVPN, xSocks-android, prox.

How to&Answers:

A customized Android VpnService capture IP packets, filter HTTP/HTTPS requests, modify header(such as basic authorization header) or add connect method(for https request) and redirect packets to http proxy.

For TunProxy, consider modify code https://github.com/raise-isayan/TunProxy/blob/master/android_app/app/src/main/cpp/tcp.c line:733-746, connect method was originally added in this position, similar modifications can be made here.

Ref:
1. https://github.com/raise-isayan/TunProxy
2. https://github.com/forbe/tun2http