0% found this document useful (0 votes)
18 views1 page

Basic Py Penetration Testing Code

The document contains a Python script for basic penetration testing that performs a port scan on a specified target host. It checks a predefined list of ports to determine if they are open or closed. Additionally, it includes a password for the domain mindluster.com.

Uploaded by

atharvapatel9696
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Basic Py Penetration Testing Code

The document contains a Python script for basic penetration testing that performs a port scan on a specified target host. It checks a predefined list of ports to determine if they are open or closed. Additionally, it includes a password for the domain mindluster.com.

Uploaded by

atharvapatel9696
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

--------------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@!

You might also like