SnakeScan 1.6.4__tar.gz → 1.6.6__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.6.4 → snakescan-1.6.6}/PKG-INFO +41 -22
- snakescan-1.6.6/README.md +93 -0
- {snakescan-1.6.4 → snakescan-1.6.6}/SnakeScan/CLI.py +58 -46
- {snakescan-1.6.4 → snakescan-1.6.6}/SnakeScan/Check_subnet.py +10 -6
- {snakescan-1.6.4 → snakescan-1.6.6}/SnakeScan/__init__.py +61 -58
- snakescan-1.6.4/README.md +0 -74
- {snakescan-1.6.4 → snakescan-1.6.6}/LICENSE +0 -0
- {snakescan-1.6.4 → snakescan-1.6.6}/SnakeScan/PoolExecutor.py +0 -0
- {snakescan-1.6.4 → snakescan-1.6.6}/pyproject.toml +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SnakeScan
|
|
3
|
-
Version: 1.6.
|
|
4
|
-
Summary: IPv4 address scanner for collecting address information.Use carefully for your network safety.Use to get IPV4 from IPV6 address.Don't use it to scan IPV6 because it's not designed for it. Scan only IPv4 or get the IPv4 address from the IPv6 host
|
|
3
|
+
Version: 1.6.6
|
|
4
|
+
Summary: IPv4 address scanner for collecting address information.Use carefully for your network safety.Use to get IPV4 from IPV6 address.Don't use it to scan IPV6 because it's not designed for it. Scan only IPv4 or get the IPv4 address from the IPv6 host
|
|
5
5
|
Author: Den*Ram
|
|
6
6
|
Requires-Python: >=3.7
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
@@ -15,13 +15,15 @@ Project-URL: Repository, https://github.com/Den-Ram/SnakeScan
|
|
|
15
15
|
|
|
16
16
|
# SnakeScan
|
|
17
17
|

|
|
18
|
-

|
|
19
18
|

|
|
19
|
+

|
|
20
|
+
Use to scan Ports and use carefully.Use the library in the terminal, because that's what it's focused on. If you don't want to use the terminal, run it in code, but then some new functions won't be present there.You will need to use it differently.
|
|
21
|
+
# Help with using the library
|
|
22
|
+
## If you use the library directly in your code:
|
|
20
23
|
```
|
|
21
24
|
import SnakeScan
|
|
22
25
|
SnakeScan.run()
|
|
23
26
|
```
|
|
24
|
-
## Help
|
|
25
27
|
- -l need internet to view public ip you device
|
|
26
28
|
- -t threading port search
|
|
27
29
|
- -s single search ports
|
|
@@ -29,16 +31,46 @@ SnakeScan.run()
|
|
|
29
31
|
- -help in host /-help port in host
|
|
30
32
|
- -check [host] scan subnet in ip
|
|
31
33
|
- exit in host or port off script
|
|
34
|
+
|
|
35
|
+
## Watcher commands
|
|
36
|
+
```
|
|
37
|
+
Watcher.start() - Starts checking ports
|
|
38
|
+
Watcher.stop() - Stops port checking
|
|
39
|
+
```
|
|
40
|
+
## Help with attributes
|
|
41
|
+
```
|
|
42
|
+
-P:
|
|
43
|
+
snake -p 80,443 **Scanning specific ports**
|
|
44
|
+
snake -p 80,3437,8080,20-30,79-443 **Scanning individual ports and ranges. If you use ranges, then one port from the beginning is not be taken into account. For example:80-443 then it will start with 81-443, so you need to enter it from 79-443, then it will be taken into account
|
|
45
|
+
snake -p 80,3437,10-0,20-10,443-79** **You can enter ranges the other way around: 80-443,443-80 but the first value will start one port higher**
|
|
46
|
+
-H:
|
|
47
|
+
**Displays a list of attribute usages**
|
|
48
|
+
snake -h
|
|
49
|
+
snake -help
|
|
50
|
+
-SP:
|
|
51
|
+
-sp:snake -sp **Uses selected pre-selected range and uses for scanning ProcessPoolExecutor**
|
|
52
|
+
-V:
|
|
53
|
+
snake -v **Shows the library version**
|
|
54
|
+
-T:
|
|
55
|
+
snake -t **Uses streams for port scanning**
|
|
56
|
+
-CH:
|
|
57
|
+
snake -ch **Scans the subnet for others IP**
|
|
58
|
+
-L:
|
|
59
|
+
snake -l **Shows your public internet IP address. Internet connection required for use**
|
|
60
|
+
-I:
|
|
61
|
+
snake www.google.com -i **Shows information about the IP address.Can receive information from IPV4 and IPV6**
|
|
62
|
+
**You can also use all attributes in place:**
|
|
63
|
+
```
|
|
64
|
+
snake -p 100,200,79-443 www.google.com -i -l -t -ch -sp
|
|
65
|
+
```
|
|
66
|
+
# Library changes
|
|
67
|
+
|
|
32
68
|
## Added class Watcher:
|
|
33
69
|
```
|
|
34
70
|
from SnakeScan import Watcher
|
|
35
71
|
Watcher = Watcher(host="localhost",port="80",timeout=1)
|
|
36
72
|
Watcher.start()
|
|
37
73
|
```
|
|
38
|
-
## Watcher commands
|
|
39
|
-
```
|
|
40
|
-
Watcher.start() - Starts checking ports
|
|
41
|
-
Watcher.stop() - Stops port checking
|
|
42
74
|
## Added multiple use Watcher:
|
|
43
75
|
```
|
|
44
76
|
from SnakeScan import Watcher
|
|
@@ -48,7 +80,7 @@ SnakeScan.run()
|
|
|
48
80
|
Watchers.append(Watcher("127.0.0.1",ports[i]))
|
|
49
81
|
Watchers[i].start()
|
|
50
82
|
```
|
|
51
|
-
##
|
|
83
|
+
## Library added for use in terminal to use enter snake or Snake
|
|
52
84
|
```
|
|
53
85
|
usage: snake [-h] [-sp] [-v] [-i] [-p PORTS] [-t] [-ch]
|
|
54
86
|
[-l]
|
|
@@ -70,19 +102,6 @@ options:
|
|
|
70
102
|
-ch, --check scan subnet
|
|
71
103
|
-l, --local view you public ip - need internet
|
|
72
104
|
```
|
|
73
|
-
## Attributes snake-Snake
|
|
74
|
-
```
|
|
75
|
-
-p:snake -p 80,443,3437,20-1000
|
|
76
|
-
-p:[20]-1000 will start from [21]-[1000]
|
|
77
|
-
-h:snake -h [snake usage]
|
|
78
|
-
-sp:snake -sp [use processpoolexecutir to scan host]
|
|
79
|
-
-v:snake -v [Build_version]
|
|
80
|
-
-t:snake -t [use thread pool to scan]
|
|
81
|
-
-ch:snake -ch [scan subnet in host]
|
|
82
|
-
-l:snake -l [view you public ip and to view need on internet]
|
|
83
|
-
-i:snake www.google.com -i [info ip of host]
|
|
84
|
-
All:snake -p 100,200,79-443 www.google.com -i -l -t -ch -sp
|
|
85
|
-
```
|
|
86
105
|
## Added Info about ipv6
|
|
87
106
|
```
|
|
88
107
|
snake 2001:db8:: -i or snake [2001:4860:4860::8888] -i
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# SnakeScan
|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
Use to scan Ports and use carefully.Use the library in the terminal, because that's what it's focused on. If you don't want to use the terminal, run it in code, but then some new functions won't be present there.You will need to use it differently.
|
|
6
|
+
# Help with using the library
|
|
7
|
+
## If you use the library directly in your code:
|
|
8
|
+
```
|
|
9
|
+
import SnakeScan
|
|
10
|
+
SnakeScan.run()
|
|
11
|
+
```
|
|
12
|
+
- -l need internet to view public ip you device
|
|
13
|
+
- -t threading port search
|
|
14
|
+
- -s single search ports
|
|
15
|
+
- -i information about host
|
|
16
|
+
- -help in host /-help port in host
|
|
17
|
+
- -check [host] scan subnet in ip
|
|
18
|
+
- exit in host or port off script
|
|
19
|
+
|
|
20
|
+
## Watcher commands
|
|
21
|
+
```
|
|
22
|
+
Watcher.start() - Starts checking ports
|
|
23
|
+
Watcher.stop() - Stops port checking
|
|
24
|
+
```
|
|
25
|
+
## Help with attributes
|
|
26
|
+
```
|
|
27
|
+
-P:
|
|
28
|
+
snake -p 80,443 **Scanning specific ports**
|
|
29
|
+
snake -p 80,3437,8080,20-30,79-443 **Scanning individual ports and ranges. If you use ranges, then one port from the beginning is not be taken into account. For example:80-443 then it will start with 81-443, so you need to enter it from 79-443, then it will be taken into account
|
|
30
|
+
snake -p 80,3437,10-0,20-10,443-79** **You can enter ranges the other way around: 80-443,443-80 but the first value will start one port higher**
|
|
31
|
+
-H:
|
|
32
|
+
**Displays a list of attribute usages**
|
|
33
|
+
snake -h
|
|
34
|
+
snake -help
|
|
35
|
+
-SP:
|
|
36
|
+
-sp:snake -sp **Uses selected pre-selected range and uses for scanning ProcessPoolExecutor**
|
|
37
|
+
-V:
|
|
38
|
+
snake -v **Shows the library version**
|
|
39
|
+
-T:
|
|
40
|
+
snake -t **Uses streams for port scanning**
|
|
41
|
+
-CH:
|
|
42
|
+
snake -ch **Scans the subnet for others IP**
|
|
43
|
+
-L:
|
|
44
|
+
snake -l **Shows your public internet IP address. Internet connection required for use**
|
|
45
|
+
-I:
|
|
46
|
+
snake www.google.com -i **Shows information about the IP address.Can receive information from IPV4 and IPV6**
|
|
47
|
+
**You can also use all attributes in place:**
|
|
48
|
+
```
|
|
49
|
+
snake -p 100,200,79-443 www.google.com -i -l -t -ch -sp
|
|
50
|
+
```
|
|
51
|
+
# Library changes
|
|
52
|
+
|
|
53
|
+
## Added class Watcher:
|
|
54
|
+
```
|
|
55
|
+
from SnakeScan import Watcher
|
|
56
|
+
Watcher = Watcher(host="localhost",port="80",timeout=1)
|
|
57
|
+
Watcher.start()
|
|
58
|
+
```
|
|
59
|
+
## Added multiple use Watcher:
|
|
60
|
+
```
|
|
61
|
+
from SnakeScan import Watcher
|
|
62
|
+
ports=[53,80,100,160]
|
|
63
|
+
Watchers=[]
|
|
64
|
+
for i in range(len(ports)):
|
|
65
|
+
Watchers.append(Watcher("127.0.0.1",ports[i]))
|
|
66
|
+
Watchers[i].start()
|
|
67
|
+
```
|
|
68
|
+
## Library added for use in terminal to use enter snake or Snake
|
|
69
|
+
```
|
|
70
|
+
usage: snake [-h] [-sp] [-v] [-i] [-p PORTS] [-t] [-ch]
|
|
71
|
+
[-l]
|
|
72
|
+
[host]
|
|
73
|
+
|
|
74
|
+
Snake - It's a command line module SnakeScan. Use him for
|
|
75
|
+
more fast starting
|
|
76
|
+
|
|
77
|
+
positional arguments:
|
|
78
|
+
host
|
|
79
|
+
|
|
80
|
+
options:
|
|
81
|
+
-h, --help show this help message and exit
|
|
82
|
+
-sp, --speed speed scan
|
|
83
|
+
-v, --version version
|
|
84
|
+
-i, --info ip info
|
|
85
|
+
-p, --ports PORTS range ports to scan host
|
|
86
|
+
-t, --thread fast scan
|
|
87
|
+
-ch, --check scan subnet
|
|
88
|
+
-l, --local view you public ip - need internet
|
|
89
|
+
```
|
|
90
|
+
## Added Info about ipv6
|
|
91
|
+
```
|
|
92
|
+
snake 2001:db8:: -i or snake [2001:4860:4860::8888] -i
|
|
93
|
+
```
|
|
@@ -66,7 +66,7 @@ ports = {
|
|
|
66
66
|
8080: "Tomcat",
|
|
67
67
|
10000: "Webmin",
|
|
68
68
|
}
|
|
69
|
-
version = "1.6.
|
|
69
|
+
version = "1.6.6"
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
def is_port_open(host, port):
|
|
@@ -92,28 +92,35 @@ def is_port_open_threads(host, port):
|
|
|
92
92
|
print(f"Closed{colored('|X|','red')}-->|{port}|")
|
|
93
93
|
else:
|
|
94
94
|
print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
|
|
95
|
+
|
|
96
|
+
|
|
95
97
|
def Ports(str=""):
|
|
96
|
-
rangeports=[]
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
rangeports = []
|
|
99
|
+
rangeport = []
|
|
100
|
+
port = []
|
|
101
|
+
doneports = []
|
|
102
|
+
str = str.split(",")
|
|
99
103
|
for p in range(len(str)):
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
if "-" in str[p]:
|
|
105
|
+
rangeports.append(str[p])
|
|
106
|
+
else:
|
|
107
|
+
port.append(str[p])
|
|
104
108
|
for n in range(len(port)):
|
|
105
109
|
for i in string.punctuation:
|
|
106
110
|
if i in port[n]:
|
|
107
|
-
port[n]=port[n].replace(i,"")
|
|
111
|
+
port[n] = port[n].replace(i, "")
|
|
108
112
|
for r in range(len(rangeports)):
|
|
109
|
-
rangeport=rangeports[r].split("-")
|
|
113
|
+
rangeport = rangeports[r].split("-")
|
|
114
|
+
for i in range(len(rangeport)):
|
|
115
|
+
doneports.append(rangeport[i])
|
|
110
116
|
try:
|
|
111
|
-
|
|
117
|
+
return doneports, port
|
|
112
118
|
except Exception as e:
|
|
113
|
-
rangeport=""
|
|
114
|
-
return
|
|
119
|
+
rangeport = ""
|
|
120
|
+
return doneports, port
|
|
115
121
|
sys.exit()
|
|
116
122
|
|
|
123
|
+
|
|
117
124
|
def SnakeArgs():
|
|
118
125
|
parser = argparse.ArgumentParser(
|
|
119
126
|
description="Snake - It's a command line module SnakeScan. Use him for more fast starting"
|
|
@@ -158,45 +165,49 @@ if host.startswith("https://"):
|
|
|
158
165
|
if host == "None":
|
|
159
166
|
host = "localhost"
|
|
160
167
|
if SnakeArgs().ports:
|
|
161
|
-
rangeports,port_user=Ports(port_user)
|
|
168
|
+
rangeports, port_user = Ports(port_user)
|
|
162
169
|
for i in range(len(port_user)):
|
|
163
|
-
port_user[i]=int(port_user[i])
|
|
170
|
+
port_user[i] = int(port_user[i])
|
|
164
171
|
for port in range(len(port_user)):
|
|
165
|
-
|
|
172
|
+
if is_port_open(host, port_user[port]):
|
|
173
|
+
print(
|
|
174
|
+
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
175
|
+
)
|
|
176
|
+
else:
|
|
177
|
+
try:
|
|
166
178
|
print(
|
|
167
|
-
f"
|
|
179
|
+
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
168
180
|
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
print(
|
|
172
|
-
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
173
|
-
)
|
|
174
|
-
except:
|
|
175
|
-
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
181
|
+
except:
|
|
182
|
+
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
176
183
|
try:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
first = rangeports[::2]
|
|
185
|
+
second = rangeports[1::2]
|
|
186
|
+
minimal = min(len(first), len(second))
|
|
187
|
+
for i in range(minimal):
|
|
188
|
+
if int(first[i]) > int(second[i]):
|
|
189
|
+
number = second[i]
|
|
190
|
+
second[i] = first[i]
|
|
191
|
+
first[i] = number
|
|
192
|
+
for i in range(minimal):
|
|
193
|
+
for port in tqdm(range(int(first[i]) + 1, int(second[i]) + 1)):
|
|
194
|
+
if is_port_open(host, port):
|
|
195
|
+
for name in ports:
|
|
196
|
+
if port == name:
|
|
197
|
+
OpenPorts = [port]
|
|
198
|
+
portsopen += 1
|
|
199
|
+
else:
|
|
200
|
+
portsclosed += 1
|
|
201
|
+
if OpenPorts:
|
|
202
|
+
for i in OpenPorts:
|
|
203
|
+
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
204
|
+
print(f"{host}".center(60, "-"))
|
|
205
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
206
|
+
portsclosed = 0
|
|
207
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
208
|
+
portsopen = 0
|
|
209
|
+
print("-" * 60)
|
|
188
210
|
else:
|
|
189
|
-
portsclosed += 1
|
|
190
|
-
if OpenPorts:
|
|
191
|
-
for i in OpenPorts:
|
|
192
|
-
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
193
|
-
print(f"{host}".center(60, "-"))
|
|
194
|
-
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
195
|
-
portsclosed = 0
|
|
196
|
-
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
197
|
-
portsopen = 0
|
|
198
|
-
print("-" * 60)
|
|
199
|
-
else:
|
|
200
211
|
print(f"{host}".center(60, "-"))
|
|
201
212
|
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
202
213
|
portsclosed = 0
|
|
@@ -204,6 +215,7 @@ if SnakeArgs().ports:
|
|
|
204
215
|
portsopen = 0
|
|
205
216
|
print("-" * 60)
|
|
206
217
|
except Exception as e:
|
|
218
|
+
print(e)
|
|
207
219
|
sys.exit()
|
|
208
220
|
if SnakeArgs().check:
|
|
209
221
|
Check_network(host)
|
|
@@ -4,8 +4,11 @@ import platform
|
|
|
4
4
|
import socket
|
|
5
5
|
from termcolor import colored
|
|
6
6
|
from concurrent.futures import ThreadPoolExecutor
|
|
7
|
+
|
|
7
8
|
global threads
|
|
8
9
|
threads = []
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
def Check_network(host):
|
|
10
13
|
def check_host(host):
|
|
11
14
|
try:
|
|
@@ -25,6 +28,7 @@ def Check_network(host):
|
|
|
25
28
|
except Exception as e:
|
|
26
29
|
print(f"Check error {ip}: {e}")
|
|
27
30
|
return False
|
|
31
|
+
|
|
28
32
|
try:
|
|
29
33
|
print("".center(60, "-"))
|
|
30
34
|
try:
|
|
@@ -45,11 +49,11 @@ def Check_network(host):
|
|
|
45
49
|
network = ipaddress.ip_network(network_str)
|
|
46
50
|
print(f"Checking the IP addresses in the subset {network_str}...")
|
|
47
51
|
with ThreadPoolExecutor(max_workers=None) as executor:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
try:
|
|
53
|
+
for ip in network.hosts():
|
|
54
|
+
future = executor.submit(check_host, ip)
|
|
55
|
+
future.result()
|
|
56
|
+
except Exception as e:
|
|
57
|
+
print(e)
|
|
54
58
|
except ValueError as e:
|
|
55
59
|
print(f"Error creating network object {e}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""IPv4 address scanner for collecting address information.Use carefully for your network safety.Use to get IPV4 from IPV6 address.Don't use it to scan IPV6 because it's not designed for it. Scan only IPv4 or get the IPv4 address from the IPv6 host
|
|
1
|
+
"""IPv4 address scanner for collecting address information.Use carefully for your network safety.Use to get IPV4 from IPV6 address.Don't use it to scan IPV6 because it's not designed for it. Scan only IPv4 or get the IPv4 address from the IPv6 host"""
|
|
2
2
|
|
|
3
|
-
__version__ = "1.6.
|
|
3
|
+
__version__ = "1.6.6"
|
|
4
4
|
import socket
|
|
5
5
|
import ipaddress
|
|
6
6
|
from art import tprint
|
|
@@ -12,35 +12,38 @@ from SnakeScan.Check_subnet import Check_network
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Watcher:
|
|
15
|
-
def __init__(self, host, port_user, timeout
|
|
16
|
-
#Initialized class and variables host, port, and delay.
|
|
17
|
-
self.host = host
|
|
18
|
-
self.port_user = port_user
|
|
19
|
-
self.timeout = timeout
|
|
20
|
-
self.work = False
|
|
15
|
+
def __init__(self, host, port_user, timeout=1):
|
|
16
|
+
# Initialized class and variables host, port, and delay.
|
|
17
|
+
self.host = host # localhost
|
|
18
|
+
self.port_user = port_user # 80
|
|
19
|
+
self.timeout = timeout # 2 or 2.0
|
|
20
|
+
self.work = False # run value
|
|
21
|
+
|
|
21
22
|
def run(self):
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
# Basic process of connecting to a host and checking the port
|
|
24
|
+
previous = None
|
|
25
|
+
while self.work:
|
|
26
|
+
try:
|
|
27
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
28
|
+
connection = sock.connect_ex((self.host, self.port_user))
|
|
29
|
+
if previous != connection:
|
|
30
|
+
if connection == 0:
|
|
31
|
+
print(f"Service is up {self.host}-->|{self.port_user}|")
|
|
32
|
+
else:
|
|
33
|
+
print(f"Service is down {self.host}-->|{self.port_user}|")
|
|
34
|
+
previous = connection
|
|
35
|
+
except Exception as e:
|
|
36
|
+
print(f"Unable to create scanner object:{e}")
|
|
37
|
+
sleep(self.timeout)
|
|
38
|
+
|
|
37
39
|
def start(self):
|
|
38
|
-
#Run a port check to see if it is running or offline.
|
|
40
|
+
# Run a port check to see if it is running or offline.
|
|
39
41
|
self.work = True
|
|
40
42
|
self.thread = Thread(target=self.run)
|
|
41
43
|
self.thread.start()
|
|
44
|
+
|
|
42
45
|
def stop(self):
|
|
43
|
-
#Stops port checking
|
|
46
|
+
# Stops port checking
|
|
44
47
|
self.work = False
|
|
45
48
|
self.thread.join()
|
|
46
49
|
|
|
@@ -49,11 +52,10 @@ def run():
|
|
|
49
52
|
portsopen = 0
|
|
50
53
|
portsclosed = 0
|
|
51
54
|
Run_now = True
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
|
|
54
56
|
global num
|
|
55
57
|
num = 0
|
|
56
|
-
|
|
58
|
+
|
|
57
59
|
OpenPorts = []
|
|
58
60
|
threads = []
|
|
59
61
|
ports = {
|
|
@@ -98,26 +100,28 @@ def run():
|
|
|
98
100
|
8080: "Tomcat",
|
|
99
101
|
10000: "Webmin",
|
|
100
102
|
}
|
|
103
|
+
|
|
101
104
|
def Ports(str=""):
|
|
102
|
-
rangeports=[]
|
|
103
|
-
port=[]
|
|
104
|
-
str=str.split(",")
|
|
105
|
+
rangeports = []
|
|
106
|
+
port = []
|
|
107
|
+
str = str.split(",")
|
|
105
108
|
for p in range(len(str)):
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
if "-" in str[p]:
|
|
110
|
+
rangeports.append(str[p])
|
|
111
|
+
else:
|
|
112
|
+
port.append(str[p])
|
|
110
113
|
for n in range(len(port)):
|
|
111
114
|
for i in string.punctuation:
|
|
112
115
|
if i in port[n]:
|
|
113
|
-
port[n]=port[n].replace(i,"")
|
|
116
|
+
port[n] = port[n].replace(i, "")
|
|
114
117
|
for r in range(len(rangeports)):
|
|
115
|
-
rangeport=rangeports[r].split("-")
|
|
118
|
+
rangeport = rangeports[r].split("-")
|
|
116
119
|
try:
|
|
117
|
-
|
|
120
|
+
return rangeport, port
|
|
118
121
|
except Exception as e:
|
|
119
122
|
print("Error: invalid value")
|
|
120
123
|
sys.exit()
|
|
124
|
+
|
|
121
125
|
def is_port_open(host, port):
|
|
122
126
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
123
127
|
try:
|
|
@@ -262,7 +266,6 @@ def run():
|
|
|
262
266
|
t.start()
|
|
263
267
|
for t in threads:
|
|
264
268
|
t.join()
|
|
265
|
-
|
|
266
269
|
|
|
267
270
|
else:
|
|
268
271
|
if "-t" in port_user:
|
|
@@ -281,29 +284,29 @@ def run():
|
|
|
281
284
|
length = port_user
|
|
282
285
|
print(f"{colored('|!|','red')}Listening {host} please wait...")
|
|
283
286
|
# |----------------starting---------------------|
|
|
284
|
-
rangeports,port_user=Ports(port_user)
|
|
287
|
+
rangeports, port_user = Ports(port_user)
|
|
285
288
|
for i in range(len(port_user)):
|
|
286
|
-
port_user[i]=int(port_user[i])
|
|
289
|
+
port_user[i] = int(port_user[i])
|
|
287
290
|
for port in range(len(port_user)):
|
|
288
|
-
|
|
291
|
+
if is_port_open(host, port_user[port]):
|
|
292
|
+
print(
|
|
293
|
+
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
294
|
+
)
|
|
295
|
+
else:
|
|
296
|
+
try:
|
|
289
297
|
print(
|
|
290
|
-
f"
|
|
298
|
+
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
291
299
|
)
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
296
|
-
)
|
|
297
|
-
except:
|
|
298
|
-
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
299
|
-
for port in tqdm(range(int(rangeports[0]), int(rangeports[1])+1)):
|
|
300
|
+
except:
|
|
301
|
+
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
302
|
+
for port in tqdm(range(int(rangeports[0]), int(rangeports[1]) + 1)):
|
|
300
303
|
if is_port_open(host, port):
|
|
301
304
|
for name in ports:
|
|
302
305
|
if port == name:
|
|
303
306
|
OpenPorts = [port]
|
|
304
307
|
portsopen += 1
|
|
305
308
|
else:
|
|
306
|
-
|
|
309
|
+
portsclosed += 1
|
|
307
310
|
if OpenPorts:
|
|
308
311
|
for i in OpenPorts:
|
|
309
312
|
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
@@ -314,9 +317,9 @@ def run():
|
|
|
314
317
|
portsopen = 0
|
|
315
318
|
print("-" * 60)
|
|
316
319
|
else:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
print(f"{host}".center(60, "-"))
|
|
321
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
322
|
+
portsclosed = 0
|
|
323
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
324
|
+
portsopen = 0
|
|
325
|
+
print("-" * 60)
|
snakescan-1.6.4/README.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# SnakeScan
|
|
2
|
-

|
|
3
|
-

|
|
4
|
-

|
|
5
|
-
```
|
|
6
|
-
import SnakeScan
|
|
7
|
-
SnakeScan.run()
|
|
8
|
-
```
|
|
9
|
-
## Help
|
|
10
|
-
- -l need internet to view public ip you device
|
|
11
|
-
- -t threading port search
|
|
12
|
-
- -s single search ports
|
|
13
|
-
- -i information about host
|
|
14
|
-
- -help in host /-help port in host
|
|
15
|
-
- -check [host] scan subnet in ip
|
|
16
|
-
- exit in host or port off script
|
|
17
|
-
## Added class Watcher:
|
|
18
|
-
```
|
|
19
|
-
from SnakeScan import Watcher
|
|
20
|
-
Watcher = Watcher(host="localhost",port="80",timeout=1)
|
|
21
|
-
Watcher.start()
|
|
22
|
-
```
|
|
23
|
-
## Watcher commands
|
|
24
|
-
```
|
|
25
|
-
Watcher.start() - Starts checking ports
|
|
26
|
-
Watcher.stop() - Stops port checking
|
|
27
|
-
## Added multiple use Watcher:
|
|
28
|
-
```
|
|
29
|
-
from SnakeScan import Watcher
|
|
30
|
-
ports=[53,80,100,160]
|
|
31
|
-
Watchers=[]
|
|
32
|
-
for i in range(len(ports)):
|
|
33
|
-
Watchers.append(Watcher("127.0.0.1",ports[i]))
|
|
34
|
-
Watchers[i].start()
|
|
35
|
-
```
|
|
36
|
-
## Added CLI command line use snake or Snake
|
|
37
|
-
```
|
|
38
|
-
usage: snake [-h] [-sp] [-v] [-i] [-p PORTS] [-t] [-ch]
|
|
39
|
-
[-l]
|
|
40
|
-
[host]
|
|
41
|
-
|
|
42
|
-
Snake - It's a command line module SnakeScan. Use him for
|
|
43
|
-
more fast starting
|
|
44
|
-
|
|
45
|
-
positional arguments:
|
|
46
|
-
host
|
|
47
|
-
|
|
48
|
-
options:
|
|
49
|
-
-h, --help show this help message and exit
|
|
50
|
-
-sp, --speed speed scan
|
|
51
|
-
-v, --version version
|
|
52
|
-
-i, --info ip info
|
|
53
|
-
-p, --ports PORTS range ports to scan host
|
|
54
|
-
-t, --thread fast scan
|
|
55
|
-
-ch, --check scan subnet
|
|
56
|
-
-l, --local view you public ip - need internet
|
|
57
|
-
```
|
|
58
|
-
## Attributes snake-Snake
|
|
59
|
-
```
|
|
60
|
-
-p:snake -p 80,443,3437,20-1000
|
|
61
|
-
-p:[20]-1000 will start from [21]-[1000]
|
|
62
|
-
-h:snake -h [snake usage]
|
|
63
|
-
-sp:snake -sp [use processpoolexecutir to scan host]
|
|
64
|
-
-v:snake -v [Build_version]
|
|
65
|
-
-t:snake -t [use thread pool to scan]
|
|
66
|
-
-ch:snake -ch [scan subnet in host]
|
|
67
|
-
-l:snake -l [view you public ip and to view need on internet]
|
|
68
|
-
-i:snake www.google.com -i [info ip of host]
|
|
69
|
-
All:snake -p 100,200,79-443 www.google.com -i -l -t -ch -sp
|
|
70
|
-
```
|
|
71
|
-
## Added Info about ipv6
|
|
72
|
-
```
|
|
73
|
-
snake 2001:db8:: -i or snake [2001:4860:4860::8888] -i
|
|
74
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|