dnsクエリをスパイする dnspeep

dnspeep というRust製のdnsのクエリ内容を表示するプログラムを知ったので少し試してみました.

GitHubのReleaseページ 🏛️にLinux x86_64とmacOS x86_64のバイナリが置いてあるのでその環境だとそれをダウンロードして会伊藤するだけで使えます.他の環境では cargo build すればいいのかな?

$ wget https://github.com/jvns/dnspeep/releases/download/v0.1.1/dnspeep-linux.tar.gz
$ tar tvf ./dnspeep-linux.tar.gz
-rwxr-xr-x runner/docker 5570536 2021-04-02 06:20 dnspeep
$ file dnspeep
dnspeep: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a917041c223b18db709ff3c563ee1a6a3c82ba6e, for GNU/Linux 3.2.0, with debug_info, not stripped
$ ./dnspeep -h|xsel
Usage: ./dnspeep [options]

Options:
    -p, --port PORT     port number to listen on
    -f, --file FILENAME read packets from pcap file
    -h, --help          print this help menu

What the output columns mean:
   query:     DNS query type (A, CNAME, etc)
   name:      Hostname the DNS query is requesting
   server IP: IP address of the DNS server the query was made to
   response:  Responses from the Answer section of the DNS response (or "<no response>" if none was found).
              Multiple responses are separated by commas.

$ sudo ./dnspeep
query name                           server IP            response
A     tweetdeck.twitter.com.         192.168.1.102        CNAME: td.twitter.com., A: 104.244.42.132, A: 104.244.42.4, A: 104.244.42.68, A: 104.244.42.196
  :

libpcapからパケットを引っ張ってdnsのクエリを整形して出力しているようです.こんな感じでtcpdumpでもいいのですが,dnsに特化しているのでオプションとか覚えなくていいのはいいですね.

$ sudo tcpdump -i eth0 udp port 53 or tcp port 53
環境

dnspeep v0.1.1

$ dpkg-query -W libpcap0.8 tcpdump
libpcap0.8:amd64        1.10.0-2
libpcap0.8:i386 1.10.0-2
tcpdump 4.99.0-2
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)