[英]Sending SYN packet with Jpcap problems
我想使用Jpcap發送SYN數據包並獲得響應,但是當我這樣做時,我會自動發送RST數據包,但是我不想發送RST數據包。 如何停止發送RST數據包以及為什么發送RST數據包
這是我的代碼:
public class JavaApplication1 {
public static void main(String[] args) throws UnknownHostException, IOException {
JpcapSender sender = JpcapSender.openDevice(JpcapCaptor.getDeviceList()[0]);
NetworkInterfaceAddress[] nia = JpcapCaptor.getDeviceList()[0].addresses;
TCPPacket packet = new TCPPacket(57912, 80, 1, 0, false, false, false, false, true, false, false, false, 0, 0);
packet.setIPv4Parameter(0, false, false, false, 0, false, true, false, 0, 34567, 64, IPPacket.IPPROTO_TCP, nia[0].address , InetAddress.getByName("www.google.com"));
packet.data = ("").getBytes();
EthernetPacket ether = new EthernetPacket();
ether.frametype = EthernetPacket.ETHERTYPE_IP;
ether.src_mac = ((NetworkInterface)JpcapCaptor.getDeviceList()[0]).mac_address;
ether.dst_mac = new byte[]{(byte)200, (byte)205, (byte)114, (byte)68, (byte)129, (byte)162};
packet.datalink = ether;
sender.sendPacket(packet);
}
}
封包:
57912 > http [SYN] Seq=0 Win=0 Len=0
http > 57912 [SYN, ACK] Seq=0 ACK=1 Win=14300 Len=0 MSS=1430
57912 > http [RST] Seq=0 Win=0 Len=0
您的TCP / IP堆棧正在為您執行此操作,因為它看到了SYN / ACK響應,卻不知道它的用途。 您不能阻止它這樣做。
你到底為什么要這樣做?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.