I have made a simple port scanner in Python (code below the question). I'm running the scanner on a virtual Kali Linux against a virtual Windows 10. I'm using VMware Workstation 15 Player with both virtual machines having bridged network adapters. All computers are on the same lan.
The problem is that it seems like the Windows Firewall is slowing down the scan and I can't figure out why. With the firewall activated each port takes minutes to scan. When I disable the firewall it scans the ports within seconds. Same behaviour when I run the scanner from my host (also Windows 10) against my virtual Windows 10.
I've been playing around with the firewall rules but haven't found anything that would let the scanning go quickly with the firewall activated.
So my question is, is there a Windows Firewall rule or something else that I can enable to make the scanning go quickly, even with the firewall activated?
Code for the scanner:
#!/usr/bin/python
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(1)
host = raw_input("[*] Enter The Host To Scan: ")
def portscanner(port):
if sock.connect_ex((host, port)):
print ("[!!] Port %d is closed" % (port))
else:
print ("[+] Port %d is open" % (port))
for port in range(1,100):
portscanner(port)