{"id":17978315,"url":"https://github.com/adrianvollmer/htun","last_synced_at":"2025-10-09T00:13:49.504Z","repository":{"id":45799541,"uuid":"148023254","full_name":"AdrianVollmer/htun","owner":"AdrianVollmer","description":"htun tunnels IP traffic transparently over HTTP or TCP ","archived":false,"fork":false,"pushed_at":"2023-10-18T01:49:16.000Z","size":35,"stargazers_count":138,"open_issues_count":1,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T06:41:20.858Z","etag":null,"topics":["http-tunnel","ipoverhttp","python","tunneling"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdrianVollmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-09T12:29:59.000Z","updated_at":"2025-03-20T15:03:00.000Z","dependencies_parsed_at":"2022-07-17T10:16:19.546Z","dependency_job_id":null,"html_url":"https://github.com/AdrianVollmer/htun","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AdrianVollmer/htun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianVollmer%2Fhtun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianVollmer%2Fhtun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianVollmer%2Fhtun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianVollmer%2Fhtun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdrianVollmer","download_url":"https://codeload.github.com/AdrianVollmer/htun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianVollmer%2Fhtun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000717,"owners_count":26082879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http-tunnel","ipoverhttp","python","tunneling"],"created_at":"2024-10-29T17:33:07.232Z","updated_at":"2025-10-09T00:13:49.489Z","avatar_url":"https://github.com/AdrianVollmer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"htun\n====\n\nhtun is a transparent tunnel for transporting IP traffic over HTTP or TCP.\n\nIt was developed with situations in mind where traffic to the internet is\nrestricted. For instance, some networks don't allow traffic to the internet\nat all and require you to go through an HTTP proxy. htun enables you to get\nfull internet access in those situations (all ports, all protocols). It also\nsupports using a SOCKS proxy.\n\nObviously, performance takes a huge hit. So it is meant for some light\nbrowsing or downloading small files sporadically. Expect transfer rates to\nbe cut by a factor of up to 100.\n\nAlso, it is not encrypted by default. It is recommended to put another\ntunnel on top, such as Wireguard.\n\nSince python-pytun is required, which is a non-portable module, this will\nonly run on Linux.\n\n\nRequirements\n------------\n\nTo run htun, you need Python3 and the following modules:\n* urllib3==1.24\n* python_pytun==2.2.1\n* pytun==1.0.1\n* SocksiPy_branch==1.01\n\nRecommended:\n\n* hexdump==3.3\n\n\nUsage\n-----\n\nThe script needs to be run with root privileges both on the server and the\nclient. On the server, run:\n\n    ./htun.py --server\n\nOn the client, run:\n\n    ./htun.py --uri \u003cSERVER URI\u003e\n\nBy default, it uses HTTP on port 80 and the IP addresses 10.13.37.1 and\n10.13.37.2 for the client and the server, respectively.\n\nFor all options, run `./htun.py --help`:\n\n    usage: htun.py [-h] [--debug] [--client-addr CADDR] [--server-addr SADDR]\n                   [--tun-netmask TMASK] [--tun-mtu TMTU] [--tun-timeout TIMEOUT]\n                   [--route-subnet RSUBNET] [--proxy PROXY] [--username USERNAME]\n                   [--password PASSWORD] [--listen-port LPORT] [--bind-ip BINDIP]\n                   (--server [{http,tcp}] | --uri URI)\n\n    htun tunnels IP traffic transparently over HTTP or TCP (author: Adrian\n    Vollmer)\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --debug, -d           debug flag to true (default: False)\n      --client-addr CADDR, -c CADDR\n                            tunnel local address (default: 10.13.37.1)\n      --server-addr SADDR, -s SADDR\n                            tunnel destination address (default: 10.13.37.2)\n      --tun-netmask TMASK, -m TMASK\n                            tunnel netmask (default: 255.255.255.0)\n      --tun-mtu TMTU        tunnel MTU (default: 1500)\n      --tun-timeout TIMEOUT\n                            r/w timeout in seconds (default: 1)\n      --route-subnet RSUBNET, -n RSUBNET\n                            subnet to be routed via tunnel (default: None)\n      --proxy PROXY, -P PROXY\n                            proxy URI (\u003cproto\u003e://\u003chost\u003e:\u003cport\u003e) (default: None)\n      --username USERNAME, -u USERNAME\n                            username for HTTP proxy basic authentication (default:\n                            None)\n      --password PASSWORD, -W PASSWORD\n                            password for HTTP proxy basic authentication (default:\n                            None)\n      --listen-port LPORT, -p LPORT\n                            listen port of the server component (default: 80)\n      --bind-ip BINDIP, -b BINDIP\n                            bind IP address of the server component (default:\n                            0.0.0.0)\n      --server [SERVER]     local port and bind address (http, tcp)\n                            (default: http)\n      --uri URI             remote URI (\u003cproto\u003e://\u003chost\u003e[:\u003cport\u003e]) (default: None)\n\n\nExamples\n--------\n\n### TCP Tunnel\n\nTo use a TCP tunnel on port 443, run\n\n    ./htun.py --server tcp -p 443\n\non the server side and\n\n    ./htun.py --uri tcp://\u003chost\u003e:443\n\non the client side. Now the client can reach the server via the IP address\n10.13.37.2\n\n### SOCKS Proxy\n\nTo use HTTP over a SOCKS5 proxy on port 5000, run\n\n    ./htun.py --server\n\non the server side and\n\n    ./htun.py --uri http://\u003chost\u003e --proxy socks5://\u003cproxy-host\u003e:5000\n\non the client side.\n\n### Proxy Authentication\n\nProxies using basic authentication are supported (but yet untested).\n\nA proxy requiring NTLM authentication is not supported because\n`python-urllib3` does not support NTLM. It is suggested to use `cntlm` as an\nadditional SOCKS proxy.\n\n\nPerformance\n-----------\n\nPerformance over a TCP tunnel is much better than over an HTTP tunnel.\nExpect several orders of magnitude in degradation of the connection when\nusing HTTP.\n\nExample downloading 713k bytes without the tunnel:\n\n\t$ curl https://example.com/example.png  \u003e /dev/null\n\t  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                     Dload  Upload   Total   Spent    Left  Speed\n\t100  713k  100  713k    0     0  2680k      0 --:--:-- --:--:-- --:--:-- 2680k\n\nDownloading the same file with an HTTP tunnel:\n\n\t$ curl https://example.com/example.png  \u003e /dev/null\n\t  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                     Dload  Upload   Total   Spent    Left  Speed\n    100  713k  100  713k    0     0  12177      0  0:00:59  0:00:59 --:--:-- 16590\n\nWith a TCP tunnel it's at least around 3% of the original speed:\n\n    $ curl https://example.com/example.png  \u003e /dev/null\n      % Total    % Received % Xferd  Average Speed   Time    Time     Time Current\n                                     Dload  Upload   Total   Spent    Left Speed\n    100  713k  100  713k    0     0  37640      0  0:00:19  0:00:19 --:--:-- 41086\n\n\nTo do\n-----\n\n* Make performance improvements when using HTTP\n* Experiment with threaded requests\n\n\nDisclaimer\n----------\n\nKeep in mind that the administrator of the network most likely did not want\nyou to bypass the restriction that were set up. The restriction is probably\nthere for a reason and you need to respect that. Using this tool may violate\nterms and conditions or company rules and may possibly even get you in legal\ntrouble and/or fired from your job.\n\nUse this only if you know that you have permission to use it by everyone\ninvolved.\n\n\nAuthor\n------\n\nAdrian Vollmer, 2018\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianvollmer%2Fhtun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianvollmer%2Fhtun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianvollmer%2Fhtun/lists"}