1
我想用Jpcap发送SYN数据包并获得响应,但是当我这样做时,我会自动发送RST数据包,但我不想发送RST数据包。我怎样才能停止发送RST包和为什么我发送一个RST包发送带有Jpcap问题的SYN数据包
这里是我的代码:
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
对不起,等待时间。我只是想知道为什么,能否停下来。 –
不适用于jpcap。您可以使用其他可以过滤数据包的软件包。看到我的答案[这里](http://stackoverflow.com/questions/13008340/how-to-prevent-windows-from-sending-rst-packet-when-trying-to-connect-to-somebod/13135227#13135227 )。 – Basil