SnakeScan 1.8.6__tar.gz → 1.8.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.8.7/PKG-INFO +155 -0
- snakescan-1.8.7/README.md +141 -0
- {snakescan-1.8.6 → snakescan-1.8.7}/SnakeScan/CLI.py +32 -8
- {snakescan-1.8.6 → snakescan-1.8.7}/SnakeScan/__init__.py +1 -1
- snakescan-1.8.6/PKG-INFO +0 -141
- snakescan-1.8.6/README.md +0 -128
- snakescan-1.8.6/SnakeScan/config.ini +0 -3
- {snakescan-1.8.6 → snakescan-1.8.7}/LICENSE +0 -0
- {snakescan-1.8.6 → snakescan-1.8.7}/SnakeScan/Check_subnet.py +0 -0
- {snakescan-1.8.6 → snakescan-1.8.7}/SnakeScan/Get_ssl.py +0 -0
- {snakescan-1.8.6 → snakescan-1.8.7}/SnakeScan/PoolExecutor.py +0 -0
- {snakescan-1.8.6 → snakescan-1.8.7}/SnakeScan/Pool_UDP_Executor.py +0 -0
- {snakescan-1.8.6 → snakescan-1.8.7}/pyproject.toml +0 -0
snakescan-1.8.7/PKG-INFO
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SnakeScan
|
|
3
|
+
Version: 1.8.7
|
|
4
|
+
Summary: Unlock the potential of your network with this powerful IPv4 address scanner. Easily scan IP address ranges, identify active hosts, and even extract IPv4 addresses from IPv6 environments. Enhance your network monitoring, troubleshooting, and security analysis!
|
|
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
|
+
This documentation was created with GeekBot Language Model and Den*Ram
|
|
16
|
+
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
# 🐍 SnakeScan: A Reliable Python Port Scanner
|
|
20
|
+
|
|
21
|
+
A versatile and efficient Python library designed for comprehensive network port scanning.
|
|
22
|
+
|
|
23
|
+
[](https://pypi.org/project/SnakeScan/)
|
|
24
|
+
|
|
25
|
+
[](https://opensource.org/licenses/MIT)
|
|
26
|
+
|
|
27
|
+
[](https://www.python.org/)
|
|
28
|
+
|
|
29
|
+
[](https://img.shields.io/badge/Status-Stable-green)
|
|
30
|
+
|
|
31
|
+
**SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers who need reliable port scanning capabilities. From simple port checks to advanced, multi-threaded subnet analysis, SnakeScan provides the tools necessary for effective network assessment.
|
|
32
|
+
|
|
33
|
+
## ⚙️ Key Features:
|
|
34
|
+
|
|
35
|
+
* **Flexible Port Specification:** Define target ports as individual values, ranges, or through preconfigured sets.
|
|
36
|
+
|
|
37
|
+
* **Multi-Threaded Architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
|
|
38
|
+
|
|
39
|
+
* **IP Address Information Retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
|
|
40
|
+
|
|
41
|
+
* **Real-Time Port Monitoring:** Utilize the `Watcher` class for continuous monitoring of the status of critical ports.
|
|
42
|
+
|
|
43
|
+
* **Concise Command-Line Interface and API:** Easily integrate SnakeScan into workflows via command-line or programmatic access.
|
|
44
|
+
|
|
45
|
+
* **UDP Port Scanning:** Built-in support for scanning UDP ports.
|
|
46
|
+
|
|
47
|
+
* **Customizable Port Dictionaries:** Add your own port descriptions from JSON files and easily revert to the default set.
|
|
48
|
+
|
|
49
|
+
* **Automatic Home Directory Detection:** Uses `pathlib` to automatically detect the user's home directory, storing configuration files in a dedicated folder. **All configuration files are now located in this dedicated directory, ensuring that changes to SnakeScan's configuration do not affect the installed library files. This provides a secure and resilient setup.**
|
|
50
|
+
|
|
51
|
+
## ⬇️ Installation:
|
|
52
|
+
|
|
53
|
+
**It is strongly recommended to install this specific version of SnakeScan (1.8.7) as it includes significant enhancements and bug fixes that improve reliability and operational stability. The updates are aimed at ensuring optimal performance and eliminating issues encountered in previous versions.**
|
|
54
|
+
|
|
55
|
+
**Installation via pip (recommended):**
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
bash
|
|
60
|
+
|
|
61
|
+
pip install SnakeScan
|
|
62
|
+
|
|
63
|
+
**Alternative Installation from Source Code Archive:**
|
|
64
|
+
|
|
65
|
+
SnakeScan is distributed with open source code. This means you can download the code archive, examine it, make necessary changes, and fix any errors that occur during use.
|
|
66
|
+
|
|
67
|
+
**Note:** Installing from the archive requires the **Flit** package to be installed. After downloading the archive, you need to unpack it and navigate to the directory containing the unpacked files. The command to unpack the archive depends on the archive format and the operating system being used.
|
|
68
|
+
|
|
69
|
+
bash
|
|
70
|
+
|
|
71
|
+
pip install flit
|
|
72
|
+
|
|
73
|
+
cd [directory where the archive was unpacked]
|
|
74
|
+
|
|
75
|
+
flit install
|
|
76
|
+
|
|
77
|
+
## ⌨️ Command Line Usage:
|
|
78
|
+
|
|
79
|
+
### 💡 Attribute Reference:
|
|
80
|
+
|
|
81
|
+
* **-p**: Specify target ports to scan (single port or range). Note: Range excludes the lower bound in the first entry. For example: To scan from port 80 through 443, specify the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
82
|
+
|
|
83
|
+
* **-u**: Enable scanning of UDP ports. Example: `snake -p 53 -u`
|
|
84
|
+
|
|
85
|
+
* **-h**: Show the full list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
86
|
+
|
|
87
|
+
* **-sp**: Initiate a scan using a predefined common port set with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
88
|
+
|
|
89
|
+
* **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
|
|
90
|
+
|
|
91
|
+
* **-gs**: Retrieve an SSL/TLS certificate from a specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
|
|
92
|
+
|
|
93
|
+
* **-t**: Enable multithreading for improved scanning performance. Example: `snake -t`
|
|
94
|
+
|
|
95
|
+
* **-ch**: Scan the subnet for active IP addresses within the network. Example: `snake -ch`
|
|
96
|
+
|
|
97
|
+
* **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
|
|
98
|
+
|
|
99
|
+
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
100
|
+
|
|
101
|
+
* **-d**: Specify the path to a JSON file containing TCP port definitions and optionally, a second JSON file containing UDP port definitions. **Note:** Upon the first use of this argument, the paths to the JSON files must be provided with each command execution and separated by a comma. After the initial use, SnakeScan can remember these paths for subsequent scans.
|
|
102
|
+
|
|
103
|
+
Example: `snake -d /path/to/tcp_ports.json,/path/to/udp_ports.json` (if you want to specify both TCP and UDP, if only TCP: `snake -d /path/to/tcp_ports.json`)
|
|
104
|
+
|
|
105
|
+
**Subsequent Use**: After the initial setup, you can simply use the `-d` flag without the file paths, and SnakeScan can utilize the previously defined JSON files.
|
|
106
|
+
|
|
107
|
+
Example (after initial setup): `snake -d` (may use previously stored paths)
|
|
108
|
+
|
|
109
|
+
**JSON File Format:** The JSON file should be formatted as a dictionary where the keys are port numbers (as strings), and the values are the corresponding service names or descriptions.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
|
|
115
|
+
"53": "DNS",
|
|
116
|
+
|
|
117
|
+
"80": "HTTP",
|
|
118
|
+
|
|
119
|
+
"443": "HTTPS"
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
* **-dr**: Reset custom port dictionaries to their default state and revert to standard SnakeScan port definitions. Example: `snake -dr`
|
|
126
|
+
|
|
127
|
+
* **-ds**: Display the paths to the currently used custom port dictionaries (TCP and UDP). This is useful for verifying which custom definitions are loaded. Example: `snake -ds`
|
|
128
|
+
|
|
129
|
+
* **-home --homedir**: Display the user's home directory and the location of the `config.ini` file. The home directory is determined automatically using the `pathlib` library. Example: `snake -home`, `snake --homedir`
|
|
130
|
+
|
|
131
|
+
## 💻 Python Code Integration:
|
|
132
|
+
|
|
133
|
+
### ⏱️ Watcher Class: Real-Time Port Status
|
|
134
|
+
|
|
135
|
+
The `Watcher` class allows you to continuously monitor a specified port.
|
|
136
|
+
|
|
137
|
+
python
|
|
138
|
+
|
|
139
|
+
from SnakeScan import Watcher
|
|
140
|
+
|
|
141
|
+
watcher = Watcher("localhost", 53, 2) # Host, Port, Check Interval (in seconds)
|
|
142
|
+
|
|
143
|
+
watcher.start() # Start monitoring!
|
|
144
|
+
|
|
145
|
+
#### `Watcher` Methods:
|
|
146
|
+
|
|
147
|
+
* `Watcher.start()` - Start the port monitoring process.
|
|
148
|
+
|
|
149
|
+
* `Watcher.stop()` - Terminate the port monitoring process.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
**Last Updated:** 1.8.7 (Automatic Home Directory Detection, Added `-home` and `--homedir` arguments. All config files are stored outside the installed library for permanent and secure customization.)
|
|
154
|
+
|
|
155
|
+
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
This documentation was created with GeekBot Language Model and Den*Ram
|
|
3
|
+
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# 🐍 SnakeScan: A Reliable Python Port Scanner
|
|
7
|
+
|
|
8
|
+
A versatile and efficient Python library designed for comprehensive network port scanning.
|
|
9
|
+
|
|
10
|
+
[](https://pypi.org/project/SnakeScan/)
|
|
11
|
+
|
|
12
|
+
[](https://opensource.org/licenses/MIT)
|
|
13
|
+
|
|
14
|
+
[](https://www.python.org/)
|
|
15
|
+
|
|
16
|
+
[](https://img.shields.io/badge/Status-Stable-green)
|
|
17
|
+
|
|
18
|
+
**SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers who need reliable port scanning capabilities. From simple port checks to advanced, multi-threaded subnet analysis, SnakeScan provides the tools necessary for effective network assessment.
|
|
19
|
+
|
|
20
|
+
## ⚙️ Key Features:
|
|
21
|
+
|
|
22
|
+
* **Flexible Port Specification:** Define target ports as individual values, ranges, or through preconfigured sets.
|
|
23
|
+
|
|
24
|
+
* **Multi-Threaded Architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
|
|
25
|
+
|
|
26
|
+
* **IP Address Information Retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
|
|
27
|
+
|
|
28
|
+
* **Real-Time Port Monitoring:** Utilize the `Watcher` class for continuous monitoring of the status of critical ports.
|
|
29
|
+
|
|
30
|
+
* **Concise Command-Line Interface and API:** Easily integrate SnakeScan into workflows via command-line or programmatic access.
|
|
31
|
+
|
|
32
|
+
* **UDP Port Scanning:** Built-in support for scanning UDP ports.
|
|
33
|
+
|
|
34
|
+
* **Customizable Port Dictionaries:** Add your own port descriptions from JSON files and easily revert to the default set.
|
|
35
|
+
|
|
36
|
+
* **Automatic Home Directory Detection:** Uses `pathlib` to automatically detect the user's home directory, storing configuration files in a dedicated folder. **All configuration files are now located in this dedicated directory, ensuring that changes to SnakeScan's configuration do not affect the installed library files. This provides a secure and resilient setup.**
|
|
37
|
+
|
|
38
|
+
## ⬇️ Installation:
|
|
39
|
+
|
|
40
|
+
**It is strongly recommended to install this specific version of SnakeScan (1.8.7) as it includes significant enhancements and bug fixes that improve reliability and operational stability. The updates are aimed at ensuring optimal performance and eliminating issues encountered in previous versions.**
|
|
41
|
+
|
|
42
|
+
**Installation via pip (recommended):**
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
bash
|
|
47
|
+
|
|
48
|
+
pip install SnakeScan
|
|
49
|
+
|
|
50
|
+
**Alternative Installation from Source Code Archive:**
|
|
51
|
+
|
|
52
|
+
SnakeScan is distributed with open source code. This means you can download the code archive, examine it, make necessary changes, and fix any errors that occur during use.
|
|
53
|
+
|
|
54
|
+
**Note:** Installing from the archive requires the **Flit** package to be installed. After downloading the archive, you need to unpack it and navigate to the directory containing the unpacked files. The command to unpack the archive depends on the archive format and the operating system being used.
|
|
55
|
+
|
|
56
|
+
bash
|
|
57
|
+
|
|
58
|
+
pip install flit
|
|
59
|
+
|
|
60
|
+
cd [directory where the archive was unpacked]
|
|
61
|
+
|
|
62
|
+
flit install
|
|
63
|
+
|
|
64
|
+
## ⌨️ Command Line Usage:
|
|
65
|
+
|
|
66
|
+
### 💡 Attribute Reference:
|
|
67
|
+
|
|
68
|
+
* **-p**: Specify target ports to scan (single port or range). Note: Range excludes the lower bound in the first entry. For example: To scan from port 80 through 443, specify the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
69
|
+
|
|
70
|
+
* **-u**: Enable scanning of UDP ports. Example: `snake -p 53 -u`
|
|
71
|
+
|
|
72
|
+
* **-h**: Show the full list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
73
|
+
|
|
74
|
+
* **-sp**: Initiate a scan using a predefined common port set with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
75
|
+
|
|
76
|
+
* **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
|
|
77
|
+
|
|
78
|
+
* **-gs**: Retrieve an SSL/TLS certificate from a specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
|
|
79
|
+
|
|
80
|
+
* **-t**: Enable multithreading for improved scanning performance. Example: `snake -t`
|
|
81
|
+
|
|
82
|
+
* **-ch**: Scan the subnet for active IP addresses within the network. Example: `snake -ch`
|
|
83
|
+
|
|
84
|
+
* **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
|
|
85
|
+
|
|
86
|
+
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
87
|
+
|
|
88
|
+
* **-d**: Specify the path to a JSON file containing TCP port definitions and optionally, a second JSON file containing UDP port definitions. **Note:** Upon the first use of this argument, the paths to the JSON files must be provided with each command execution and separated by a comma. After the initial use, SnakeScan can remember these paths for subsequent scans.
|
|
89
|
+
|
|
90
|
+
Example: `snake -d /path/to/tcp_ports.json,/path/to/udp_ports.json` (if you want to specify both TCP and UDP, if only TCP: `snake -d /path/to/tcp_ports.json`)
|
|
91
|
+
|
|
92
|
+
**Subsequent Use**: After the initial setup, you can simply use the `-d` flag without the file paths, and SnakeScan can utilize the previously defined JSON files.
|
|
93
|
+
|
|
94
|
+
Example (after initial setup): `snake -d` (may use previously stored paths)
|
|
95
|
+
|
|
96
|
+
**JSON File Format:** The JSON file should be formatted as a dictionary where the keys are port numbers (as strings), and the values are the corresponding service names or descriptions.
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
|
|
102
|
+
"53": "DNS",
|
|
103
|
+
|
|
104
|
+
"80": "HTTP",
|
|
105
|
+
|
|
106
|
+
"443": "HTTPS"
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
* **-dr**: Reset custom port dictionaries to their default state and revert to standard SnakeScan port definitions. Example: `snake -dr`
|
|
113
|
+
|
|
114
|
+
* **-ds**: Display the paths to the currently used custom port dictionaries (TCP and UDP). This is useful for verifying which custom definitions are loaded. Example: `snake -ds`
|
|
115
|
+
|
|
116
|
+
* **-home --homedir**: Display the user's home directory and the location of the `config.ini` file. The home directory is determined automatically using the `pathlib` library. Example: `snake -home`, `snake --homedir`
|
|
117
|
+
|
|
118
|
+
## 💻 Python Code Integration:
|
|
119
|
+
|
|
120
|
+
### ⏱️ Watcher Class: Real-Time Port Status
|
|
121
|
+
|
|
122
|
+
The `Watcher` class allows you to continuously monitor a specified port.
|
|
123
|
+
|
|
124
|
+
python
|
|
125
|
+
|
|
126
|
+
from SnakeScan import Watcher
|
|
127
|
+
|
|
128
|
+
watcher = Watcher("localhost", 53, 2) # Host, Port, Check Interval (in seconds)
|
|
129
|
+
|
|
130
|
+
watcher.start() # Start monitoring!
|
|
131
|
+
|
|
132
|
+
#### `Watcher` Methods:
|
|
133
|
+
|
|
134
|
+
* `Watcher.start()` - Start the port monitoring process.
|
|
135
|
+
|
|
136
|
+
* `Watcher.stop()` - Terminate the port monitoring process.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
**Last Updated:** 1.8.7 (Automatic Home Directory Detection, Added `-home` and `--homedir` arguments. All config files are stored outside the installed library for permanent and secure customization.)
|
|
141
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import configparser
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
import json
|
|
4
5
|
import sys
|
|
5
6
|
import string
|
|
@@ -80,12 +81,23 @@ ports = {
|
|
|
80
81
|
def Load_config(ports):
|
|
81
82
|
try:
|
|
82
83
|
config = configparser.ConfigParser()
|
|
83
|
-
package_dir =
|
|
84
|
+
package_dir = Path.home() / "SnakeScan"
|
|
84
85
|
|
|
85
|
-
config_path =
|
|
86
|
+
config_path = package_dir / "config.ini"
|
|
86
87
|
|
|
87
88
|
config.read(config_path)
|
|
88
|
-
|
|
89
|
+
if package_dir.exists() and config_path.is_file():
|
|
90
|
+
pass
|
|
91
|
+
else:
|
|
92
|
+
try:
|
|
93
|
+
package_dir.mkdir(parents=True, exist_ok=True)
|
|
94
|
+
config = configparser.ConfigParser()
|
|
95
|
+
config["Settings"] = {"path_tcp": "", "path_udp": ""}
|
|
96
|
+
with open(config_path, "w") as configfile:
|
|
97
|
+
config.write(configfile)
|
|
98
|
+
except Exception as e:
|
|
99
|
+
print(e)
|
|
100
|
+
sys.exit()
|
|
89
101
|
if "Settings" in config and ports in config["Settings"]:
|
|
90
102
|
return config["Settings"][ports]
|
|
91
103
|
except Exception as e:
|
|
@@ -112,9 +124,9 @@ def Save_config(path_tcp, path_udp):
|
|
|
112
124
|
path_udp = ""
|
|
113
125
|
try:
|
|
114
126
|
config = configparser.ConfigParser()
|
|
115
|
-
package_dir =
|
|
127
|
+
package_dir = Path.home() / "SnakeScan"
|
|
116
128
|
|
|
117
|
-
config_path =
|
|
129
|
+
config_path = package_dir / "config.ini"
|
|
118
130
|
config["Settings"] = {"path_tcp": path_tcp, "path_udp": path_udp}
|
|
119
131
|
with open(config_path, "w") as configfile:
|
|
120
132
|
config.write(configfile)
|
|
@@ -171,7 +183,7 @@ else:
|
|
|
171
183
|
if __name__ == "__main__":
|
|
172
184
|
main()
|
|
173
185
|
|
|
174
|
-
version = "1.8.
|
|
186
|
+
version = "1.8.7"
|
|
175
187
|
|
|
176
188
|
|
|
177
189
|
def is_port_open(host, port):
|
|
@@ -235,6 +247,12 @@ def SnakeArgs():
|
|
|
235
247
|
description="SnakeScan - It's a command line library for scan and get information about ip."
|
|
236
248
|
)
|
|
237
249
|
parser.add_argument("host", nargs="?", default="None")
|
|
250
|
+
parser.add_argument(
|
|
251
|
+
"-home",
|
|
252
|
+
"--homedir",
|
|
253
|
+
action="store_true",
|
|
254
|
+
help="Show path to SnakeScan home directory",
|
|
255
|
+
)
|
|
238
256
|
parser.add_argument(
|
|
239
257
|
"-d",
|
|
240
258
|
"--dictonary",
|
|
@@ -481,8 +499,8 @@ else:
|
|
|
481
499
|
if SnakeArgs().dictremove:
|
|
482
500
|
try:
|
|
483
501
|
config = configparser.ConfigParser()
|
|
484
|
-
package_dir =
|
|
485
|
-
config_path =
|
|
502
|
+
package_dir = Path.home() / "SnakeScan"
|
|
503
|
+
config_path = package_dir / "config.ini"
|
|
486
504
|
config["Settings"] = {"path_tcp": "", "path_udp": ""}
|
|
487
505
|
with open(config_path, "w") as configfile:
|
|
488
506
|
config.write(configfile)
|
|
@@ -665,6 +683,12 @@ if SnakeArgs().version:
|
|
|
665
683
|
print("|Version|".center(60, "—"))
|
|
666
684
|
print(f"SnakeScan_Build_{version}")
|
|
667
685
|
print("".center(60, "—"))
|
|
686
|
+
if SnakeArgs().homedir:
|
|
687
|
+
try:
|
|
688
|
+
home = Path.home() / "SnakeScan"
|
|
689
|
+
print(f"SnakeScan home directory: {home}")
|
|
690
|
+
except Exception as e:
|
|
691
|
+
print(e)
|
|
668
692
|
|
|
669
693
|
if SnakeArgs().speed:
|
|
670
694
|
if SnakeArgs().udp:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Unlock the potential of your network with this powerful IPv4 address scanner. Easily scan IP address ranges, identify active hosts, and even extract IPv4 addresses from IPv6 environments. Enhance your network monitoring, troubleshooting, and security analysis!"""
|
|
2
2
|
|
|
3
|
-
__version__ = "1.8.
|
|
3
|
+
__version__ = "1.8.7"
|
|
4
4
|
import socket
|
|
5
5
|
from time import sleep
|
|
6
6
|
from termcolor import colored
|
snakescan-1.8.6/PKG-INFO
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: SnakeScan
|
|
3
|
-
Version: 1.8.6
|
|
4
|
-
Summary: Unlock the potential of your network with this powerful IPv4 address scanner. Easily scan IP address ranges, identify active hosts, and even extract IPv4 addresses from IPv6 environments. Enhance your network monitoring, troubleshooting, and security analysis!
|
|
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
|
-
This documentation was created with the assistance of the GeekBot language model and Den*Ram
|
|
16
|
-
-->
|
|
17
|
-
# 🐍 SnakeScan: Reliable Port Scanner in Python
|
|
18
|
-
|
|
19
|
-
A versatile and efficient Python library designed for comprehensive network port scanning.
|
|
20
|
-
|
|
21
|
-
[](https://pypi.org/project/SnakeScan/)
|
|
22
|
-
|
|
23
|
-
[](https://opensource.org/licenses/MIT)
|
|
24
|
-
|
|
25
|
-
[](https://www.python.org/)
|
|
26
|
-
|
|
27
|
-
[](https://img.shields.io/badge/Status-Stable-green)
|
|
28
|
-
|
|
29
|
-
**SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers who need robust port scanning capabilities. From basic port checking to advanced, multi-threaded subnet analysis, SnakeScan provides the tools you need for effective network assessment.
|
|
30
|
-
|
|
31
|
-
**Important Note:** *The following documentation describes potential features that are **partially implemented** in SnakeScan. Functionality related to custom port dictionaries is available, but has **narrowly specialized** implementations in its current state. Descriptions here are intended to demonstrate a more complete implementation and **may not fully match the library's current narrowly specialized capabilities**.*
|
|
32
|
-
|
|
33
|
-
## ⚙️ Key features:
|
|
34
|
-
|
|
35
|
-
* **Flexible port specification:** Define target ports as individual values, ranges, or via pre-configured sets.
|
|
36
|
-
|
|
37
|
-
* **Multi-threaded architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
|
|
38
|
-
|
|
39
|
-
* **IP address information retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
|
|
40
|
-
|
|
41
|
-
* **Real-time port monitoring:** Use the `Watcher` class to continuously monitor the status of important ports.
|
|
42
|
-
|
|
43
|
-
* **Concise command-line interface and API:** Easily integrate SnakeScan into workflows via command-line or programmatic access.
|
|
44
|
-
|
|
45
|
-
* **UDP port scanning:** Built-in support for scanning UDP ports.
|
|
46
|
-
|
|
47
|
-
* **Customizable port dictionaries:** Add your own port descriptions from JSON files and easily revert to the default set. *(Functionality is present, has narrowly specialized implementations. See details below).*
|
|
48
|
-
|
|
49
|
-
## ⬇️ Installation:
|
|
50
|
-
|
|
51
|
-
Install SnakeScan using pip:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
bash
|
|
56
|
-
|
|
57
|
-
pip install SnakeScan
|
|
58
|
-
|
|
59
|
-
## ⌨️ Command-line usage:
|
|
60
|
-
|
|
61
|
-
### 💡 Attribute reference:
|
|
62
|
-
|
|
63
|
-
* **-p**: Specify target ports to scan (single port or range). Note: Range excludes the lower bound in the first entry. For example: To scan from port 80 to 443 specify the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
64
|
-
|
|
65
|
-
* **-u**: Enable UDP port scanning. Example: `snake -p 53 -u`
|
|
66
|
-
|
|
67
|
-
* **-h**: Show the full list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
68
|
-
|
|
69
|
-
* **-sp**: Start scanning using the predefined common port set with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
70
|
-
|
|
71
|
-
* **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
|
|
72
|
-
|
|
73
|
-
* **-gs**: Retrieve the SSL/TLS certificate from the specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
|
|
74
|
-
|
|
75
|
-
* **-t**: Enable multi-threading to improve scanning performance. Example: `snake -t`
|
|
76
|
-
|
|
77
|
-
* **-ch**: Scan a subnet to discover active IP addresses on the network. Example: `snake -ch`
|
|
78
|
-
|
|
79
|
-
* **-l**: Display your public IP address (requires active internet connection). Example: `snake -l`
|
|
80
|
-
|
|
81
|
-
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
82
|
-
|
|
83
|
-
* **-d**: Specify the path to a JSON file containing TCP port definitions, and optionally a path to a second JSON file containing UDP port definitions. **Note:** When using this argument *for the first* time, the paths to the JSON files must be specified with each command execution, separated by a comma. After the first use, SnakeScan *may* remember these paths for subsequent scans. Functionality is present, has narrowly specialized implementations. See details below.
|
|
84
|
-
|
|
85
|
-
Example: `snake -d /путь/к/tcp_ports.json,/путь/к/udp_ports.json` (if you want to specify both TCP and UDP, if TCP only: `snake -d /путь/к/tcp_ports.json`)
|
|
86
|
-
|
|
87
|
-
**Subsequent Use**: After initial use, you can simply use the `-d` flag *without* file paths and SnakeScan *may* use previously defined JSON files. Functionality is present, has narrowly specialized implementations. See details below.
|
|
88
|
-
|
|
89
|
-
Example (after initial setup): `snake -d` (may use previously saved paths)
|
|
90
|
-
|
|
91
|
-
**JSON file format:** The JSON file must be formatted as a dictionary where the keys are port numbers (as strings) and the values are the corresponding service names or descriptions.
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
"53": "DNS",
|
|
98
|
-
|
|
99
|
-
"80": "HTTP",
|
|
100
|
-
|
|
101
|
-
"443": "HTTPS"
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
* **-dr**: Reset custom port dictionaries to their default state and revert to the standard SnakeScan port definitions. This functionality relies on internal mechanisms that are still under development. Functionality is present, has narrowly specialized implementations. See details below. Example: `snake -dr`
|
|
108
|
-
|
|
109
|
-
**-ds**: Display the paths to the currently used custom port dictionaries (TCP and UDP). This is useful to verify which custom definitions are loaded. Example: `snake -ds`
|
|
110
|
-
|
|
111
|
-
## 💻 Python Code Integration:
|
|
112
|
-
|
|
113
|
-
### ⏱️ Watcher class: Real-time port status
|
|
114
|
-
|
|
115
|
-
The `Watcher` class allows you to continuously monitor the specified port.
|
|
116
|
-
|
|
117
|
-
python
|
|
118
|
-
|
|
119
|
-
from SnakeScan import Watcher
|
|
120
|
-
|
|
121
|
-
watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
|
|
122
|
-
|
|
123
|
-
watcher.start() # Start monitoring!
|
|
124
|
-
|
|
125
|
-
#### `Watcher` Methods:
|
|
126
|
-
|
|
127
|
-
* `Watcher.start()` - Start the port monitoring process.
|
|
128
|
-
|
|
129
|
-
* `Watcher.stop()` - End the port monitoring process.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
**Last updated:** 1.8.6 (Minor bug fixes and style changes) *Functionality is present, has narrowly specialized implementations. See details below.*
|
|
134
|
-
|
|
135
|
-
***
|
|
136
|
-
|
|
137
|
-
**Details on the narrowly specialized functionality of custom port dictionaries:**
|
|
138
|
-
|
|
139
|
-
* The `-d` flag can load port definitions from a JSON file.
|
|
140
|
-
* The `-ds` flag can show where the current `-d` is pointed.
|
|
141
|
-
* The `-dr` flag attempts to revert to the default port definitions.
|
snakescan-1.8.6/README.md
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
This documentation was created with the assistance of the GeekBot language model and Den*Ram
|
|
3
|
-
-->
|
|
4
|
-
# 🐍 SnakeScan: Reliable Port Scanner in Python
|
|
5
|
-
|
|
6
|
-
A versatile and efficient Python library designed for comprehensive network port scanning.
|
|
7
|
-
|
|
8
|
-
[](https://pypi.org/project/SnakeScan/)
|
|
9
|
-
|
|
10
|
-
[](https://opensource.org/licenses/MIT)
|
|
11
|
-
|
|
12
|
-
[](https://www.python.org/)
|
|
13
|
-
|
|
14
|
-
[](https://img.shields.io/badge/Status-Stable-green)
|
|
15
|
-
|
|
16
|
-
**SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers who need robust port scanning capabilities. From basic port checking to advanced, multi-threaded subnet analysis, SnakeScan provides the tools you need for effective network assessment.
|
|
17
|
-
|
|
18
|
-
**Important Note:** *The following documentation describes potential features that are **partially implemented** in SnakeScan. Functionality related to custom port dictionaries is available, but has **narrowly specialized** implementations in its current state. Descriptions here are intended to demonstrate a more complete implementation and **may not fully match the library's current narrowly specialized capabilities**.*
|
|
19
|
-
|
|
20
|
-
## ⚙️ Key features:
|
|
21
|
-
|
|
22
|
-
* **Flexible port specification:** Define target ports as individual values, ranges, or via pre-configured sets.
|
|
23
|
-
|
|
24
|
-
* **Multi-threaded architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
|
|
25
|
-
|
|
26
|
-
* **IP address information retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
|
|
27
|
-
|
|
28
|
-
* **Real-time port monitoring:** Use the `Watcher` class to continuously monitor the status of important ports.
|
|
29
|
-
|
|
30
|
-
* **Concise command-line interface and API:** Easily integrate SnakeScan into workflows via command-line or programmatic access.
|
|
31
|
-
|
|
32
|
-
* **UDP port scanning:** Built-in support for scanning UDP ports.
|
|
33
|
-
|
|
34
|
-
* **Customizable port dictionaries:** Add your own port descriptions from JSON files and easily revert to the default set. *(Functionality is present, has narrowly specialized implementations. See details below).*
|
|
35
|
-
|
|
36
|
-
## ⬇️ Installation:
|
|
37
|
-
|
|
38
|
-
Install SnakeScan using pip:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
bash
|
|
43
|
-
|
|
44
|
-
pip install SnakeScan
|
|
45
|
-
|
|
46
|
-
## ⌨️ Command-line usage:
|
|
47
|
-
|
|
48
|
-
### 💡 Attribute reference:
|
|
49
|
-
|
|
50
|
-
* **-p**: Specify target ports to scan (single port or range). Note: Range excludes the lower bound in the first entry. For example: To scan from port 80 to 443 specify the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
|
|
51
|
-
|
|
52
|
-
* **-u**: Enable UDP port scanning. Example: `snake -p 53 -u`
|
|
53
|
-
|
|
54
|
-
* **-h**: Show the full list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
|
|
55
|
-
|
|
56
|
-
* **-sp**: Start scanning using the predefined common port set with `ProcessPoolExecutor`. Example: `snake -sp`
|
|
57
|
-
|
|
58
|
-
* **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
|
|
59
|
-
|
|
60
|
-
* **-gs**: Retrieve the SSL/TLS certificate from the specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
|
|
61
|
-
|
|
62
|
-
* **-t**: Enable multi-threading to improve scanning performance. Example: `snake -t`
|
|
63
|
-
|
|
64
|
-
* **-ch**: Scan a subnet to discover active IP addresses on the network. Example: `snake -ch`
|
|
65
|
-
|
|
66
|
-
* **-l**: Display your public IP address (requires active internet connection). Example: `snake -l`
|
|
67
|
-
|
|
68
|
-
* **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
|
|
69
|
-
|
|
70
|
-
* **-d**: Specify the path to a JSON file containing TCP port definitions, and optionally a path to a second JSON file containing UDP port definitions. **Note:** When using this argument *for the first* time, the paths to the JSON files must be specified with each command execution, separated by a comma. After the first use, SnakeScan *may* remember these paths for subsequent scans. Functionality is present, has narrowly specialized implementations. See details below.
|
|
71
|
-
|
|
72
|
-
Example: `snake -d /путь/к/tcp_ports.json,/путь/к/udp_ports.json` (if you want to specify both TCP and UDP, if TCP only: `snake -d /путь/к/tcp_ports.json`)
|
|
73
|
-
|
|
74
|
-
**Subsequent Use**: After initial use, you can simply use the `-d` flag *without* file paths and SnakeScan *may* use previously defined JSON files. Functionality is present, has narrowly specialized implementations. See details below.
|
|
75
|
-
|
|
76
|
-
Example (after initial setup): `snake -d` (may use previously saved paths)
|
|
77
|
-
|
|
78
|
-
**JSON file format:** The JSON file must be formatted as a dictionary where the keys are port numbers (as strings) and the values are the corresponding service names or descriptions.
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
"53": "DNS",
|
|
85
|
-
|
|
86
|
-
"80": "HTTP",
|
|
87
|
-
|
|
88
|
-
"443": "HTTPS"
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
* **-dr**: Reset custom port dictionaries to their default state and revert to the standard SnakeScan port definitions. This functionality relies on internal mechanisms that are still under development. Functionality is present, has narrowly specialized implementations. See details below. Example: `snake -dr`
|
|
95
|
-
|
|
96
|
-
**-ds**: Display the paths to the currently used custom port dictionaries (TCP and UDP). This is useful to verify which custom definitions are loaded. Example: `snake -ds`
|
|
97
|
-
|
|
98
|
-
## 💻 Python Code Integration:
|
|
99
|
-
|
|
100
|
-
### ⏱️ Watcher class: Real-time port status
|
|
101
|
-
|
|
102
|
-
The `Watcher` class allows you to continuously monitor the specified port.
|
|
103
|
-
|
|
104
|
-
python
|
|
105
|
-
|
|
106
|
-
from SnakeScan import Watcher
|
|
107
|
-
|
|
108
|
-
watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
|
|
109
|
-
|
|
110
|
-
watcher.start() # Start monitoring!
|
|
111
|
-
|
|
112
|
-
#### `Watcher` Methods:
|
|
113
|
-
|
|
114
|
-
* `Watcher.start()` - Start the port monitoring process.
|
|
115
|
-
|
|
116
|
-
* `Watcher.stop()` - End the port monitoring process.
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
**Last updated:** 1.8.6 (Minor bug fixes and style changes) *Functionality is present, has narrowly specialized implementations. See details below.*
|
|
121
|
-
|
|
122
|
-
***
|
|
123
|
-
|
|
124
|
-
**Details on the narrowly specialized functionality of custom port dictionaries:**
|
|
125
|
-
|
|
126
|
-
* The `-d` flag can load port definitions from a JSON file.
|
|
127
|
-
* The `-ds` flag can show where the current `-d` is pointed.
|
|
128
|
-
* The `-dr` flag attempts to revert to the default port definitions.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|