capturing dns packets using java
I want to log the websites visited in a system. So i decided to record the packets send by the system. I am using Jpcap API. I am able to record a lot of packets. Now what i want to do is i want to filter only DNS packets. I think that 开发者_StackOverflowwill be able to log the websites.
I want a way to filter the DNS packets. How can I do it?
One uglier approach is to scan on port 53 for UDP. However, previous answer looks cleaner from implementation aspect.
Here it says
You can check the following homepage for more details about filter expression. Designing Capture Filters for Ethereal/Wireshark
Thus, I believe
captor.setFilter("dns", true);
should work
i found it easy processing all the packets in port 53 and so i used this filter
udp dst port 53
tanx jack for ur hint
精彩评论