Change DNS queries in a network trace file and generate binary input for dns-replay-{controller,client}.
support for TTL and source port in raw files; update fsdb header handling
Beta release (1.0)
% dns-query-mutator(1) % Liang Zhu liangzhu@isi.edu % October 5, 2018
dns-query-mutator - change DNS queries in a network trace file
dns-query-mutator [-i FORMAT:FILE] [-o FORMAT:FILE] [--dns-opcode
PERCENT:NUMBER]…
[-l] [-h] [-v] [-V]
dns-query-mutator converts DNS query stream for trace replay with optional mutation.
It deals with three different types of input format:
network trace: any format accepted by libtrace, such as pcap and erf file
plain text: a Fsdb file where each line contains data elements delimited by spaces. Each line of the input text file should be (time, source ip, query name, query class, query type, protocol).
customized raw binary: a DNS message with prepeded message size. The DNS message is defined in dns_msg.proto, and is converted to binary by Google’s protocol buffer library.
dns-query-mutator supports two kinds of conversion:
For trace input, it supports to modify some fields in DNS header and EDNS:
-i/--input
FORMAT:FILE-o/--output
FORMAT:FILE--dns-opcode
PERCENT:NUMBER--dns-aa
PERCENT:NUMBER--dns-tc
PERCENT:NUMBER--dns-rd
PERCENT:NUMBER--dns-ra
PERCENT:NUMBER--dns-z
PERCENT:NUMBER--dns-ad
PERCENT:NUMBER--dns-cd
PERCENT:NUMBER--edns-do
PERCENT:NUMBER--edns-udp-size
PERCENT:NUMBER--edns-extended-rcode
PERCENT:NUMBER--edns-version
PERCENT:NUMBER--edns-z
PERCENT:NUMBER-l/--loop
-h/--help
-v/--verbose
-V/--version
convert pcap to raw
./dns-query-mutator -i trace:t.pcap -o raw:t.raw
convert text to raw
./dns-query-mutator -i text:t.text -o raw:t.raw
convert raw to text
./dns-query-mutator -i raw:t.raw -o text:t.text
read and write via pipe
cat t.pcap | ./dns-query-mutator -i trace:- -o raw:- | xz > t.raw.xz
cat t.fsdb | dbcol time srcip qname qclass qtype protocol | dbfilestripcomments | ./dns-query-mutator -i text:- -o raw:- | xz > t.raw.xz
set DO bit in 50% of the input queries
./dns-query-mutator -i trace:t.pcap --edns-do 50:1 -o raw:- | xz > t.raw.xz
serve as a traffic generator
./dns-query-mutator -l -i trace:t.pcap -o raw:- | ./dns-replay-client -s 192.168.1.1:53 -f -i raw:-
To build, type make.
It requires the following packages on Fedora: ldns-devel libtrace-devel protobuf-devel
dns-replay-controller(1), dns-replay-client(1), Fsdb(3)