http通道 就是http代理 可以用来FQ——本质上是http上封装tcp协议!
见https://github.com/jpillora/chisel,我使用chisel,本质上是http上封装tcp协议!
下载方法:
program: chisel release: 1.2.3 release assets: [#01] https://github.com/jpillora/chisel/releases/download/1.2.3/chisel_darwin_386.gz [#02] https://github.com/jpillora/chisel/releases/download/1.2.3/chisel_darwin_amd64.gz [#03] https://github.com/jpillora/chisel/releases/download/1.2.3/chisel_linux_386.gz [#04] https://github.com/jpillora/chisel/releases/download/1.2.3/chisel_linux_amd64.gz [#05] https://github.com/jpillora/chisel/releases/download/1.2.3/chisel_linux_arm.gz
wget -c https://github.com/jpillora/chisel/releases/download/1.2.3/chisel_linux_amd64.gz
然后使用gunzip xxx.gz解压后,chmod a+rx xxx
在vps机器上:
./chisel_linux_amd64 server -v -p 1080 --socks5 2018/06/04 07:15:21 server: SOCKS5 Enabled 2018/06/04 07:15:21 server: Fingerprint 72:45:e8:a7:ba:03:db:83:1f:aa:c6:70:ff:c1:2e:8d 2018/06/04 07:15:21 server: Listening on 1080... 2018/06/04 07:15:24 server: session#1: Handshaking... 2018/06/04 07:15:27 server: session#1: Verifying configuration 2018/06/04 07:15:27 server: session#1: Open
访问http://149.28.72.184:1080/可以看到web页面,提示:Not found,其中149.28.72.184是vps机器。
然后在本地使用:
./chisel_darwin_amd64 client -v 149.28.72.184:1080 socks 2018/06/04 15:17:11 client: Connecting to ws://149.28.72.184:1080 2018/06/04 15:17:11 client: tunnel#1 127.0.0.1:1080=>socks: Listening 2018/06/04 15:17:12 client: Handshaking... 2018/06/04 15:17:14 client: Fingerprint 72:45:e8:a7:ba:03:db:83:1f:aa:c6:70:ff:c1:2e:8d 2018/06/04 15:17:15 client: Sending config 2018/06/04 15:17:16 client: Connected (Latency 409.226747ms) 2018/06/04 15:17:17 client: tunnel#1 127.0.0.1:1080=>socks: conn#1: Open 2018/06/04 15:17:17 client: tunnel#1 127.0.0.1:1080=>socks: conn#2: Open 2018/06/04 15:17:17 client: tunnel#1 127.0.0.1:1080=>socks: conn#1: Close (sent 3 received 0) 2018/06/04 15:17:17 client: tunnel#1 127.0.0.1:1080=>socks: conn#2: Close (sent 3 received 0)
使用本地代码,socks5,127.0.0.1,端口1080然后输入google.ca即可访问谷歌了。
将1080修改为80比较好,本地代理还是1080!原因是http上的流量嗅探难度更大,你懂得!
下面是一些原理介绍:
使用Chisel来突破公司代理服务器的封锁
# 首先尝试XXXAgent, XXXProxy
因为代理服务器可以访问Google,自然而然想到了这个,因为他们都是基于GAE的。但是部分网站的证书总是有些问题。当然大部分网站是没有问题的。
# 接着尝试了Chisel,发现这个比较理想
Chisel的和上面的XXXAgent的区别是,XXXAgent是基于代理服务器的软件。而Chisel是一个TCP-Over-Http的软件,可以在本地生成一个Socks5的代理,也就不需要处理各种https证书的问题了。
Chisel的网站是https://github.com/jpillora/chisel
## 配置远程服务器
首先要有个VPS,这个VPS能够正常访问各种网站
下载安装包,运行
./chisel_linux_amd64 server -v -p 1080 --socks5
别忘了打开防火墙的1080端口
## 配置本地服务器
同样下载,运行
C:\tools>chisel client -v --proxy https://user:password@192.168.88.100:8080 removeserver:1080 socks
命令的含义是启动一个chisel的客户端,连接到远程服务器的1080端口,同时打开本地的Socks端口,使用代理服务器192.168.88.100:8080
但是这样我遇到一个问题,代理服务器封了我的远程vps的http访问。不死心的尝试了下,发现代理服务器对https网开了一面,https是可以的(远程服务器配置了Let's Encrypt的免费https证书)
于是,借助nginx,把/c的请求重定向到本地1080端口:
location /c {
proxy_pass http://127.0.0.1:1080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 43200000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
重新运行client
C:\tools>chisel client -v --proxy https://user:password@192.168.88.100:8080 https://removeserver/c socks
然后打开浏览器,配置代理的选项为localhost:1080的Socks5端口,OK了!
不少公司的防火墙作了较为严格的限制,以至于很多网络服务如QQ、MSN都无法运行,如果你还能够打开网页,那么,使用Http通道软件可以让你突破限制,可以在现有的网络条件中使用任何网络服务。
http通道,是通过http协议来封装不同的网络协议的技术。被封装的协议通常属于TCP/IP协议簇。
使用HTTP CONNECT请求实现http通道:客户端请求HTTP代理服务器转发TCP连接到想要的服务器。代理服务器自己扮演客户端,发起向目标服务器的TCP连接,一般连接建立,不停地转发来回的流量。
注意:http代理客户端 和 http代理服务器 只有 第1个请求是 HTTP格式, 后面的数据,完全都是TCP。
如果一个代理服务器支持CONNECT方法,那么就可以利用它来支持SSL协议,比如说访问https网站。
在某些网络中,CONNECT方法,限制于特定的可信任网站。那么HTTP通道只能通过POST GET PUT DELETE方法。这类似与使用 异步HTTP双向流(BOSH-Bidirectinoal-streams Over Synchronouse HTTP)
比如 https://github.com/jpillora/chisel:
Chisel is a fast TCP tunnel, transported over HTTP, secured via SSH. Single executable including both client and server. Written in Go (Golang). Chisel is mainly useful for passing through firewalls, though it can also be used to provide a secure endpoint into your network. Chisel is very similar to crowbar though achieves much higher performance.
Features
- Easy to use
- Performant*
- Encrypted connections using the SSH protocol (via
crypto/ssh) - Authenticated connections; authenticated client connections with a users config file, authenticated server connections with fingerprint matching.
- Client auto-reconnects with exponential backoff
- Client can create multiple tunnel endpoints over one TCP connection
- Client can optionally pass through HTTP CONNECT proxies
- Server optionally doubles as a reverse proxy
- Server optionally allows SOCKS5 connections (See guide below)
Demo
A demo app on Heroku is running this chisel server:
$ chisel server --port $PORT --proxy http://example.com
# listens on $PORT, proxy web requests to 'http://example.com'
This demo app is also running a simple file server on :3000, which is normally inaccessible due to Heroku's firewall. However, if we tunnel in with:
$ chisel client https://chisel-demo.herokuapp.com 3000
# connects to 'https://chisel-demo.herokuapp.com',
# tunnels your localhost:3000 to the server's localhost:3000
and then visit localhost:3000, we should see a directory listing of the demo app's root. Also, if we visit the demo app in the browser we should hit the server's default proxy and see a copy of example.com.
HTTP Tunnel异常/威胁分析方法:
1、查询HTTP请求的域名是否存在备案;
2、查询HTTP请求的域名情报信息;(McAfee,微步在线,IBM X-Force等)
3、利用浏览器做实际登陆尝试;
4、若上述3步无法确定请求域名是否可信,利用google和百度查询直接搜索该域名相关信息;
5、若仍无法判断,如请求的URL为IP,可以参考referer字段按上述方法判定;(不排除黑客伪造)
6、若referer字段也不存在,可以结合UserAgent利用经验判断发送请求的工具,如:BestHTTP。(不排除黑客伪造)
7、如上述步骤无法做出判断,建议抓包判断。
HTTP Tunnel异常分析上述步骤只是参考顺序,HTTP Tunnel有4类异常事件,上述步骤可以不区分这几类异常,判断时需要一定的个人经验。

浙公网安备 33010602011771号