scapy发送虚假http响应问题,whireshark显示seq和ack比我设置的要大



我正在做一个关于使用scapy向我发送虚假http响应的测试,然而whireshark显示假响应是"TCP ACKed invisible segment",这是我的代码:

    pkgs = sniff(iface="eth0",filter="src host 192.168.1.153 and dst host 121.42.144.212 and tcp and port 80", lfilter = lambda x: x.haslayer(Raw), count=1)
    for pkg in pkgs:
        d_port = pkg[IP].sport #if i set d_port like 5555 , it will work, but if d_port= pkg[IP].sport, the packet is wrong
        ether = Ether(dst='00:0c:29:2c:0e:4e', src='8c:be:be:23:97:80')
        ip = IP(src='121.42.144.212', dst='192.168.1.153', flags="DF")
        tcp = TCP(flags="PA", sport=80, dport=d_port, seq=1,ack=87)
        res_data = "HTTP/1.1 200 OKrnDate: Thu, 02 Jul 2015 04:19:50 GMTrnServer: Apache/2.4.10 (Win32) OpenSSL/0.9.8zb PHP/5.3.29rnX-Powered-By: PHP/5.3.29rnContent-Length: 4rnContent-Type: text/htmlrnrnjoke"
        res = ether/ip/tcp/res_data
        #ls(res)
        sendp(res)
wireshirk显示"传输控制协议,Src端口:http(80(,Dst端口:37938(37938(,序列号:511606687,确认号:1126945895,Len:188",序列号和确认号大于I设置。

这是一个错误还是我的代码出了问题?

对不起,我发现这可能是wireshark的问题。

最新更新