像添加選項一旦收到TCP ACK(有選項實驗)這個在TCP與Scapy的
我要生成一個TCP SYN + ACK(可選擇實驗和快速打開的Cookie)下面
所示我想與Scapy的以生成所述TCP SYN + ACK,所以我說
,所以我在/ usr/share/pyshared/scapy/layers/inet.py
添加254 : ("RFC3692-style Experiment","!HHH")
這樣
TCPOptions = (
{ 0 : ("EOL",None),
1 : ("NOP",None),
2 : ("MSS","!H"),
3 : ("WScale","!B"),
4 : ("SAckOK",None),
5 : ("SAck","!"),
8 : ("Timestamp","!II"),
14 : ("AltChkSum","!BH"),
15 : ("AltChkSumOpt",None),
25 : ("Mood","!p"),
254 : ("Experiment","!HHHH")
},
{ "EOL":0,
"NOP":1,
"MSS":2,
"WScale":3,
"SAckOK":4,
"SAck":5,
"Timestamp":8,
"AltChkSum":14,
"AltChkSumOpt":15,
"Mood":25,
"Experiment":254
})
並且在收到TCP ACK(帶實驗選項),我executhe以下Scapy的功能:
TCP_SYNACK=TCP(sport=Ddport, dport=Ssport, flags="SA", seq=SeqNr, ack=AckNr, options=[('Experiment',0xf989,0xcafe,0x0102,0x0002),('NOP',0),('NOP',0)])
ANSWER=sr1(ip/TCP_SYNACK)
但我得到了一個python錯誤。它看起來像我在scapy的TCP數據包中的選項字段的定義中出錯。我在做什麼?
我已經編輯[我的答案](http://stackoverflow.com/a/30128302/3903832),請評閱。我希望它能解決你的問題:-) – Yoel