Skip to content

Commit 619acc8

Browse files
authored
Add files via upload
1 parent 3fc9eb5 commit 619acc8

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

portscanner.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
3+
import socket
4+
import termcolor
5+
6+
7+
def scan(target, ports):
8+
print('\n' + ' Starting Scan For ' + str(target))
9+
for port in range(1,ports):
10+
scan_port(target,port)
11+
12+
13+
def scan_port(ipaddress, port):
14+
try:
15+
sock = socket.socket()
16+
sock.connect((ipaddress, port))
17+
print("[+] Port Opened " + str(port))
18+
sock.close()
19+
except:
20+
pass
21+
22+
23+
targets = input("[*] Enter Targets To Scan(split them by ,): ")
24+
ports = int(input("[*] Enter How Many Ports You Want To Scan: "))
25+
if ',' in targets:
26+
print(termcolor.colored(("[*] Scanning Multiple Targets"), 'green'))
27+
for ip_addr in targets.split(','):
28+
scan(ip_addr.strip(' '), ports)
29+
else:
30+
scan(targets,ports)

0 commit comments

Comments
 (0)