Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huawenyu/curl_tunnel
A tool proxy tunnel using libcurl, which forces another command tunneled over a proxy. Fork https://repo.or.cz/w/curltunnel.git
https://github.com/huawenyu/curl_tunnel
curl libcurl proxy tunnel
Last synced: 23 days ago
JSON representation
A tool proxy tunnel using libcurl, which forces another command tunneled over a proxy. Fork https://repo.or.cz/w/curltunnel.git
- Host: GitHub
- URL: https://github.com/huawenyu/curl_tunnel
- Owner: huawenyu
- License: mit
- Created: 2022-09-28T06:05:37.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-27T20:11:02.000Z (about 2 years ago)
- Last Synced: 2024-09-30T02:40:59.311Z (about 1 month ago)
- Topics: curl, libcurl, proxy, tunnel
- Language: C
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# curl_tunnel
A proxy tunnel using libcurl, fork https://repo.or.cz/w/curltunnel.git# Usage
echo hello | curltunnel -p ":" -u "a:a" -d "www.google.com:80"
# Build
## ubuntu
Choose one mode to install libcurl, depending on which we want to use for SSL:
+ gnutls,
+ openssl,
+ nss,```bash
$ sudo apt-get install libcurl4-gnutls-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install libcurl4-nss-dev
$ make
```# Design
Using iptable redirect the outbout traffic to local-in,
then `curltunnel` listen on this local-in port as the dummy-server side,
bypass the following traffic after setup tunnel to proxy/network-device by HTTP/HTTPS.Firstly, let check iptables works:
(LinuxPC) $ sudo iptables -t nat -A OUTPUT -p tcp --dport 54321 -j DNAT --to-destination 127.0.0.1:4444
(LinuxPC-shell_1) $ netcat -l 4444 ### setup local-in listen
(LinuxPC-shell_2) $ netcat www.google.com 54321 ### try to connect outboud public server
... try to input something ...(LinuxPC-shell_1) $
... Will show up the string input by shell_2 ...```C: Get the orginal server's IP address
// Get the original server address
struct sockaddr_in addr;
socklen_t addr_sz = sizeof(addr);
memset(&addr, 0, addr_sz);
addr.sin_family = AF_INET;
getsockopt(clientfd, SOL_IP, 80/*SO_ORIGINAL_DST*/, &addr, &addr_sz);
printf("The original server address is %s\n", inet_ntoa(addr.sin_addr));
```