利用 dns 實現 app簡易抓包


場景:對H5打包的 app實現抓包

環境:centos 8

follow the guide: https://www.linuxtechi.com/setup-bind-server-centos-8-rhel-8/

How to Setup DNS Server (Bind) on CentOS 8 / RHEL8

step 1-2

then 

https://docstore.mik.ua/orelly/networking_2ndEd/dns/ch07_05.htm

7.5. Logging in BIND 8 and 9 docstore.mik.ua/orelly/networking_2ndEd/dns/ch07_05.htm

 

[root@uatdns01 ~]# cat /etc/named/named.conf
options {
// listen-on port 53 { any; }; // listen-on-v6 port 53 { ::1; };              directory "/var/named";
             dump-file "/var/named/data/cache_dump.db";
             statistics-file "/var/named/data/named_stats.txt";
              memstatistics-file "/var/named/data/named_mem_stats.txt";
// allow-query { any; };               recursion yes;
              forward first;
 forwarders { #即訪問非kevin.cn域名時將解析轉發到這幾個DNS地址(分別為阿里的DNS、google的DNS)上進行解析。 223.5.5.5; #注意這里轉發的是DNS地址,沒有指定DNS轉發域名。 223.6.6.6; 8.8.8.8; 8.8.4.4; };
};

  logging {
        channel default_debug {
        file "data/named.run";
        severity dynamic;
        };
        channel my_file {
        file "log.msgs"; severity dynamic;
        };
        category default { null; };
        category queries {
        my_file;
        };
  };

 

 

 

# systemctl restart named

 

在手機端設置wifi dns

https://zhuanlan.zhihu.com/p/71385781

在服務器端可看到 dns解析日志

[root@iZ8vb1v402ygt7xht0rt2fZ ~]# tail -f /var/named/log.msgs
client @0x7f48b4038490 220.194.172.244#7689 (query.hicloud.com): query: query.hicloud.com IN A + (172.27.189.30)
client @0x7f48bc0c5210 220.194.172.244#7752 (cqs-drcn.emui.hicloud.com): query: cqs-drcn.emui.hicloud.com IN A + (172.27.189.30)
client @0x7f48bc051610 220.194.172.244#7753 (stores1.hispace.hicloud.com): query: stores1.hispace.hicloud.com IN A + (172.27.189.30)
client @0x7f48beed86c0 220.194.172.244#7754 (dns.weixin.qq.com): query: dns.weixin.qq.com IN A + (172.27.189.30)
client @0x7f48b4034650 162.219.179.138#54179 (VERSION.BIND): query: VERSION.BIND CH TXT + (172.27.189.30)
client @0x7f48b4034650 220.194.172.244#7755 (aqv.hicloud.com): query: aqv.hicloud.com IN A + (172.27.189.30)
client @0x7f48beec3250 220.194.172.244#7756 (www.taobao.com): query: www.taobao.com IN A + (172.27.189.30)
client @0x7f48b4038490 220.194.172.244#7757 (configsvr.msf.3g.qq.com): query: configsvr.msf.3g.qq.com IN A + (172.27.189.30)
client @0x7f48bc0c5210 220.194.172.244#7758 (data.hicloud.com): query: data.hicloud.com IN A + (172.27.189.30)
client @0x7f48bc051610 220.194.172.244#7759 (audid-api.taobao.com): query: audid-api.taobao.com IN A + (172.27.189.30)

 

 

要想用戶在web端看到,需要寫段web代碼:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM