scapy支持http流水线吗?

时间:2015-02-04 08:53:19

标签: python http scapy pipelining http-pipelining

我正在尝试编写一个用scapy进行http流水线操作的脚本。当我调用我的send函数来重新发送我的两个http请求时,请求不是流水线的。在收到第一个http响应后发送第二个http请求。

我所拥有的片段:

#Send SYN
syn = IP(src="31.31.31.10",dst='31.31.31.17') / TCP(dport=80,sport=RandShort(),flags='S')
syn_ack = sr1(syn)
#Send ACK
ack = (IP(src="31.31.31.10",dst="31.31.31.17")/TCP(dport=80, sport=syn_ack[TCP].dport,seq=syn_ack[TCP].ack, ack=syn_ack[TCP].seq + 1, flags='A'))
send(ack)
#Set the HTTP data
http1 = 'GET /a.html HTTP/1.1\r\nUser-Agent: curl/7.19.4\r\nHost: www.google.com\r\nAccept: */*\r\n\r\n'
http2 = 'GET /b.html HTTP/1.1\r\nUser-Agent: curl/7.19.4\r\nHost: www.google.com\r\nAccept: */*\r\n\r\n'
#Send First GET
get1 = (IP(src="31.31.31.10",dst="31.31.31.17")/TCP(dport=80, sport=syn_ack[TCP].dport,seq=syn_ack[TCP].ack, ack=syn_ack[TCP].seq + 1, flags='PA')/http1)
send (get1)
get1_payload = len(http1)
#Send the Second GET
get2 = (IP(src="31.31.31.10",dst="31.31.31.17")/TCP(dport=80, sport=syn_ack[TCP].dport,seq=syn_ack[TCP].ack + get1_payload, ack=syn_ack[TCP].seq + 1,flags='PA')/http1)
send (get2)

scapy只是发送第二个请求太慢还是我没有正确地做某事?

0 个答案:

没有答案