利用simple-dns解决dns污染问题

在mac机器上。

pip install twisted

git clone https://github.com/RicterZ/simple-dns simple-dns-by-ricterz

cd simple-dns-by-ricterz/simple-dns/

sudo python dns.py

项目地址:

https://github.com/RicterZ/simple-dns

(用不了多久)

-------

利用dnsproxy-by-zhengxinhn解决dns污染问题(这个不错)

git clone https://github.com/zhengxinhn/dnsproxy dnsproxy-by-zhengxinhn

cd dnsproxy-by-zhengxinhn

make

cd src

 

src目录里面生成了可执行文件dnsproxy

./dnsproxy -h

sudo ./dnsproxy -p 53 --remote-addr=8.8.8.8 --remote-port=53

会显示:

* runing at 53

* transport to 8.8.8.8:53,tcp

------------

 

利用dnsproxy-by-notzappy解决dns污染问题

 

git clone https://github.com/NotZappy/dnsproxy dnsproxy-by-NotZappy 

cd dnsproxy-by-NotZappy 

sudo python dnsproxy.py

会显示使用说明。

sudo python dnsproxy.py -p 53 --server=8.8.8.8

----------

利用dnsproxy-by-ccloli解决dns污染问题

Requirement

  • Node.js
    • v8.x: v8.10.0* or higher
    • v9.x: v9.1.0* or higher
    • v10.x or higher
npm install -g ccloli/DNSProxy

wget https://github.com/ccloli/DNSProxy/raw/master/config.sample.json

cat config.sample.json > dnsproxy-by-ccloli.json

修改dnsproxy-by-ccloli.json为如下内容:

// This is a sample of DNSProxy config file

// You can use this sample to create your config file

{

// DNSProxy server configuration

"settings": {

// should DNSProxy support TCP lookup from client?

"tcp": true,

// should DNSProxy support UDP lookup from client?

"udp": true,

// which IP to bind the DNSProxy server?

"host": "127.0.0.1",

// which port to listen the client request?

"port": 53,

// when to close upstream lookup if no data response?

"timeout": 5000 // ms

},

// available name server list

"servers": {

// set name server with a name

// you don't need to set name servers here

// but at least a `default` one is required

"default": {

// name server host

"host": "8.8.8.8",

// name server port

// if you emit port, it'll be `53`

"port": "53",

// name server protocol, `tcp`, `udp` or `tls`

// if you emit protocol, it'll be based on your request,

// if you request the server with UDP, then it'll be UDP,

// if you request the server with TCP, then it'll be TCP

"type": "tcp"

},

// another name server

// "tcp": {

// you can combine host and port as host

// "host": "127.0.0.1:53",

// don't set port again, or it'll overwrite the previous one

// "type": "tcp"

// },

"ipv6": {

// if you're using IPv6 server, quote IP address with []

// or it'll be parsed as combined host and port

"host": "[::1]:53"

},

// "tls": {

// DNS-over-TLS lookup is supported

// "host": "127.0.0.1",

// if you emit port, it'll be `853` for `tls`

// "port": "853",

// "type": "tls"

// },

// you can use a plain string instead of an object

// scheme is `<ip>[:<port = 53>][@<protocol>]`

"google-tcp": "8.8.8.8:443@tcp",

"google-ipv6": "[2001:4860:4860::8888]",

"cloudflare-tls": "1.1.1.1@tls",

// you can also use domain for TLS lookup,

// but please be aware that looking up the server IP is not

// controlled by DNSProxy but by libuv's operating system API,

// so the IP is probably not what you want (you know what I mean)

"quad9-tls": "dns.quad9.net@tls"

},

// extend rule parsers

// you can import some other parsers written by you or some other guy

// then you can use them in `rules`

// note if you're using Windows, use slash (/) or two backslashes (\\)

"extend-parsers": [

"path/to/parser.js",

"path\\to\\another\\parser.js",

// you can use vertical bar (|) after path to rename it, it's useful

// if you don't know its name or another parser uses the same name

// the original name of parser will be replaced by your new name

"path/to/renamed/parser.js|new-name",

// you can use `npm:` before path to import from a npm package

// you can use its original name to use the parser

// or use `npm:<package-name>` to use the parser

"npm:dnsproxy-npm-parser",

// you can also rename a npm package to overwrite its original name

// e.g. you can use either `npm:dnsproxy-npm-another-parser` or

// `another-parser` to use the parser

"npm:dnsproxy-npm-another-parser|another-parser"

],

// look up rules

// which rule defines first, which rule has a higher priority

// if no rule matches, it'll use the default one

"rules": [{

// rule input file

"file": "rules/common.txt",

// rule type

"type": "list",

// rule lookup server

// if you defined it at `servers`, you can use it he

"server": "tcp"

}, {

"file": "rules/extend.txt",

"type": "list",

// you can also define a custom name server here

"server": {

"host": "127.0.0.2",

"port": "53",

"type": "tcp"

}

}, {

// TODO: PAC file, thought it's a JavaScript file

"file": "rules/proxy.pac",

// TODO: support pac is coming soom

"type": "pac",

// also you can use a plain string

"server": "10.0.0.1"

}, {

// TODO: URL, support URL maybe coming soom

"url": "https://example.com/proxy.txt",

// TODO: support autoproxy is coming soom

"type": "autoproxy",

"server": "[::1]:5353@tcp"

}, {

// TODO: advance, advance is a custom rule

// you can specify any rules with any name server

"file": "rules/advance.json",

"type": "advance"

}, {

// use the parser defined in `extend-parser`

"file": "rules/foo.txt",

"type": "new-name"

}, {

// use the npm package defined in `extend-parser`

"file": "rules/bar.txt",

"type": "npm:dnsproxy-npm-another-parser",

"config": "some other fields required by custom parser"

}]

}

 

