当我尝试对特定的dst IP进行三向握手时,我得到AttributeError: 'NoneType' object has no attribute 'ack'
。我正在复制带有IP审查的脚本:
from scapy.all import *
import random
randport= random.randrange(1024,65000)
randseq= random.getrandbits(32)
synp= IP(dst='**********')/TCP(sport=randport, dport=80, flags='S', seq=randseq, window=29200, options=[('MSS', 1460), ('SAckOK', ''), ('Timestamp', (1210737, 0)), ('NOP', None), ('WScale', 7)])
send(synp)
SYNACK= sr1(synp, timeout=1)
print SYNACK
ackp= IP(dst='**********')/TCP(sport=randport, dport=80, flags='A', seq=SYNACK.ack+1, ack=SYNACK.seq+1, window=0, options=[('NOP', None), ('NOP', None), ('Timestamp', (1210737, 1064405))])/Padding(load='\x00\x00')
send(ackp)
错误:
Sent 1 packets.
Begin emission:
Finished sending 1 packets.
.........
Received 9 packets, got 0 answers, remaining 1 packets
None
Traceback (most recent call last):
File "./3way.py", line 14, in <module>
ackp= IP(dst='*********')/TCP(sport=randport, dport=80, flags='A', seq=SYNACK.ack+1, ack=SYNACK.seq+1, window=0, options=[('NOP', None), ('NOP', None), ('Timestamp', (1210737, 1064405))])/Padding(load='\x00\x00')
AttributeError: 'NoneType' object has no attribute 'ack'