0
I have a list with doors like portas = [21,22,23,53,80,443]
,
and I go through this list and send the packages:
for porta in portas:
resposta = sr1(IP(dst='qualquerendereço.com')/TCP(dport=porta, flags='S'))
print(resposta['TCP'].flags)
So I took this and went to run in the "terminal" of scapy. When I do this, it makes a mistake, but when I try to scan any of those doors on the list individually, everything works out. I know it’s returning type error because in the response of the package I sent , it’s being returned None , but what I just don’t know , is why it returns None when I’m traversing a list and returns everything normally when I scan a port individually.
>>> for porta in portas:
...: a = sr1(IP(dst='qualquerendereço.com')/TCP(dport=porta, flags='S'))
...: print(a['TCP'].flags)
...:
Begin emission:
.........Finished sending 1 packets.
*
Received 10 packets, got 1 answers, remaining 0 packets
Begin emission:
..Finished sending 1 packets.
.*
Received 4 packets, got 1 answers, remaining 0 packets
Begin emission:
Finished sending 1 packets.
.....................................................
Received 53 packets, got 0 answers, remaining 1 packets
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-16-5186c1424e3a> in <module>
1 for porta in portas:
2 a = sr1(IP(dst='qualquerendereço.com')/TCP(dport=porta, flags='S'),timeout=.5)
----> 3 a[TCP].flags
4
TypeError: 'NoneType' object is not subscriptable
Also, I have another question: What do these dots mean that scapy keeps showing on the screen when we’re sending the packets?