然后,运行:

dnsproxy -c dnsproxy-by-ccloli.json

项目地址:https://github.com/ccloli/DNSProxy

(不稳定)

---------

利用dnsproxy-by-Pythnist解决dns污染问题

 

git clone https://github.com/Pythnist/DNSProxy DNSProxy-by-Pythnist

cd DNSProxy-by-Pythnist

sudo python dnsproxy.py --host=127.0.0.1 --port=53 --server=8.8.8.8

项目地址:https://github.com/Pythnist/DNSProxy (不稳定)

 ---------

利用dnsproxy-by-qmphan解决dns污染问题 

git clone https://github.com/qmphan/dnsproxy dnsproxy-by-qmphan

cd dnsproxy-by-qmphan

sudo python dnsproxy.py --host=127.0.0.1 --port=53 --server=8.8.8.8

-----------

https://github.com/shuncox/smartdns 

 

git clone https://github.com/shuncox/smartdns smartdns -by-shuncox

cd smartdns -by-shuncox

sudo python smartdns.py

 -------------

https://github.com/parrotgeek1/ProxyDNS

(不稳定)

在mac机器上。

mkdir proxydns

cd proxydns

wget https://github.com/parrotgeek1/ProxyDNS/archive/master.zip

unzip proxydns-master.zip

cd proxydns-master

chmod 755 make.sh

./make.sh

(会在当前目录下,生成可执行文件proxydns)

sudo ./proxydns 208.67.222.222 443 53

会显示:

Started TCP thread
Started UDP thread

------------

在mac上。

git clone https://github.com/henix/shielddns shielddns-by-henix

cd shielddns-by-henix

nano config.rb

