]>
git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsscan.cc
10 // this is needed because boost multi_index also uses 'L', as do we (which is sad enough)
16 #include <boost/format.hpp>
17 #include <boost/utility.hpp>
18 #include <boost/multi_index_container.hpp>
19 #include <boost/multi_index/ordered_index.hpp>
20 #include <boost/multi_index/key_extractors.hpp>
23 #include "namespaces.hh"
24 using namespace ::boost::multi_index
;
25 #include "namespaces.hh"
28 int main(int argc
, char** argv
)
31 Socket
sock(AF_INET
, SOCK_DGRAM
);
34 IPEndpoint remote(argc > 2 ? argv[2] : "127.0.0.1",
35 argc > 3 ? atoi(argv[3]) : 5300);
40 cerr
<<"Syntax: dnsscan file1 [file2 ..] "<<endl
;
44 unsigned int counts
[256];
45 for(unsigned int n
=0 ; n
< 256; ++n
)
48 for(int n
=1; n
< argc
; ++n
) {
49 PcapPacketReader
pr(argv
[n
]);
51 while(pr
.getUDPPacket()) {
53 MOADNSParser
mdp((const char*)pr
.d_payload
, pr
.d_len
);
55 counts
[mdp
.d_qtype
]++;
58 catch(MOADNSException
&e
) {
59 cout
<<"Error from remote "<<pr
.getSource().toString()<<": "<<e
.what()<<"\n";
60 // sock.sendTo(string(pr.d_payload, pr.d_payload + pr.d_len), remote);
64 for(unsigned int n
=0 ; n
< 256; ++n
) {
66 cout
<< n
<< "\t" << counts
[n
] << "\n";
70 catch(std::exception
& e
)
72 cout
<<"Fatal: "<<e
.what()<<endl
;