File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import socket
2
+ print (r"""
3
+ ____
4
+ | _ \ _ _ _
5
+ | |_) ( )_ __ | | __ _ ___| |
6
+ | _ - | _ \| | _ / _` |/ __| |___
7
+ | |_) | | | | | (_) | (_) |\__ \ _ \
8
+ |____/|_|_| |_|_,___ |\__,_|_ __/ | |_|
9
+ """ )
10
+ print (r""" ***** Network scanning tool ***** """ )
11
+ def scan_ports (target , start_port , end_port ):
12
+ print (f"Scanning ports on { target } ...\n " )
13
+ for port in range (start_port , end_port + 1 ):
14
+ sock = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
15
+ sock .settimeout (1 )
16
+ result = sock .connect_ex ((target , port ))
17
+ if result == 0 :
18
+ print (f"Port { port } is open" )
19
+ sock .close ()
20
+
21
+ # Collect input from the user
22
+ target_ip = input ("Enter the target IP address: " )
23
+ start_port = int (input ("Enter the starting port: " ))
24
+ end_port = int (input ("Enter the ending port: " ))
25
+
26
+ # Perform the port scanning
27
+ scan_ports (target_ip , start_port , end_port )
You can’t perform that action at this time.
0 commit comments