-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenPorts.py
35 lines (31 loc) · 2.13 KB
/
OpenPorts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import socket
import termcolor
print("""
░█████╗░██████╗░███████╗███╗░░██╗ ██████╗░░█████╗░██████╗░████████╗░██████╗
██╔══██╗██╔══██╗██╔════╝████╗░██║ ██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝
██║░░██║██████╔╝█████╗░░██╔██╗██║ ██████╔╝██║░░██║██████╔╝░░░██║░░░╚█████╗░
██║░░██║██╔═══╝░██╔══╝░░██║╚████║ ██╔═══╝░██║░░██║██╔══██╗░░░██║░░░░╚═══██╗
╚█████╔╝██║░░░░░███████╗██║░╚███║ ██║░░░░░╚█████╔╝██║░░██║░░░██║░░░██████╔╝
░╚════╝░╚═╝░░░░░╚══════╝╚═╝░░╚══╝ ╚═╝░░░░░░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═════╝░
By Boudir Mohammed Mehdi
""")
def scan(target, ports):
print('\n' + 'Starting Scan For ' + str(target))
for port in range(1,ports):
scan_port(target, port)
def scan_port(ipaddress, port):
try:
sock = socket.socket()
sock.connect((ipaddress, port))
print("[+] Port Opened "+str(port))
sock.close()
except:
pass
targets = input("[*] Enter Targets To Scan (Split Them By , ) : ")
ports = int(input("[*] Enter how many Ports You Want To Scan : "))
if ',' in targets:
print(termcolor.colored(("[*] Scanning Multiple Targets"), 'green'))
for ip_addr in targets.split(','):
scan(ip_addr.strip(' '),ports)
else:
scan(targets,ports)