简体   繁体   English

发送带有Jpcap问题的SYN数据包

[英]Sending SYN packet with Jpcap problems

I want to send a SYN packet with Jpcap and get a response, but when I do this I automatically send a RST packet, but I don't want to send a RST packet. 我想使用Jpcap发送SYN数据包并获得响应,但是当我这样做时,我会自动发送RST数据包,但是我不想发送RST数据包。 How can I stop sending a RST packet and why am I sending a RST packet 如何停止发送RST数据包以及为什么发送RST数据包

Here is my code: 这是我的代码:

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);
}

} }

Packets: 封包:

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

Your TCP/IP stack is doing that for you because it saw the SYN/ACK response and didn't know what it was for. 您的TCP / IP堆栈正在为您执行此操作,因为它看到了SYN / ACK响应,却不知道它的用途。 You can't stop it doing that. 您不能阻止它这样做。

Why on earth are you doing this? 你到底为什么要这样做?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM