Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
itaynir1 authored Jul 22, 2023
1 parent 3fc9eb5 commit 619acc8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions portscanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@


import socket
import termcolor


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)

0 comments on commit 619acc8

Please sign in to comment.