SnakeScan 1.7.5__tar.gz → 1.7.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snakescan-1.7.7/PKG-INFO +102 -0
- snakescan-1.7.7/README.md +89 -0
- {snakescan-1.7.5 → snakescan-1.7.7}/SnakeScan/CLI.py +196 -68
- snakescan-1.7.7/SnakeScan/PoolExecutor.py +80 -0
- snakescan-1.7.7/SnakeScan/Pool_UDP_Executor.py +84 -0
- {snakescan-1.7.5 → snakescan-1.7.7}/SnakeScan/__init__.py +1 -1
- snakescan-1.7.5/PKG-INFO +0 -102
- snakescan-1.7.5/README.md +0 -88
- snakescan-1.7.5/SnakeScan/PoolExecutor.py +0 -112
- {snakescan-1.7.5 → snakescan-1.7.7}/LICENSE +0 -0
- {snakescan-1.7.5 → snakescan-1.7.7}/SnakeScan/Check_subnet.py +0 -0
- {snakescan-1.7.5 → snakescan-1.7.7}/SnakeScan/Get_ssl.py +0 -0
- {snakescan-1.7.5 → snakescan-1.7.7}/pyproject.toml +0 -0
snakescan-1.7.7/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SnakeScan
|
|
3
|
+
Version: 1.7.7
|
|
4
|
+
Summary: IPv4 address scanner for collecting address information.Scan or get the IPv4 address from the IPv6 host
|
|
5
|
+
Author: Den*Ram
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: art
|
|
11
|
+
Requires-Dist: tqdm
|
|
12
|
+
Requires-Dist: termcolor
|
|
13
|
+
|
|
14
|
+
<!--
|
|
15
|
+
|
|
16
|
+
This documentation was created with the assistance of the GeekBot language model and Den*Ram
|
|
17
|
+
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
# 🐍 SnakeScan: A Robust Python Port Scanner
|
|
21
|
+
|
|
22
|
+
A versatile and efficient Python library designed for comprehensive network port scanning.
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/SnakeScan/)
|
|
25
|
+
|
|
26
|
+
[](https://opensource.org/licenses/MIT)
|
|
27
|
+
|
|
28
|
+
[](https://www.python.org/)
|
|
29
|
+
|
|
30
|
+
[](https://img.shields.io/badge/Status-Beta-yellow)
|
|
31
|
+
|
|
32
|
+
**SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers requiring reliable port scanning capabilities. From basic port verification to advanced, multi-threaded subnet analysis, SnakeScan delivers the tools necessary for effective network assessment.
|
|
33
|
+
|
|
34
|
+
## ⚙️ Key Features:
|
|
35
|
+
|
|
36
|
+
* **Flexible Port Specification:** Define target ports as single values, ranges, or through pre-configured sets.
|
|
37
|
+
|
|
38
|
+
* **Multi-Threaded Architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
|
|
39
|
+
|
|
40
|
+
* **IP Information Retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
|
|
41
|
+
|
|
42
|
+
* **Real-time Port Monitoring:** Utilize the `Watcher` class for continuous monitoring of critical port statuses.
|
|
43
|
+
|
|
44
|
+
* **Concise Command-Line Interface & API:** Integrate SnakeScan seamlessly into workflows via CLI or programmatic access.
|
|
45
|
+
|
|
46
|
+
* **UDP Port Scanning:** Native support for scanning UDP ports.
|
|
47
|
+
|
|
48
|
+
## ⬇️ Installation:
|
|
49
|
+
|
|
50
|
+
Install SnakeScan using pip:
|
|
51
|
+
|
|
52
|
+
bash
|
|
53
|
+
|
|
54
|
+
pip install SnakeScan
|
|
55
|
+
|
|
56
|
+
## ⌨️ Command Line Usage:
|
|
57
|
+
|
|
58
|
+
### 💡 Attribute Reference:
|
|
59
|
+
|
|
60
|
+
* **-p**: Specify target ports for scanning (single port or range). Note: Range specifications exclude the lower bound on the first entry. Example: To scan from port 80 to 443, define the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
61
|
+
|
|
62
|
+
* **-u**: Enable UDP port scanning. Example: `snake -p 53 -u`
|
|
63
|
+
|
|
64
|
+
* **-h**: Display the complete list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
65
|
+
|
|
66
|
+
* **-sp**: Initiate a scan using a predefined set of common ports with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
67
|
+
|
|
68
|
+
* **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
|
|
69
|
+
|
|
70
|
+
* **-gs**: Retrieve the SSL/TLS certificate from a specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
|
|
71
|
+
|
|
72
|
+
* **-t**: Enable multi-threading for enhanced scan performance. Example: `snake -t`
|
|
73
|
+
|
|
74
|
+
* **-ch**: Scan a subnet to discover active IP addresses on the network. Example: `snake -ch`
|
|
75
|
+
|
|
76
|
+
* **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
|
|
77
|
+
|
|
78
|
+
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
79
|
+
|
|
80
|
+
## 💻 Python Code Integration:
|
|
81
|
+
|
|
82
|
+
### ⏱️ Watcher Class: Real-Time Port Status
|
|
83
|
+
|
|
84
|
+
The `Watcher` class facilitates continuous monitoring of a specified port.
|
|
85
|
+
|
|
86
|
+
python
|
|
87
|
+
|
|
88
|
+
from SnakeScan import Watcher
|
|
89
|
+
|
|
90
|
+
watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
|
|
91
|
+
|
|
92
|
+
watcher.start() # Begin monitoring!
|
|
93
|
+
|
|
94
|
+
#### `Watcher` Methods:
|
|
95
|
+
|
|
96
|
+
* `Watcher.start()` - Initiate the port monitoring process.
|
|
97
|
+
|
|
98
|
+
* `Watcher.stop()` - Terminate the port monitoring process.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**Latest Update:** 1.7.6 (Introduced UDP port scanning)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
This documentation was created with the assistance of the GeekBot language model and Den*Ram
|
|
4
|
+
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
# 🐍 SnakeScan: A Robust Python Port Scanner
|
|
8
|
+
|
|
9
|
+
A versatile and efficient Python library designed for comprehensive network port scanning.
|
|
10
|
+
|
|
11
|
+
[](https://pypi.org/project/SnakeScan/)
|
|
12
|
+
|
|
13
|
+
[](https://opensource.org/licenses/MIT)
|
|
14
|
+
|
|
15
|
+
[](https://www.python.org/)
|
|
16
|
+
|
|
17
|
+
[](https://img.shields.io/badge/Status-Beta-yellow)
|
|
18
|
+
|
|
19
|
+
**SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers requiring reliable port scanning capabilities. From basic port verification to advanced, multi-threaded subnet analysis, SnakeScan delivers the tools necessary for effective network assessment.
|
|
20
|
+
|
|
21
|
+
## ⚙️ Key Features:
|
|
22
|
+
|
|
23
|
+
* **Flexible Port Specification:** Define target ports as single values, ranges, or through pre-configured sets.
|
|
24
|
+
|
|
25
|
+
* **Multi-Threaded Architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
|
|
26
|
+
|
|
27
|
+
* **IP Information Retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
|
|
28
|
+
|
|
29
|
+
* **Real-time Port Monitoring:** Utilize the `Watcher` class for continuous monitoring of critical port statuses.
|
|
30
|
+
|
|
31
|
+
* **Concise Command-Line Interface & API:** Integrate SnakeScan seamlessly into workflows via CLI or programmatic access.
|
|
32
|
+
|
|
33
|
+
* **UDP Port Scanning:** Native support for scanning UDP ports.
|
|
34
|
+
|
|
35
|
+
## ⬇️ Installation:
|
|
36
|
+
|
|
37
|
+
Install SnakeScan using pip:
|
|
38
|
+
|
|
39
|
+
bash
|
|
40
|
+
|
|
41
|
+
pip install SnakeScan
|
|
42
|
+
|
|
43
|
+
## ⌨️ Command Line Usage:
|
|
44
|
+
|
|
45
|
+
### 💡 Attribute Reference:
|
|
46
|
+
|
|
47
|
+
* **-p**: Specify target ports for scanning (single port or range). Note: Range specifications exclude the lower bound on the first entry. Example: To scan from port 80 to 443, define the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
48
|
+
|
|
49
|
+
* **-u**: Enable UDP port scanning. Example: `snake -p 53 -u`
|
|
50
|
+
|
|
51
|
+
* **-h**: Display the complete list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
52
|
+
|
|
53
|
+
* **-sp**: Initiate a scan using a predefined set of common ports with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
54
|
+
|
|
55
|
+
* **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
|
|
56
|
+
|
|
57
|
+
* **-gs**: Retrieve the SSL/TLS certificate from a specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
|
|
58
|
+
|
|
59
|
+
* **-t**: Enable multi-threading for enhanced scan performance. Example: `snake -t`
|
|
60
|
+
|
|
61
|
+
* **-ch**: Scan a subnet to discover active IP addresses on the network. Example: `snake -ch`
|
|
62
|
+
|
|
63
|
+
* **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
|
|
64
|
+
|
|
65
|
+
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
66
|
+
|
|
67
|
+
## 💻 Python Code Integration:
|
|
68
|
+
|
|
69
|
+
### ⏱️ Watcher Class: Real-Time Port Status
|
|
70
|
+
|
|
71
|
+
The `Watcher` class facilitates continuous monitoring of a specified port.
|
|
72
|
+
|
|
73
|
+
python
|
|
74
|
+
|
|
75
|
+
from SnakeScan import Watcher
|
|
76
|
+
|
|
77
|
+
watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
|
|
78
|
+
|
|
79
|
+
watcher.start() # Begin monitoring!
|
|
80
|
+
|
|
81
|
+
#### `Watcher` Methods:
|
|
82
|
+
|
|
83
|
+
* `Watcher.start()` - Initiate the port monitoring process.
|
|
84
|
+
|
|
85
|
+
* `Watcher.stop()` - Terminate the port monitoring process.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
**Latest Update:** 1.7.6 (Introduced UDP port scanning)
|
|
@@ -11,6 +11,7 @@ from tqdm import tqdm
|
|
|
11
11
|
from SnakeScan.Check_subnet import Check_network
|
|
12
12
|
from SnakeScan.PoolExecutor import PoolProcessExecutor
|
|
13
13
|
from SnakeScan.Get_ssl import Get_ssl
|
|
14
|
+
from SnakeScan.Pool_UDP_Executor import PoolExecutorUDP
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
def main():
|
|
@@ -23,96 +24,57 @@ OpenPorts = []
|
|
|
23
24
|
threads = []
|
|
24
25
|
portsopen = 0
|
|
25
26
|
portsclosed = 0
|
|
26
|
-
Bool = True
|
|
27
|
-
boolsd = True
|
|
28
|
-
boolean = 0
|
|
29
27
|
ports = {
|
|
30
28
|
20: "FTP-Data",
|
|
31
29
|
21: "FTP-Control",
|
|
32
30
|
22: "SSH",
|
|
33
31
|
23: "Telnet",
|
|
34
|
-
24: "Priv-mail",
|
|
35
32
|
25: "SMTP",
|
|
36
|
-
29: "MSG-ICP",
|
|
37
|
-
31: "MSG-AUTH",
|
|
38
|
-
33: "DSP",
|
|
39
|
-
35: "Priv-print",
|
|
40
|
-
41: "Graphics",
|
|
41
|
-
42: "WINS",
|
|
42
33
|
43: "Whois",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
63: "WHOISPP",
|
|
47
|
-
66: "SQL-NET",
|
|
48
|
-
75: "Priv-dial",
|
|
34
|
+
53: "DNS",
|
|
35
|
+
70: "Gopher",
|
|
36
|
+
79: "FINGER",
|
|
49
37
|
80: "HTTP",
|
|
50
|
-
109: "POP2",
|
|
51
38
|
110: "POP3",
|
|
39
|
+
111: "RPC",
|
|
52
40
|
113: "ident",
|
|
53
41
|
115: "SFTP",
|
|
54
|
-
|
|
55
|
-
119: "NNTP",
|
|
42
|
+
135: "MSRPC",
|
|
56
43
|
139: "NetBIOS-SSN",
|
|
57
44
|
143: "IMAP",
|
|
58
45
|
179: "BGP",
|
|
59
46
|
194: "IRC",
|
|
60
|
-
|
|
61
|
-
200: "SRC",
|
|
62
|
-
220: "IMAP3",
|
|
63
|
-
311: "ASIP-WEBADMIN",
|
|
64
|
-
344: "PDAP",
|
|
65
|
-
345: "PAWSERV",
|
|
66
|
-
346: "ZSERV",
|
|
67
|
-
347: "FATSERV",
|
|
68
|
-
401: "UPS",
|
|
69
|
-
413: "SMSP",
|
|
70
|
-
427: "SVRLOC",
|
|
47
|
+
389: "LDAP",
|
|
71
48
|
443: "HTTPS",
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
49
|
+
445: "SMB",
|
|
50
|
+
465: "SMTPS",
|
|
51
|
+
587: "SMTP Submission",
|
|
75
52
|
631: "IPP",
|
|
76
53
|
636: "LDAPS",
|
|
77
|
-
639: "MSDP",
|
|
78
|
-
646: "LDP",
|
|
79
|
-
647: "DHCP-FAILOVER",
|
|
80
|
-
648: "RRP",
|
|
81
|
-
753: "RRH",
|
|
82
|
-
830: "NETCONF-SSH",
|
|
83
|
-
831: "NETCONF-BEEP",
|
|
84
|
-
832: "NETCONFSOAPHTTP",
|
|
85
|
-
833: "NETCONFSOAPBEEP",
|
|
86
|
-
861: "OWAMP-CONTROL",
|
|
87
|
-
862: "TWAPM-CONTROL",
|
|
88
54
|
873: "RSYNC",
|
|
89
|
-
|
|
90
|
-
990: "FTPS",
|
|
55
|
+
993: "IMAPS",
|
|
91
56
|
995: "POP3S",
|
|
92
|
-
1038: "MTQP",
|
|
93
57
|
1080: "SOCKS",
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
58
|
+
1433: "SQL Server",
|
|
59
|
+
1521: "Oracle",
|
|
60
|
+
2082: "CPanel",
|
|
61
|
+
2083: "CPanel",
|
|
97
62
|
2222: "SSH",
|
|
98
|
-
3128: "HTTP",
|
|
99
|
-
3268: "LDAP",
|
|
63
|
+
3128: "HTTP Proxy",
|
|
100
64
|
3306: "MySQL",
|
|
101
65
|
3389: "RDP",
|
|
102
|
-
3455: "RSVP",
|
|
103
|
-
3632: "Distributed compiler",
|
|
104
|
-
3689: "DAAP",
|
|
105
66
|
5432: "PostgreSQL",
|
|
106
67
|
5900: "VNC",
|
|
107
|
-
8000: "HTTP",
|
|
108
|
-
8080: "HTTP",
|
|
109
|
-
8443: "HTTPS",
|
|
110
|
-
8888: "HTTP",
|
|
68
|
+
8000: "HTTP Alternate",
|
|
69
|
+
8080: "HTTP Alternate",
|
|
70
|
+
8443: "HTTPS Alternate",
|
|
71
|
+
8888: "HTTP Alternate",
|
|
111
72
|
10000: "Webmin",
|
|
73
|
+
27017: "MongoDB",
|
|
112
74
|
}
|
|
113
75
|
|
|
114
76
|
|
|
115
|
-
version = "1.7.
|
|
77
|
+
version = "1.7.7"
|
|
116
78
|
|
|
117
79
|
|
|
118
80
|
def is_port_open(host, port):
|
|
@@ -133,11 +95,15 @@ def is_port_open_threads(host, port):
|
|
|
133
95
|
s.connect((host, port))
|
|
134
96
|
except (OSError, socket.timeout):
|
|
135
97
|
try:
|
|
136
|
-
print(
|
|
137
|
-
|
|
138
|
-
|
|
98
|
+
print(
|
|
99
|
+
f"Closed{colored('|X|','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')}"
|
|
100
|
+
)
|
|
101
|
+
except Exception as e:
|
|
102
|
+
print(f"Closed{colored('|X|','red')}-->{colored(f'|{port}|','red')}")
|
|
139
103
|
else:
|
|
140
|
-
print(
|
|
104
|
+
print(
|
|
105
|
+
f"Open{colored('|√|','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')}"
|
|
106
|
+
)
|
|
141
107
|
|
|
142
108
|
|
|
143
109
|
def Ports(str=""):
|
|
@@ -172,6 +138,9 @@ def SnakeArgs():
|
|
|
172
138
|
description="SnakeScan - It's a command line library for scan and get information about ip."
|
|
173
139
|
)
|
|
174
140
|
parser.add_argument("host", nargs="?", default="None")
|
|
141
|
+
parser.add_argument(
|
|
142
|
+
"-u", "--udp", action="store_true", help="Use UDP ports for scanning"
|
|
143
|
+
)
|
|
175
144
|
parser.add_argument(
|
|
176
145
|
"-gs", "--getssl", action="store_true", help="Get official ssl certificate"
|
|
177
146
|
)
|
|
@@ -225,24 +194,178 @@ for n in range(len(host)):
|
|
|
225
194
|
host[n] = host[n][0:i]
|
|
226
195
|
if host[0] == "None":
|
|
227
196
|
host[0] = "localhost"
|
|
197
|
+
if SnakeArgs().udp:
|
|
198
|
+
|
|
199
|
+
def is_port_open(host, port, timeout=1):
|
|
200
|
+
try:
|
|
201
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
202
|
+
sock.settimeout(timeout)
|
|
203
|
+
message = b"Test UDP packet"
|
|
204
|
+
address = (host, port)
|
|
205
|
+
|
|
206
|
+
sock.sendto(message, address)
|
|
207
|
+
|
|
208
|
+
try:
|
|
209
|
+
data, server = sock.recvfrom(4096)
|
|
210
|
+
print(f"Response received: {data.decode()} from {server}")
|
|
211
|
+
is_open = True
|
|
212
|
+
except socket.timeout:
|
|
213
|
+
is_open = False
|
|
214
|
+
except ConnectionRefusedError:
|
|
215
|
+
is_open = False
|
|
216
|
+
|
|
217
|
+
sock.close()
|
|
218
|
+
return is_open
|
|
219
|
+
|
|
220
|
+
except socket.gaierror:
|
|
221
|
+
print("Error: Unable to resolve host name.")
|
|
222
|
+
return None
|
|
223
|
+
except socket.error as e:
|
|
224
|
+
print(f"Socket error: {e}")
|
|
225
|
+
return False
|
|
226
|
+
|
|
227
|
+
def is_port_open_threads(host, port, timeout=1):
|
|
228
|
+
try:
|
|
229
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
230
|
+
sock.settimeout(timeout)
|
|
231
|
+
message = b"Test UDP packet"
|
|
232
|
+
address = (host, port)
|
|
233
|
+
|
|
234
|
+
sock.sendto(message, address)
|
|
235
|
+
|
|
236
|
+
try:
|
|
237
|
+
data, server = sock.recvfrom(4096)
|
|
238
|
+
print(f"Response received: {data.decode()} from {server}")
|
|
239
|
+
print(
|
|
240
|
+
f"Open{colored('[√]','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')} may be listening on host"
|
|
241
|
+
)
|
|
242
|
+
except socket.timeout:
|
|
243
|
+
print(
|
|
244
|
+
f"Closed{colored('[X]','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')} is likely closed on host"
|
|
245
|
+
)
|
|
246
|
+
except ConnectionRefusedError:
|
|
247
|
+
print("An error occurred while scanning.")
|
|
248
|
+
sock.close()
|
|
249
|
+
except socket.gaierror:
|
|
250
|
+
print("Error: Unable to resolve host name.")
|
|
251
|
+
except socket.error as e:
|
|
252
|
+
print(f"Socket error: {e}")
|
|
253
|
+
|
|
254
|
+
ports = {
|
|
255
|
+
7: "ECHO",
|
|
256
|
+
9: "DISCARD",
|
|
257
|
+
13: "DAYTIME",
|
|
258
|
+
17: "QOTD (Quote of the Day)",
|
|
259
|
+
19: "CHARGEN (Character Generator)",
|
|
260
|
+
53: "DNS (Domain Name System)",
|
|
261
|
+
67: "DHCP Server",
|
|
262
|
+
68: "DHCP Client",
|
|
263
|
+
69: "TFTP (Trivial File Transfer Protocol)",
|
|
264
|
+
111: "RPC (Remote Procedure Call)",
|
|
265
|
+
123: "NTP (Network Time Protocol)",
|
|
266
|
+
137: "NetBIOS Name Service",
|
|
267
|
+
138: "NetBIOS Datagram Service",
|
|
268
|
+
161: "SNMP (Simple Network Management Protocol)",
|
|
269
|
+
162: "SNMP Trap",
|
|
270
|
+
443: "QUIC (Quick UDP Internet Connections)",
|
|
271
|
+
500: "ISAKMP (Internet Security Association and Key Management Protocol)",
|
|
272
|
+
520: "RIP (Routing Information Protocol)",
|
|
273
|
+
1434: "Microsoft SQL Server Dynamic Port Allocation",
|
|
274
|
+
4500: "IPsec NAT-Traversal (NAT-T)",
|
|
275
|
+
5353: "mDNS (Multicast DNS)",
|
|
276
|
+
5355: "LLMNR (Link-Local Multicast Name Resolution)",
|
|
277
|
+
1900: "SSDP (Simple Service Discovery Protocol)",
|
|
278
|
+
3478: "STUN (Session Traversal Utilities for NAT)",
|
|
279
|
+
5060: "SIP (Session Initiation Protocol)",
|
|
280
|
+
5061: "SIP (Session Initiation Protocol) (TLS)",
|
|
281
|
+
20777: "Garmin Training Center",
|
|
282
|
+
3074: "Xbox Live",
|
|
283
|
+
3479: "TURN (Traversal Using Relays around NAT)",
|
|
284
|
+
4126: "Muon",
|
|
285
|
+
50000: "Drone (Drone Protocol)",
|
|
286
|
+
60000: "RDP (Remote Desktop Protocol) over UDP",
|
|
287
|
+
5000: "fCoE (Fibre Channel over Ethernet)",
|
|
288
|
+
5001: "HP OpenView Operations Agent",
|
|
289
|
+
1719: "H.323 Gatekeeper RAS",
|
|
290
|
+
1720: "H.323 Call Signaling",
|
|
291
|
+
1812: "RADIUS authentication",
|
|
292
|
+
1813: "RADIUS accounting",
|
|
293
|
+
5222: "XMPP client connection",
|
|
294
|
+
5269: "XMPP server connection",
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
else:
|
|
298
|
+
ports = {
|
|
299
|
+
20: "FTP-Data",
|
|
300
|
+
21: "FTP-Control",
|
|
301
|
+
22: "SSH",
|
|
302
|
+
23: "Telnet",
|
|
303
|
+
25: "SMTP",
|
|
304
|
+
43: "Whois",
|
|
305
|
+
53: "DNS",
|
|
306
|
+
70: "Gopher",
|
|
307
|
+
79: "FINGER",
|
|
308
|
+
80: "HTTP",
|
|
309
|
+
110: "POP3",
|
|
310
|
+
111: "RPC",
|
|
311
|
+
113: "ident",
|
|
312
|
+
115: "SFTP",
|
|
313
|
+
135: "MSRPC",
|
|
314
|
+
139: "NetBIOS-SSN",
|
|
315
|
+
143: "IMAP",
|
|
316
|
+
179: "BGP",
|
|
317
|
+
194: "IRC",
|
|
318
|
+
389: "LDAP",
|
|
319
|
+
443: "HTTPS",
|
|
320
|
+
445: "SMB",
|
|
321
|
+
465: "SMTPS",
|
|
322
|
+
587: "SMTP Submission",
|
|
323
|
+
631: "IPP",
|
|
324
|
+
636: "LDAPS",
|
|
325
|
+
873: "RSYNC",
|
|
326
|
+
993: "IMAPS",
|
|
327
|
+
995: "POP3S",
|
|
328
|
+
1080: "SOCKS",
|
|
329
|
+
1433: "SQL Server",
|
|
330
|
+
1521: "Oracle",
|
|
331
|
+
2082: "CPanel",
|
|
332
|
+
2083: "CPanel",
|
|
333
|
+
2222: "SSH",
|
|
334
|
+
3128: "HTTP Proxy",
|
|
335
|
+
3306: "MySQL",
|
|
336
|
+
3389: "RDP",
|
|
337
|
+
5432: "PostgreSQL",
|
|
338
|
+
5900: "VNC",
|
|
339
|
+
8000: "HTTP Alternate",
|
|
340
|
+
8080: "HTTP Alternate",
|
|
341
|
+
8443: "HTTPS Alternate",
|
|
342
|
+
8888: "HTTP Alternate",
|
|
343
|
+
10000: "Webmin",
|
|
344
|
+
27017: "MongoDB",
|
|
345
|
+
}
|
|
346
|
+
|
|
228
347
|
if SnakeArgs().ports:
|
|
229
348
|
rangeports, port_user = Ports(port_user)
|
|
230
349
|
for i in range(len(port_user)):
|
|
231
|
-
|
|
350
|
+
try:
|
|
351
|
+
port_user[i] = int(port_user[i])
|
|
352
|
+
except Exception as e:
|
|
353
|
+
print(f"Incorrect input,please check the help documentation:{e}")
|
|
354
|
+
sys.exit()
|
|
232
355
|
for n in range(len(host)):
|
|
233
356
|
for port in range(len(port_user)):
|
|
234
357
|
if is_port_open(host[n], port_user[port]):
|
|
235
358
|
print(
|
|
236
|
-
f"Open{colored('|√|','green')}{host[n]}-->{ports
|
|
359
|
+
f"Open{colored('|√|','green')}{host[n]}-->{colored(f'{str(ports.get(port_user[port],''))}','light_green')}{colored(f'|{port_user[port]}|','green')}"
|
|
237
360
|
)
|
|
238
361
|
else:
|
|
239
362
|
try:
|
|
240
363
|
print(
|
|
241
|
-
f"Closed{colored('|X|','red')}{host[n]}-->{ports
|
|
364
|
+
f"Closed{colored('|X|','red')}{host[n]}-->{colored(str(ports.get(port_user[port],'')),'light_red')}{colored(f'|{port_user[port]}|','red')}"
|
|
242
365
|
)
|
|
243
366
|
except:
|
|
244
367
|
print(
|
|
245
|
-
f"Closed{colored('|X|','red')}{host[n]}
|
|
368
|
+
f"Closed{colored('|X|','red')}{host[n]}-->{colored(f'|{port_user[port]}|','red')}"
|
|
246
369
|
)
|
|
247
370
|
try:
|
|
248
371
|
first = rangeports[::2]
|
|
@@ -390,6 +513,11 @@ if SnakeArgs().thread:
|
|
|
390
513
|
if SnakeArgs().version:
|
|
391
514
|
print(f"SnakeScan_Build_{version}")
|
|
392
515
|
if SnakeArgs().speed:
|
|
516
|
+
if SnakeArgs().udp:
|
|
517
|
+
for n in range(len(host)):
|
|
518
|
+
print(f"{host[n]}".center(60, "—"))
|
|
519
|
+
PoolExecutorUDP(host[n])
|
|
520
|
+
sys.exit()
|
|
393
521
|
for n in range(len(host)):
|
|
394
522
|
print(f"{host[n]}".center(60, "—"))
|
|
395
523
|
PoolProcessExecutor(host[n])
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import socket
|
|
2
|
+
from termcolor import colored
|
|
3
|
+
from concurrent.futures import ProcessPoolExecutor
|
|
4
|
+
|
|
5
|
+
ports = {
|
|
6
|
+
20: "FTP-Data",
|
|
7
|
+
21: "FTP-Control",
|
|
8
|
+
22: "SSH",
|
|
9
|
+
23: "Telnet",
|
|
10
|
+
25: "SMTP",
|
|
11
|
+
43: "Whois",
|
|
12
|
+
53: "DNS",
|
|
13
|
+
70: "Gopher",
|
|
14
|
+
79: "FINGER",
|
|
15
|
+
80: "HTTP",
|
|
16
|
+
110: "POP3",
|
|
17
|
+
111: "RPC",
|
|
18
|
+
113: "ident",
|
|
19
|
+
115: "SFTP",
|
|
20
|
+
135: "MSRPC",
|
|
21
|
+
139: "NetBIOS-SSN",
|
|
22
|
+
143: "IMAP",
|
|
23
|
+
179: "BGP",
|
|
24
|
+
194: "IRC",
|
|
25
|
+
389: "LDAP",
|
|
26
|
+
443: "HTTPS",
|
|
27
|
+
445: "SMB",
|
|
28
|
+
465: "SMTPS",
|
|
29
|
+
587: "SMTP Submission",
|
|
30
|
+
631: "IPP",
|
|
31
|
+
636: "LDAPS",
|
|
32
|
+
873: "RSYNC",
|
|
33
|
+
993: "IMAPS",
|
|
34
|
+
995: "POP3S",
|
|
35
|
+
1080: "SOCKS",
|
|
36
|
+
1433: "SQL Server",
|
|
37
|
+
1521: "Oracle",
|
|
38
|
+
2082: "CPanel",
|
|
39
|
+
2083: "CPanel",
|
|
40
|
+
2222: "SSH",
|
|
41
|
+
3128: "HTTP Proxy",
|
|
42
|
+
3306: "MySQL",
|
|
43
|
+
3389: "RDP",
|
|
44
|
+
5432: "PostgreSQL",
|
|
45
|
+
5900: "VNC",
|
|
46
|
+
8000: "HTTP Alternate",
|
|
47
|
+
8080: "HTTP Alternate",
|
|
48
|
+
8443: "HTTPS Alternate",
|
|
49
|
+
8888: "HTTP Alternate",
|
|
50
|
+
10000: "Webmin",
|
|
51
|
+
27017: "MongoDB",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def is_port_open_threads(host, port):
|
|
56
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
57
|
+
try:
|
|
58
|
+
s.settimeout(1)
|
|
59
|
+
s.connect((host, port))
|
|
60
|
+
except (OSError, socket.timeout):
|
|
61
|
+
try:
|
|
62
|
+
print(
|
|
63
|
+
f"Closed{colored('|X|','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')}"
|
|
64
|
+
)
|
|
65
|
+
except:
|
|
66
|
+
print(f"Closed{colored('|X|','red')}-->{colored(f'|{port}|','red')}")
|
|
67
|
+
else:
|
|
68
|
+
print(
|
|
69
|
+
f"Open{colored('|√|','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')}"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def PoolProcessExecutor(host):
|
|
74
|
+
with ProcessPoolExecutor(max_workers=None) as executor:
|
|
75
|
+
try:
|
|
76
|
+
for port in ports.keys():
|
|
77
|
+
future = executor.submit(is_port_open_threads, host, port)
|
|
78
|
+
|
|
79
|
+
except Exception as e:
|
|
80
|
+
print(e)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import socket
|
|
2
|
+
from termcolor import colored
|
|
3
|
+
from concurrent.futures import ProcessPoolExecutor
|
|
4
|
+
|
|
5
|
+
ports = {
|
|
6
|
+
7: "ECHO",
|
|
7
|
+
9: "DISCARD",
|
|
8
|
+
13: "DAYTIME",
|
|
9
|
+
17: "QOTD (Quote of the Day)",
|
|
10
|
+
19: "CHARGEN (Character Generator)",
|
|
11
|
+
53: "DNS (Domain Name System)",
|
|
12
|
+
67: "DHCP Server",
|
|
13
|
+
68: "DHCP Client",
|
|
14
|
+
69: "TFTP (Trivial File Transfer Protocol)",
|
|
15
|
+
111: "RPC (Remote Procedure Call)",
|
|
16
|
+
123: "NTP (Network Time Protocol)",
|
|
17
|
+
137: "NetBIOS Name Service",
|
|
18
|
+
138: "NetBIOS Datagram Service",
|
|
19
|
+
161: "SNMP (Simple Network Management Protocol)",
|
|
20
|
+
162: "SNMP Trap",
|
|
21
|
+
443: "QUIC (Quick UDP Internet Connections)",
|
|
22
|
+
500: "ISAKMP (Internet Security Association and Key Management Protocol)",
|
|
23
|
+
520: "RIP (Routing Information Protocol)",
|
|
24
|
+
1434: "Microsoft SQL Server Dynamic Port Allocation",
|
|
25
|
+
4500: "IPsec NAT-Traversal (NAT-T)",
|
|
26
|
+
5353: "mDNS (Multicast DNS)",
|
|
27
|
+
5355: "LLMNR (Link-Local Multicast Name Resolution)",
|
|
28
|
+
1900: "SSDP (Simple Service Discovery Protocol)",
|
|
29
|
+
3478: "STUN (Session Traversal Utilities for NAT)",
|
|
30
|
+
5060: "SIP (Session Initiation Protocol)",
|
|
31
|
+
5061: "SIP (Session Initiation Protocol) (TLS)",
|
|
32
|
+
20777: "Garmin Training Center",
|
|
33
|
+
3074: "Xbox Live",
|
|
34
|
+
3479: "TURN (Traversal Using Relays around NAT)",
|
|
35
|
+
4126: "Muon",
|
|
36
|
+
50000: "Drone (Drone Protocol)",
|
|
37
|
+
60000: "RDP (Remote Desktop Protocol) over UDP",
|
|
38
|
+
5000: "fCoE (Fibre Channel over Ethernet)",
|
|
39
|
+
5001: "HP OpenView Operations Agent",
|
|
40
|
+
1719: "H.323 Gatekeeper RAS",
|
|
41
|
+
1720: "H.323 Call Signaling",
|
|
42
|
+
1812: "RADIUS authentication",
|
|
43
|
+
1813: "RADIUS accounting",
|
|
44
|
+
5222: "XMPP client connection",
|
|
45
|
+
5269: "XMPP server connection",
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def is_port_open_threads(host, port, timeout=1):
|
|
50
|
+
try:
|
|
51
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
52
|
+
sock.settimeout(timeout)
|
|
53
|
+
message = b"Test UDP packet"
|
|
54
|
+
address = (host, port)
|
|
55
|
+
|
|
56
|
+
sock.sendto(message, address)
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
data, server = sock.recvfrom(4096)
|
|
60
|
+
print(f"Response received: {data.decode()} from {server}")
|
|
61
|
+
print(
|
|
62
|
+
f"Open{colored('[√]','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')} may be listening on host"
|
|
63
|
+
)
|
|
64
|
+
except socket.timeout:
|
|
65
|
+
print(
|
|
66
|
+
f"Closed{colored('[X]','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')} is likely closed on host"
|
|
67
|
+
)
|
|
68
|
+
except ConnectionRefusedError:
|
|
69
|
+
print("An error occurred while scanning.")
|
|
70
|
+
sock.close()
|
|
71
|
+
except socket.gaierror:
|
|
72
|
+
print("Error: Unable to resolve host name.")
|
|
73
|
+
except socket.error as e:
|
|
74
|
+
print(f"Socket error: {e}")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def PoolExecutorUDP(host):
|
|
78
|
+
with ProcessPoolExecutor(max_workers=None) as executor:
|
|
79
|
+
try:
|
|
80
|
+
for port in ports.keys():
|
|
81
|
+
future = executor.submit(is_port_open_threads, host, port)
|
|
82
|
+
|
|
83
|
+
except Exception as e:
|
|
84
|
+
print(e)
|
snakescan-1.7.5/PKG-INFO
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: SnakeScan
|
|
3
|
-
Version: 1.7.5
|
|
4
|
-
Summary: IPv4 address scanner for collecting address information.Scan or get the IPv4 address from the IPv6 host
|
|
5
|
-
Author: Den*Ram
|
|
6
|
-
Requires-Python: >=3.7
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Requires-Dist: art
|
|
11
|
-
Requires-Dist: tqdm
|
|
12
|
-
Requires-Dist: termcolor
|
|
13
|
-
|
|
14
|
-
<!--
|
|
15
|
-
|
|
16
|
-
This documentation was created with the assistance of the GeekBot language model and Den*Ram
|
|
17
|
-
|
|
18
|
-
-->
|
|
19
|
-
|
|
20
|
-
# 🐍 SnakeScan: Your Go-To Python Port Scanner
|
|
21
|
-
|
|
22
|
-
✨ A powerful and flexible Python library for all your port scanning needs. ✨
|
|
23
|
-
|
|
24
|
-
[](https://pypi.org/project/SnakeScan/)
|
|
25
|
-
|
|
26
|
-
[](https://opensource.org/licenses/MIT)
|
|
27
|
-
|
|
28
|
-
[](https://www.python.org/)
|
|
29
|
-
|
|
30
|
-
[](https://github.com/yourusername/SnakeScan/releases) <!-- Replace yourusername with yours -->
|
|
31
|
-
|
|
32
|
-
[](https://www.python.org/)
|
|
33
|
-
|
|
34
|
-
**SnakeScan** is designed to be both easy to use and incredibly versatile. Whether you're performing basic single port checks or diving into advanced subnet scans and real-time monitoring, SnakeScan has you covered.
|
|
35
|
-
|
|
36
|
-
## 🌟 Key Features:
|
|
37
|
-
|
|
38
|
-
* **Unmatched Flexibility:** Scan single ports, defined ranges, or pre-configured sets with ease.
|
|
39
|
-
|
|
40
|
-
* **Blazing Fast Multithreading:** Leverage multithreading for significantly faster scanning speeds.
|
|
41
|
-
|
|
42
|
-
* **Get the Details:** Retrieve valuable information about IP addresses (supports both IPv4 and IPv6).
|
|
43
|
-
|
|
44
|
-
* **Real-time Monitoring with Watcher:** Keep a constant eye on critical ports and their statuses.
|
|
45
|
-
|
|
46
|
-
* **Intuitive Design:** Clean and simple command-line parameters and API for effortless use.
|
|
47
|
-
|
|
48
|
-
## ⬇️ Installation:
|
|
49
|
-
|
|
50
|
-
Get started with SnakeScan in seconds!
|
|
51
|
-
|
|
52
|
-
bash
|
|
53
|
-
|
|
54
|
-
pip install SnakeScan
|
|
55
|
-
|
|
56
|
-
## ⚙️ Command Line Usage: Unleash the Power!
|
|
57
|
-
|
|
58
|
-
### 💡 Mastering Attribute Usage:
|
|
59
|
-
|
|
60
|
-
* **-p**: Specify ports to scan (single or ranges). **Important:** When specifying ranges, the beginning of the range is only included from the second time. For example, to scan from 80 to 443, use `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
61
|
-
|
|
62
|
-
* **-h**: Display a complete list of available attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
63
|
-
|
|
64
|
-
* **-sp**: Use a predefined set of common ports for scanning with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
65
|
-
|
|
66
|
-
* **-v**: Show the current version of the SnakeScan library. Example: `snake -v`
|
|
67
|
-
|
|
68
|
-
* **-gs**: Retrieve the SSL/TLS certificate from a specified website. Example: `snake www.google.com -gs` (Without specifying a host, you’ll encounter a connection error).
|
|
69
|
-
|
|
70
|
-
* **-t**: Enable multithreading to speed up your port scans. Example: `snake -t`
|
|
71
|
-
|
|
72
|
-
* **-ch**: Scan a subnet to discover other IP addresses on the network. Example: `snake -ch`
|
|
73
|
-
|
|
74
|
-
* **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
|
|
75
|
-
|
|
76
|
-
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
77
|
-
|
|
78
|
-
## 💻 Python Code Integration:
|
|
79
|
-
|
|
80
|
-
### ⏱️ Watcher: The Real-Time Port Sentinel!
|
|
81
|
-
|
|
82
|
-
`Watcher` allows you to continuously monitor the status of a designated port.
|
|
83
|
-
|
|
84
|
-
python
|
|
85
|
-
|
|
86
|
-
from SnakeScan import Watcher
|
|
87
|
-
|
|
88
|
-
watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
|
|
89
|
-
|
|
90
|
-
watcher.start() # Begin monitoring!
|
|
91
|
-
|
|
92
|
-
#### `Watcher` Command Set:
|
|
93
|
-
|
|
94
|
-
* `Watcher.start()` - Starts the port monitoring process.
|
|
95
|
-
|
|
96
|
-
* `Watcher.stop()` - Halts the port monitoring process.
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
**Latest Update:** 1.7.5 (Enhanced port designations for even clearer understanding)
|
|
101
|
-
|
|
102
|
-
|
snakescan-1.7.5/README.md
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
|
|
3
|
-
This documentation was created with the assistance of the GeekBot language model and Den*Ram
|
|
4
|
-
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
|
-
# 🐍 SnakeScan: Your Go-To Python Port Scanner
|
|
8
|
-
|
|
9
|
-
✨ A powerful and flexible Python library for all your port scanning needs. ✨
|
|
10
|
-
|
|
11
|
-
[](https://pypi.org/project/SnakeScan/)
|
|
12
|
-
|
|
13
|
-
[](https://opensource.org/licenses/MIT)
|
|
14
|
-
|
|
15
|
-
[](https://www.python.org/)
|
|
16
|
-
|
|
17
|
-
[](https://github.com/yourusername/SnakeScan/releases) <!-- Replace yourusername with yours -->
|
|
18
|
-
|
|
19
|
-
[](https://www.python.org/)
|
|
20
|
-
|
|
21
|
-
**SnakeScan** is designed to be both easy to use and incredibly versatile. Whether you're performing basic single port checks or diving into advanced subnet scans and real-time monitoring, SnakeScan has you covered.
|
|
22
|
-
|
|
23
|
-
## 🌟 Key Features:
|
|
24
|
-
|
|
25
|
-
* **Unmatched Flexibility:** Scan single ports, defined ranges, or pre-configured sets with ease.
|
|
26
|
-
|
|
27
|
-
* **Blazing Fast Multithreading:** Leverage multithreading for significantly faster scanning speeds.
|
|
28
|
-
|
|
29
|
-
* **Get the Details:** Retrieve valuable information about IP addresses (supports both IPv4 and IPv6).
|
|
30
|
-
|
|
31
|
-
* **Real-time Monitoring with Watcher:** Keep a constant eye on critical ports and their statuses.
|
|
32
|
-
|
|
33
|
-
* **Intuitive Design:** Clean and simple command-line parameters and API for effortless use.
|
|
34
|
-
|
|
35
|
-
## ⬇️ Installation:
|
|
36
|
-
|
|
37
|
-
Get started with SnakeScan in seconds!
|
|
38
|
-
|
|
39
|
-
bash
|
|
40
|
-
|
|
41
|
-
pip install SnakeScan
|
|
42
|
-
|
|
43
|
-
## ⚙️ Command Line Usage: Unleash the Power!
|
|
44
|
-
|
|
45
|
-
### 💡 Mastering Attribute Usage:
|
|
46
|
-
|
|
47
|
-
* **-p**: Specify ports to scan (single or ranges). **Important:** When specifying ranges, the beginning of the range is only included from the second time. For example, to scan from 80 to 443, use `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
48
|
-
|
|
49
|
-
* **-h**: Display a complete list of available attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
50
|
-
|
|
51
|
-
* **-sp**: Use a predefined set of common ports for scanning with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
52
|
-
|
|
53
|
-
* **-v**: Show the current version of the SnakeScan library. Example: `snake -v`
|
|
54
|
-
|
|
55
|
-
* **-gs**: Retrieve the SSL/TLS certificate from a specified website. Example: `snake www.google.com -gs` (Without specifying a host, you’ll encounter a connection error).
|
|
56
|
-
|
|
57
|
-
* **-t**: Enable multithreading to speed up your port scans. Example: `snake -t`
|
|
58
|
-
|
|
59
|
-
* **-ch**: Scan a subnet to discover other IP addresses on the network. Example: `snake -ch`
|
|
60
|
-
|
|
61
|
-
* **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
|
|
62
|
-
|
|
63
|
-
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
64
|
-
|
|
65
|
-
## 💻 Python Code Integration:
|
|
66
|
-
|
|
67
|
-
### ⏱️ Watcher: The Real-Time Port Sentinel!
|
|
68
|
-
|
|
69
|
-
`Watcher` allows you to continuously monitor the status of a designated port.
|
|
70
|
-
|
|
71
|
-
python
|
|
72
|
-
|
|
73
|
-
from SnakeScan import Watcher
|
|
74
|
-
|
|
75
|
-
watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
|
|
76
|
-
|
|
77
|
-
watcher.start() # Begin monitoring!
|
|
78
|
-
|
|
79
|
-
#### `Watcher` Command Set:
|
|
80
|
-
|
|
81
|
-
* `Watcher.start()` - Starts the port monitoring process.
|
|
82
|
-
|
|
83
|
-
* `Watcher.stop()` - Halts the port monitoring process.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
**Latest Update:** 1.7.5 (Enhanced port designations for even clearer understanding)
|
|
88
|
-
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import socket
|
|
2
|
-
from termcolor import colored
|
|
3
|
-
from concurrent.futures import ProcessPoolExecutor
|
|
4
|
-
|
|
5
|
-
ports = {
|
|
6
|
-
20: "FTP-Data",
|
|
7
|
-
21: "FTP-Control",
|
|
8
|
-
22: "SSH",
|
|
9
|
-
23: "Telnet",
|
|
10
|
-
24: "Priv-mail",
|
|
11
|
-
25: "SMTP",
|
|
12
|
-
29: "MSG-ICP",
|
|
13
|
-
31: "MSG-AUTH",
|
|
14
|
-
33: "DSP",
|
|
15
|
-
35: "Priv-print",
|
|
16
|
-
41: "Graphics",
|
|
17
|
-
42: "WINS",
|
|
18
|
-
43: "Whois",
|
|
19
|
-
48: "AUDITD",
|
|
20
|
-
57: "Priv-term",
|
|
21
|
-
59: "Priv-file",
|
|
22
|
-
63: "WHOISPP",
|
|
23
|
-
66: "SQL-NET",
|
|
24
|
-
75: "Priv-dial",
|
|
25
|
-
80: "HTTP",
|
|
26
|
-
109: "POP2",
|
|
27
|
-
110: "POP3",
|
|
28
|
-
113: "ident",
|
|
29
|
-
115: "SFTP",
|
|
30
|
-
118: "SQLServ",
|
|
31
|
-
119: "NNTP",
|
|
32
|
-
139: "NetBIOS-SSN",
|
|
33
|
-
143: "IMAP",
|
|
34
|
-
179: "BGP",
|
|
35
|
-
194: "IRC",
|
|
36
|
-
199: "SMUX",
|
|
37
|
-
200: "SRC",
|
|
38
|
-
220: "IMAP3",
|
|
39
|
-
311: "ASIP-WEBADMIN",
|
|
40
|
-
344: "PDAP",
|
|
41
|
-
345: "PAWSERV",
|
|
42
|
-
346: "ZSERV",
|
|
43
|
-
347: "FATSERV",
|
|
44
|
-
401: "UPS",
|
|
45
|
-
413: "SMSP",
|
|
46
|
-
427: "SVRLOC",
|
|
47
|
-
443: "HTTPS",
|
|
48
|
-
444: "SNPP",
|
|
49
|
-
606: "URM",
|
|
50
|
-
607: "NQS",
|
|
51
|
-
631: "IPP",
|
|
52
|
-
636: "LDAPS",
|
|
53
|
-
639: "MSDP",
|
|
54
|
-
646: "LDP",
|
|
55
|
-
647: "DHCP-FAILOVER",
|
|
56
|
-
648: "RRP",
|
|
57
|
-
753: "RRH",
|
|
58
|
-
830: "NETCONF-SSH",
|
|
59
|
-
831: "NETCONF-BEEP",
|
|
60
|
-
832: "NETCONFSOAPHTTP",
|
|
61
|
-
833: "NETCONFSOAPBEEP",
|
|
62
|
-
861: "OWAMP-CONTROL",
|
|
63
|
-
862: "TWAPM-CONTROL",
|
|
64
|
-
873: "RSYNC",
|
|
65
|
-
989: "FTPS-DATA",
|
|
66
|
-
990: "FTPS",
|
|
67
|
-
995: "POP3S",
|
|
68
|
-
1038: "MTQP",
|
|
69
|
-
1080: "SOCKS",
|
|
70
|
-
1194: "OpenVPN",
|
|
71
|
-
1433: "SQL server",
|
|
72
|
-
1723: "PPTP",
|
|
73
|
-
2222: "SSH",
|
|
74
|
-
3128: "HTTP",
|
|
75
|
-
3268: "LDAP",
|
|
76
|
-
3306: "MySQL",
|
|
77
|
-
3389: "RDP",
|
|
78
|
-
3455: "RSVP",
|
|
79
|
-
3632: "Distributed compiler",
|
|
80
|
-
3689: "DAAP",
|
|
81
|
-
5432: "PostgreSQL",
|
|
82
|
-
5900: "VNC",
|
|
83
|
-
8000: "HTTP",
|
|
84
|
-
8080: "HTTP",
|
|
85
|
-
8443: "HTTPS",
|
|
86
|
-
8888: "HTTP",
|
|
87
|
-
10000: "Webmin",
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def is_port_open_threads(host, port):
|
|
92
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
93
|
-
try:
|
|
94
|
-
s.settimeout(1)
|
|
95
|
-
s.connect((host, port))
|
|
96
|
-
except (OSError, socket.timeout):
|
|
97
|
-
try:
|
|
98
|
-
print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
|
|
99
|
-
except:
|
|
100
|
-
print(f"Closed{colored('|X|','red')}-->|{port}|")
|
|
101
|
-
else:
|
|
102
|
-
print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def PoolProcessExecutor(host):
|
|
106
|
-
with ProcessPoolExecutor(max_workers=None) as executor:
|
|
107
|
-
try:
|
|
108
|
-
for port in ports.keys():
|
|
109
|
-
future = executor.submit(is_port_open_threads, host, port)
|
|
110
|
-
|
|
111
|
-
except Exception as e:
|
|
112
|
-
print(e)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|