--------------BASIC PY PENETRATION
TESTING CODE-----------
import socket
def port_scan(target_host, target_ports):
for port in target_ports:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2)
result = sock.connect_ex((target_host, port))
if result == 0:
print(f"Port {port} is open")
else:
print(f"Port {port} is closed")
sock.close()
except socket.error:
print("An error occurred while scanning the port")
break
def main():
target_host = input("Enter the target host: ")
target_ports = [80, 443, 22, 21, 3389] # Add more ports to scan if needed
print(f"Scanning {target_host}...")
port_scan(target_host, target_ports)
if __name__ == "__main__":
main()
mindluster.com password-Dhonifan69@!