2012-11-08 3 views
1

Jpcap을 사용하여 SYN 패킷을 보내고 응답을 받겠습니다.하지만 이렇게하면 자동으로 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 

답변

0

귀하의 TCP/IP 어떻게이 RST 패킷 전송을 중지 할 수 및 이유는 RST 패킷 여기

을 보내고 나의 코드입니다 스택은 SYN/ACK 응답을보고 그것이 무엇인지 알지 못하기 때문에 당신을 위해 그것을하고 있습니다. 그렇게하는 것을 멈출 수는 없습니다.

왜이 세상에서하고 있습니까?

+0

대기 시간 동안 죄송합니다. 나는 그 이유를 알고 싶었고 그만 둘 수있었습니다. –

+0

jpcap을 사용하지 않습니다. 패킷을 필터링 할 수있는 다른 패키지와 함께 할 수 있습니다. 내 대답보기 [여기] (http://stackoverflow.com/questions/13008340/how-to-prevent-windows-from-sending-rst-packet-when-trying-to-connect-to-somebod/13135227#13135227). – Basil

관련 문제