(config.rb的内容,见https://github.com/henix/shielddns页面)

sudo ruby shielddns.rb 0.0.0.0 53

项目地址:https://github.com/henix/shielddns

----------

git clone https://github.com/slene/dnsproxy dnsproxy-by-slene

cd dnsproxy-by-slene

go build (会在当前目录下,生成可执行文件dnsproxy-by-slene

./dnsproxy-by-slene -h

./dnsproxy-by-slene -local :53 -dns 8.8.8.8:53:tcp,8.8.4.4:53:tcp

------------

git clone https://github.com/vietor/dnsproxy dnsproxy-by-vietor

cd dnsproxy-by-vietor

make

cd src (在src目录下,生成了可执行文件dnsproxy)

./dnsproxy -h

./dnsproxy --port=53 --remote-addr=8.8.8.8 --remote-port=53 --remote-tcp

---------

利用cndns解决dns污染问题

在mac机器上。
git clone https://github.com/Nat-Lab/cndns  cndns-by-Nat-Lab
cd cndns-by-Nat-Lab
make
(在当前目录下,会生成可执行文件cndns)
sudo ./cndns -l 0.0.0.0 -p 53 -s 1.0.0.1 -m 15

它这个程序的思路有意思,“-m 15”的意思是只返回15毫秒或15毫秒以上的dns应答结果,这样就避免了dns污染。

看看能用多久。

实际使用例子:
sudo wg-quick up wg0
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
cd ~/cndns-by-Nat-Lab && sudo ./cndns -l 0.0.0.0 -p 53 -s 1.0.0.1 -m 15

项目地址:https://github.com/Nat-Lab/cndns 
-------------
 
在mac机器上。
git clone https://github.com/creac/dnsAgent dnsAgent-by-creac
cd dnsAgent-by-creac
sudo python dnsAgent.py
(此命令是运行在后台的。)
 
------------
 

利用sdns解决dns污染问题(这个用不了多久)

 
在mac机器上。首先安装go环境,然后,
cd $GOPATH
go get -u -v github.com/semihalev/sdns
(sdns就会出现在$GOBIN/里面)

sdns
(第一次运行它,会在当前目录下,生成sdns.toml文件)
nano sdns.toml
(把bind的值改为":53" ,把bind前面的#号去掉。
rootservers的值改为:
[
"8.8.8.8:53",
"8.8.4.4:53"

 
然后运行:
 
sudo sdns -config=sdns.toml
不要关闭此terminal.
 
实际使用例子:
sudo wg-quick up wg0 
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
sudo sdns -config=sdns.toml
 
项目地址:github.com/semihalev/sdns
--------------
 

利用DNS-reverse-proxy解决dns污染问题 (这个用不了多久)

 
在mac机器上。首先安装go环境。然后,
git clone https://github.com/StalkR/dns-reverse-proxy
cd dns-reverse-proxy

go build .
(在当前目录下,会生成可执行文件dns-reverse-proxy)

sudo ./dns-reverse-proxy -address :53 -default 8.8.8.8:53
 
实际使用例子:
sudo wg-quick up wg0 
 
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
cd ~/dns-reverse-proxy && sudo ./dns-reverse-proxy -address :53 -default 8.8.8.8:53
 
-------------
 

利用udpxd解决dns污染问题

 
在本地机器mac上。
git clone https://github.com/TLINDEN/udpxd udpxd-by-TLINDEN
cd udpxd-by-TLINDEN
make
(会在当前目录,生成可执行文件udpxd)
sudo ./udpxd -l 127.0.0.1:53 -t 8.8.8.8:53

实际使用例子:
cd ~/gtun-by-ICKelin/bin/gtun && sudo ./gtun-darwin_amd64 -c gtun.conf
(详见https://briteming.blogspot.com/2019/09/vpn-gtun.html

sudo route add default 192.168.1.1 && sudo route delete default && 
sudo route add default 100.64.240.1 && sudo route add vps-ip 192.168.1.1

sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1

cd ~/udpxd-by-TLINDEN &&  sudo ./udpxd -l 127.0.0.1:53 -t 8.8.8.8:53
不要关闭此terminal.

项目地址:https://github.com/TLINDEN/udpxd
-------------
 

利用portfwd解决dns污染问题

 
在本地机器mac上。
git clone https://github.com/rssnsj/portfwd portfwd-by-rssnsj
cd  portfwd-by-rssnsj
cd src
make
(在当前目录,会生成可执行文件udpfwd)
sudo ./udpfwd 127.0.0.1:53 8.8.8.8:53

实际使用例子:
./exodus-vpn-bwg.sh
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
cd ~/portfwd-by-rssnsj/src && sudo ./udpfwd 127.0.0.1:53 8.8.8.8:53
不要关闭此terminal.

项目地址:https://github.com/rssnsj/portfwd
-------------

利用dns2tcp解决dns污染问题

 
在本地机器mac上。
brew install libuv

git clone https://github.com/zfl9/dns2tcp dns2tcp-by-zfl9
cd dns2tcp-by-zfl9
make
(在当前目录下,会生成可执行文件dns2tcp)
sudo ./dns2tcp -L"127.0.0.1#53" -R"8.8.8.8#53"
或者ctl+c ,
接着:
make install
(在/usr/local/bin/里面会生成dns2tcp)
sudo dns2tcp -L"127.0.0.1#53" -R"8.8.8.8#53"

使用例子:
运行全局代理程序mellow

sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1

sudo dns2tcp -L"127.0.0.1#53" -R"8.8.8.8#53"

项目地址:https://github.com/zfl9/dns2tcp