htun: transparent tunnel for transporting IP traffic over HTTP or TCP

htun

htun is a transparent tunnel for transporting IP traffic over HTTP or TCP.

It was developed with situations in mind where traffic to the internet is restricted. For instance, some networks don’t allow traffic to the internet at all and require you to go through an HTTP proxy. htun enables you to get full internet access in those situations (all ports, all protocols). It also supports using a SOCKS proxy.

Obviously, performance takes a huge it. So it is meant for some light browsing or downloading small files sporadically. Expect transfer rates to be cut by a factor of up to 100.

Also, it is not encrypted by default. It is recommended to put another tunnel on top, such as Wireguard.

Since python-pytun is required, which is a non-portable module, this will only run on Linux.

Install

git clone https://github.com/AdrianVollmer/htun.git

pip3 install -r requirements.txt

Use

By default, it uses HTTP on port 80 and the IP addresses 10.13.37.1 and 10.13.37.2 for the client and the server, respectively.

transparent tunnel

Example

TCP Tunnel

To use a TCP tunnel on port 443, run

./htun.py --server tcp -p 443

on the server side and

./htun.py --uri tcp://<host>:443

on the client side. Now the client can reach the server via the IP address 10.13.37.2

SOCKS Proxy

To use HTTP over a SOCKS5 proxy on port 5000, run

./htun.py --server

on the server side and

./htun.py --uri http://<host> --proxy socks5://<proxy-host>:5000

on the client side.

Tutorial

Copyright (c) 2018 Adrian Vollmer

Share