使用WSL的Linux虚拟机作为代理服务器,使用windows主机作为客户端
因为我只有一台主机,所以只能使用windows与WSL虚拟机进行交互,如果有两条Linux主机会更加方便,操作也会有所不同
1、在Linux上下载squid(或squid3)
sudo apt update
sudo apt install squid
2、修改squid的配置文件:/etc/squid/squid.conf,在其中加入如下两行代码(需root权限)
acl localnet src 192.168.1.0/24
http_access allow localnet
(此处将193.168.1.0/24换成你自己的客户端主机的IP地址)
重启squid服务器:
sudo service squid restart
3、在windows上设置环境变量:
http_proxy="172.64.1.9:3128"
(此处将IP地址换成你自己的服务器主机的IP地址)
在windows上下载curl(Linux上可直接使用wget):curl - Download
解压后,把curl所在目录(例:C:\curl\bin)添加到环境变量中:
curl="C:\curl\bin"
添加好环境变量后,便可直接在命令行中使用curl命令
4、在Linux主机上抓包:
sudo tcpdump -s 2000 -i eth0 -ntX '(src 192.168.1.0/24) or (dst 192.168.1.0/24)'
然后在windows上下载数据:
curl http://www.baidu.com/indwx/html
5、最终收到的HTTP应答中,HTTP状态码为403,无权访问。但还是收到了html数据,具体原因未知。
over