我正在做一个关于使用scapy向我发送虚假http响应的测试, 然而whireshark显示假响应是" TCP确认看不见的段", 这是我的代码:
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 OK\r\nDate: Thu, 02 Jul 2015 04:19:50 GMT\r\nServer: Apache/2.4.10 (Win32) OpenSSL/0.9.8zb PHP/5.3.29\r\nX-Powered-By: PHP/5.3.29\r\nContent-Length: 4\r\nContent-Type: text/html\r\n\r\njoke"
res = ether/ip/tcp/res_data
#ls(res)
sendp(res)

这是我的代码中的错误或错误吗?
答案 0 :(得分:0)
我很抱歉,我发现这可能是wireshark的问题。