jnetpcap的HTTP请求限制

时间:2015-09-16 06:56:38

标签: java http-headers packet-sniffers jpcap jnetpcap

我正在使用eclipse在java中开发嗅探器。我可以嗅探HTTP数据包,TCP,UDP。但如果请求在一秒钟内限制超过10,我需要控制或“陈述”。我知道jnetpcap我们无法阻止,我只是想知道我有可能得到这个。谢谢 。在我的代码下面

PcapPacketHandler <String> jpacketHandler = new PcapPacketHandler<String> () 
{

private final Http h = new Http();
private final Tcp t = new Tcp();


@Override
public void nextPacket(PcapPacket packet, String user) {
 if(packet.hasHeader(h)){

     final JCaptureHeader header = packet.getCaptureHeader();

        System.out.printf("---------1111--------" + header.toString()+ "-------1111--------");
        System.out.printf("packet caplen= %d wiredlen = %d  \n ",
                header.caplen(),header.wirelen());
                System.out.println(packet.toString());
                //   System.out.printf("---------+++++++++--------" + packet.getHeader(h).toString() + "-------++++++--------");
                //packet.getHeader(h).toString();


        //Find if the given packet is a Request/Response Pkt : First get the TCP header 
                packet.getHeader(t);


 }

0 个答案:

没有答案