killchain-compendium/enumeration/network_scanners/another_port_scanner.py

12 lines
283 B
Python
Raw Normal View History

2021-12-04 00:26:03 +01:00
#!/usr/bin/python3
import socket
host = "1.1.1.1"
portList = [21,22,53,80,443,3306,8443,8080]
for port in portList:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((host,port))
print("Port ", port, " is open")
except:
print("Port ", port, " is closed")