亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

windows - java用jpcap怎么識別出http和https的數(shù)據(jù)包?
巴扎黑
巴扎黑 2017-04-18 10:54:29
0
1
528

問題簡述:
利用java的第三方庫jpcap寫抓包程序,求解怎么識別出http和https的數(shù)據(jù)包(就只要能判斷出是http協(xié)議或https協(xié)議即可)。

測試的解法:
1.在tcp包(jpcap自帶TCPPacket類比較方便識別tcp包)的基礎上用80端口和443端口區(qū)分http和https,但是連tcp都識別成http或https了(不成功)。
2.設法找出http或https特有而tcp沒有的字段,未能找出。

代碼示意(未完成):
` else if(packet instanceof jpcap.packet.ICMPPacket) {

                  packetprocol = "ICMP";
                  r.addElement(packetprocol);
              }
              else if(packet instanceof jpcap.packet.TCPPacket) {
                  TCPPacket tcppacket = (TCPPacket)packet;
                  //if((tcppacket.src_port==80||tcppacket.dst_port==80)&&tcppacket.) {
                      packetprocol = "HTTP";
                      r.addElement(packetprocol);
                  }else if(tcppacket.src_port==443||tcppacket.dst_port==443) {
                      packetprocol = "HTTPS";
                      r.addElement(packetprocol);
                  }
                  else {
                      packetprocol = "TCP";
                      r.addElement(packetprocol);
                  }` 
巴扎黑
巴扎黑

reply all(1)
阿神

Temporary solution:
Determine whether the data field of the captured tcp packet contains the "HTTP" string.
Disadvantages:
1. After comparing with wireshark, we found that some tcp packets in the data field of wireshark have HTTP and are recognized as tcp instead of http (I don’t know how wireshark parses it).
2. It feels like judgments will be missed and not accurate enough.
Continue to look for better solutions and look forward to answers!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template