SYN scanning can be blocked by firewalls. However, packets with the FIN flag set have the ability to bypass firewalls. Here is how it works--for a FIN packet, the closed ports reply with an RST packet, whereas the open ports ignore the packets. If it's an ICMP packet with type 3, and code 1, 2, 3, 9, 10, or 13, we may infer that the port is filtered and the port state cannot be found. We can use Scapy to create the FIN packet and scan the ports.
FIN scanning
How to do it...
We can create a FIN scanner as following:
- As we did in the previous recipe, we have to create another file, fin-scanner.py, and open it in our editor.
- Then import the required module:
from scapy.all import *
- As we did for the SYN scanner, set...