File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import socket
2
+ from termcolor import colored , cprint
3
+
4
+ def scan (target , ports ):
5
+ cprint ('\n \n ' + 'Starting Scan For : ' + str (target ),'blue' )
6
+ for port in range (1 , ports + 1 ):
7
+ scan_port (target , port )
8
+
9
+ def scan_port (ipaddress , port ):
10
+ try :
11
+ sock = socket .socket ()
12
+ sock .connect ((ipaddress , port ))
13
+ cprint ("[*] Port {} is open" .format (port ), 'red' )
14
+ sock .close ()
15
+ except :
16
+ cprint ("[*] Port {} is Closed" .format (port ), 'yellow' )
17
+
18
+ targets = input ('[#] Enter your target/s IP address/s (use "," to differentiate between them): ' )
19
+ colored_targets = colored (targets , 'green' )
20
+ print (colored_targets )
21
+
22
+ ports = int (input ('[#] Enter the Number of ports you want to scan: ' ))
23
+ colored_ports = colored (str (ports ), 'green' )
24
+ print (colored_ports )
25
+
26
+ if ',' in targets :
27
+ cprint ('[+++] Scanning Multiple Targets ' ,'magenta' )
28
+ for ip_addr in targets .split (',' ):
29
+ scan (ip_addr .strip (' ' ), ports )
30
+ else :
31
+ cprint ('[+] Scanning Single Target ' ,'magenta' )
32
+ scan (targets , ports )
You can’t perform that action at this time.
0 commit comments