killchain-compendium/Enumeration/EnumScripts/another_port_scanner.py

14 lines
336 B
Python
Raw Normal View History

2023-07-30 23:58:48 +02:00
#!/usr/bin/env python3
2022-11-13 01:16:26 +01:00
import socket
2023-07-30 23:58:48 +02:00
HOST = "1.1.1.1"
port_list = [21, 22, 53, 80, 443, 3306, 8443, 8080]
for port in port_list:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((HOST, port))
print("Port ", port, " is open")
except Exception:
print("Port ", port, " is closed")