SnakeScan 1.6.2__tar.gz → 1.6.4__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.2 → snakescan-1.6.4}/PKG-INFO +36 -17
- snakescan-1.6.4/README.md +74 -0
- {snakescan-1.6.2 → snakescan-1.6.4}/SnakeScan/CLI.py +69 -66
- {snakescan-1.6.2 → snakescan-1.6.4}/SnakeScan/Check_subnet.py +8 -11
- {snakescan-1.6.2 → snakescan-1.6.4}/SnakeScan/__init__.py +91 -74
- snakescan-1.6.2/README.md +0 -55
- {snakescan-1.6.2 → snakescan-1.6.4}/LICENSE +0 -0
- {snakescan-1.6.2 → snakescan-1.6.4}/SnakeScan/PoolExecutor.py +0 -0
- {snakescan-1.6.2 → snakescan-1.6.4}/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.
|
|
3
|
+
Version: 1.6.4
|
|
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
|
|
@@ -24,27 +24,34 @@ SnakeScan.run()
|
|
|
24
24
|
## Help
|
|
25
25
|
- -l need internet to view public ip you device
|
|
26
26
|
- -t threading port search
|
|
27
|
-
- -s single
|
|
27
|
+
- -s single search ports
|
|
28
28
|
- -i information about host
|
|
29
29
|
- -help in host /-help port in host
|
|
30
30
|
- -check [host] scan subnet in ip
|
|
31
31
|
- exit in host or port off script
|
|
32
32
|
## Added class Watcher:
|
|
33
33
|
```
|
|
34
|
-
|
|
35
|
-
Watcher(host
|
|
34
|
+
from SnakeScan import Watcher
|
|
35
|
+
Watcher = Watcher(host="localhost",port="80",timeout=1)
|
|
36
|
+
Watcher.start()
|
|
37
|
+
```
|
|
38
|
+
## Watcher commands
|
|
36
39
|
```
|
|
40
|
+
Watcher.start() - Starts checking ports
|
|
41
|
+
Watcher.stop() - Stops port checking
|
|
37
42
|
## Added multiple use Watcher:
|
|
38
43
|
```
|
|
39
44
|
from SnakeScan import Watcher
|
|
40
45
|
ports=[53,80,100,160]
|
|
46
|
+
Watchers=[]
|
|
41
47
|
for i in range(len(ports)):
|
|
42
|
-
Watcher("127.0.0.1",ports[i])
|
|
48
|
+
Watchers.append(Watcher("127.0.0.1",ports[i]))
|
|
49
|
+
Watchers[i].start()
|
|
43
50
|
```
|
|
44
51
|
## Added CLI command line use snake or Snake
|
|
45
52
|
```
|
|
46
|
-
usage:
|
|
47
|
-
[-
|
|
53
|
+
usage: snake [-h] [-sp] [-v] [-i] [-p PORTS] [-t] [-ch]
|
|
54
|
+
[-l]
|
|
48
55
|
[host]
|
|
49
56
|
|
|
50
57
|
Snake - It's a command line module SnakeScan. Use him for
|
|
@@ -54,15 +61,27 @@ positional arguments:
|
|
|
54
61
|
host
|
|
55
62
|
|
|
56
63
|
options:
|
|
57
|
-
-h, --help
|
|
58
|
-
-sp, --speed
|
|
59
|
-
-v, --version
|
|
60
|
-
-i, --info
|
|
61
|
-
-p, --ports PORTS
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
64
|
+
-h, --help show this help message and exit
|
|
65
|
+
-sp, --speed speed scan
|
|
66
|
+
-v, --version version
|
|
67
|
+
-i, --info ip info
|
|
68
|
+
-p, --ports PORTS range ports to scan host
|
|
69
|
+
-t, --thread fast scan
|
|
70
|
+
-ch, --check scan subnet
|
|
71
|
+
-l, --local view you public ip - need internet
|
|
72
|
+
```
|
|
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
|
|
66
85
|
```
|
|
67
86
|
## Added Info about ipv6
|
|
68
87
|
```
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
```
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
+
import string
|
|
2
3
|
import argparse
|
|
3
4
|
import socket
|
|
4
5
|
import ipaddress
|
|
@@ -65,7 +66,7 @@ ports = {
|
|
|
65
66
|
8080: "Tomcat",
|
|
66
67
|
10000: "Webmin",
|
|
67
68
|
}
|
|
68
|
-
version = "1.6.
|
|
69
|
+
version = "1.6.4"
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
def is_port_open(host, port):
|
|
@@ -91,7 +92,27 @@ def is_port_open_threads(host, port):
|
|
|
91
92
|
print(f"Closed{colored('|X|','red')}-->|{port}|")
|
|
92
93
|
else:
|
|
93
94
|
print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
|
|
94
|
-
|
|
95
|
+
def Ports(str=""):
|
|
96
|
+
rangeports=[]
|
|
97
|
+
port=[]
|
|
98
|
+
str=str.split(",")
|
|
99
|
+
for p in range(len(str)):
|
|
100
|
+
if "-" in str[p]:
|
|
101
|
+
rangeports.append(str[p])
|
|
102
|
+
else:
|
|
103
|
+
port.append(str[p])
|
|
104
|
+
for n in range(len(port)):
|
|
105
|
+
for i in string.punctuation:
|
|
106
|
+
if i in port[n]:
|
|
107
|
+
port[n]=port[n].replace(i,"")
|
|
108
|
+
for r in range(len(rangeports)):
|
|
109
|
+
rangeport=rangeports[r].split("-")
|
|
110
|
+
try:
|
|
111
|
+
return rangeport,port
|
|
112
|
+
except Exception as e:
|
|
113
|
+
rangeport=""
|
|
114
|
+
return rangeport,port
|
|
115
|
+
sys.exit()
|
|
95
116
|
|
|
96
117
|
def SnakeArgs():
|
|
97
118
|
parser = argparse.ArgumentParser(
|
|
@@ -101,8 +122,7 @@ def SnakeArgs():
|
|
|
101
122
|
parser.add_argument("-sp", "--speed", action="store_true", help="speed scan")
|
|
102
123
|
parser.add_argument("-v", "--version", action="store_true", help="version")
|
|
103
124
|
parser.add_argument("-i", "--info", action="store_true", help="ip info")
|
|
104
|
-
parser.add_argument("-p", "--ports", help="ports")
|
|
105
|
-
parser.add_argument("-s", "--single", help="single scan")
|
|
125
|
+
parser.add_argument("-p", "--ports", help="range ports to scan host")
|
|
106
126
|
parser.add_argument("-t", "--thread", action="store_true", help="fast scan")
|
|
107
127
|
parser.add_argument("-ch", "--check", action="store_true", help="scan subnet")
|
|
108
128
|
parser.add_argument(
|
|
@@ -138,72 +158,55 @@ if host.startswith("https://"):
|
|
|
138
158
|
if host == "None":
|
|
139
159
|
host = "localhost"
|
|
140
160
|
if SnakeArgs().ports:
|
|
161
|
+
rangeports,port_user=Ports(port_user)
|
|
162
|
+
for i in range(len(port_user)):
|
|
163
|
+
port_user[i]=int(port_user[i])
|
|
164
|
+
for port in range(len(port_user)):
|
|
165
|
+
if is_port_open(host, port_user[port]):
|
|
166
|
+
print(
|
|
167
|
+
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
168
|
+
)
|
|
169
|
+
else:
|
|
170
|
+
try:
|
|
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]}|")
|
|
141
176
|
try:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if is_port_open(host, port):
|
|
154
|
-
for name in ports:
|
|
155
|
-
if port == name:
|
|
156
|
-
OpenPorts = [port]
|
|
157
|
-
portsopen += 1
|
|
158
|
-
else:
|
|
159
|
-
portsclosed += 1
|
|
160
|
-
if port_user != "":
|
|
161
|
-
if int(port_user) == port:
|
|
162
|
-
if port_user == "":
|
|
163
|
-
pass
|
|
164
|
-
elif int(port_user) == port:
|
|
165
|
-
if is_port_open(host, port):
|
|
166
|
-
Bool = True
|
|
167
|
-
boolean += 1
|
|
177
|
+
if int(rangeports[0]) > int(rangeports[1]):
|
|
178
|
+
rangesave1=rangeports[0]
|
|
179
|
+
rangesave2=rangeports[1]
|
|
180
|
+
rangeports[1]=rangesave1
|
|
181
|
+
rangeports[0]=rangesave2
|
|
182
|
+
for port in tqdm(range(int(rangeports[0]) + 1, int(rangeports[1])+1)):
|
|
183
|
+
if is_port_open(host, port):
|
|
184
|
+
for name in ports:
|
|
185
|
+
if port == name:
|
|
186
|
+
OpenPorts = [port]
|
|
187
|
+
portsopen += 1
|
|
168
188
|
else:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
+
print(f"{host}".center(60, "-"))
|
|
201
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
202
|
+
portsclosed = 0
|
|
203
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
204
|
+
portsopen = 0
|
|
205
|
+
print("-" * 60)
|
|
206
|
+
except Exception as e:
|
|
207
|
+
sys.exit()
|
|
180
208
|
if SnakeArgs().check:
|
|
181
209
|
Check_network(host)
|
|
182
|
-
if SnakeArgs().single:
|
|
183
|
-
port_user = SnakeArgs().single.split(",")
|
|
184
|
-
|
|
185
|
-
port_list = port_user
|
|
186
|
-
port_user = []
|
|
187
|
-
for i in range(len(port_list)):
|
|
188
|
-
try:
|
|
189
|
-
port_user.append(int(port_list[i]))
|
|
190
|
-
except:
|
|
191
|
-
print(f"{port_list[i]}-->Invalid value")
|
|
192
|
-
|
|
193
|
-
for port in range(len(port_user)):
|
|
194
|
-
if is_port_open(host, port_user[port]):
|
|
195
|
-
print(
|
|
196
|
-
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
197
|
-
)
|
|
198
|
-
else:
|
|
199
|
-
try:
|
|
200
|
-
print(
|
|
201
|
-
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
202
|
-
)
|
|
203
|
-
except:
|
|
204
|
-
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
205
|
-
|
|
206
|
-
|
|
207
210
|
if SnakeArgs().local:
|
|
208
211
|
local = ""
|
|
209
212
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import ipaddress
|
|
2
2
|
import subprocess
|
|
3
3
|
import platform
|
|
4
|
-
from threading import Thread
|
|
5
4
|
import socket
|
|
6
5
|
from termcolor import colored
|
|
7
|
-
|
|
6
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
8
7
|
global threads
|
|
9
8
|
threads = []
|
|
10
|
-
|
|
11
|
-
|
|
12
9
|
def Check_network(host):
|
|
13
10
|
def check_host(host):
|
|
14
11
|
try:
|
|
@@ -28,7 +25,6 @@ def Check_network(host):
|
|
|
28
25
|
except Exception as e:
|
|
29
26
|
print(f"Check error {ip}: {e}")
|
|
30
27
|
return False
|
|
31
|
-
|
|
32
28
|
try:
|
|
33
29
|
print("".center(60, "-"))
|
|
34
30
|
try:
|
|
@@ -48,11 +44,12 @@ def Check_network(host):
|
|
|
48
44
|
network_str = network
|
|
49
45
|
network = ipaddress.ip_network(network_str)
|
|
50
46
|
print(f"Checking the IP addresses in the subset {network_str}...")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
with ThreadPoolExecutor(max_workers=None) as executor:
|
|
48
|
+
try:
|
|
49
|
+
for ip in network.hosts():
|
|
50
|
+
future = executor.submit(check_host, ip)
|
|
51
|
+
future.result()
|
|
52
|
+
except Exception as e:
|
|
53
|
+
print(e)
|
|
57
54
|
except ValueError as e:
|
|
58
55
|
print(f"Error creating network object {e}")
|
|
@@ -1,9 +1,10 @@
|
|
|
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. """
|
|
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.4"
|
|
4
4
|
import socket
|
|
5
5
|
import ipaddress
|
|
6
6
|
from art import tprint
|
|
7
|
+
from time import sleep
|
|
7
8
|
from tqdm import tqdm
|
|
8
9
|
from termcolor import colored
|
|
9
10
|
from threading import Thread
|
|
@@ -11,35 +12,48 @@ from SnakeScan.Check_subnet import Check_network
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class Watcher:
|
|
14
|
-
def __init__(self, host, port_user):
|
|
15
|
-
|
|
16
|
-
self.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
def run(self):
|
|
22
|
+
#Basic process of connecting to a host and checking the port
|
|
23
|
+
previous = None
|
|
24
|
+
while self.work:
|
|
25
|
+
try:
|
|
26
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
27
|
+
connection = sock.connect_ex((self.host, self.port_user))
|
|
28
|
+
if previous != connection:
|
|
29
|
+
if connection == 0:
|
|
30
|
+
print(f"Service is up {self.host}-->|{self.port_user}|")
|
|
31
|
+
else:
|
|
32
|
+
print(f"Service is down {self.host}-->|{self.port_user}|")
|
|
33
|
+
previous = connection
|
|
34
|
+
except Exception as e:
|
|
35
|
+
print(f"Unable to create scanner object:{e}")
|
|
36
|
+
sleep(self.timeout)
|
|
37
|
+
def start(self):
|
|
38
|
+
#Run a port check to see if it is running or offline.
|
|
39
|
+
self.work = True
|
|
40
|
+
self.thread = Thread(target=self.run)
|
|
41
|
+
self.thread.start()
|
|
42
|
+
def stop(self):
|
|
43
|
+
#Stops port checking
|
|
44
|
+
self.work = False
|
|
45
|
+
self.thread.join()
|
|
32
46
|
|
|
33
47
|
|
|
34
48
|
def run():
|
|
35
49
|
portsopen = 0
|
|
36
50
|
portsclosed = 0
|
|
37
51
|
Run_now = True
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
|
|
53
|
+
|
|
40
54
|
global num
|
|
41
55
|
num = 0
|
|
42
|
-
|
|
56
|
+
|
|
43
57
|
OpenPorts = []
|
|
44
58
|
threads = []
|
|
45
59
|
ports = {
|
|
@@ -84,7 +98,26 @@ def run():
|
|
|
84
98
|
8080: "Tomcat",
|
|
85
99
|
10000: "Webmin",
|
|
86
100
|
}
|
|
87
|
-
|
|
101
|
+
def Ports(str=""):
|
|
102
|
+
rangeports=[]
|
|
103
|
+
port=[]
|
|
104
|
+
str=str.split(",")
|
|
105
|
+
for p in range(len(str)):
|
|
106
|
+
if "-" in str[p]:
|
|
107
|
+
rangeports.append(str[p])
|
|
108
|
+
else:
|
|
109
|
+
port.append(str[p])
|
|
110
|
+
for n in range(len(port)):
|
|
111
|
+
for i in string.punctuation:
|
|
112
|
+
if i in port[n]:
|
|
113
|
+
port[n]=port[n].replace(i,"")
|
|
114
|
+
for r in range(len(rangeports)):
|
|
115
|
+
rangeport=rangeports[r].split("-")
|
|
116
|
+
try:
|
|
117
|
+
return rangeport,port
|
|
118
|
+
except Exception as e:
|
|
119
|
+
print("Error: invalid value")
|
|
120
|
+
sys.exit()
|
|
88
121
|
def is_port_open(host, port):
|
|
89
122
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
90
123
|
try:
|
|
@@ -229,33 +262,7 @@ def run():
|
|
|
229
262
|
t.start()
|
|
230
263
|
for t in threads:
|
|
231
264
|
t.join()
|
|
232
|
-
|
|
233
|
-
port_user = port_single.strip("-s")
|
|
234
|
-
port_user = port_user.split()
|
|
235
|
-
port_list = port_user
|
|
236
|
-
port_user = []
|
|
237
|
-
for i in range(len(port_list)):
|
|
238
|
-
try:
|
|
239
|
-
port_user.append(int(port_list[i]))
|
|
240
|
-
except:
|
|
241
|
-
print(f"{port_list[i]}-->Invalid value")
|
|
242
|
-
break
|
|
243
|
-
for port in range(len(port_user)):
|
|
244
|
-
if is_port_open(host, port_user[port]):
|
|
245
|
-
print(
|
|
246
|
-
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
247
|
-
)
|
|
248
|
-
else:
|
|
249
|
-
try:
|
|
250
|
-
print(
|
|
251
|
-
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
252
|
-
)
|
|
253
|
-
except:
|
|
254
|
-
print(
|
|
255
|
-
f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|"
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
continue
|
|
265
|
+
|
|
259
266
|
|
|
260
267
|
else:
|
|
261
268
|
if "-t" in port_user:
|
|
@@ -274,32 +281,42 @@ def run():
|
|
|
274
281
|
length = port_user
|
|
275
282
|
print(f"{colored('|!|','red')}Listening {host} please wait...")
|
|
276
283
|
# |----------------starting---------------------|
|
|
277
|
-
|
|
278
|
-
for
|
|
284
|
+
rangeports,port_user=Ports(port_user)
|
|
285
|
+
for i in range(len(port_user)):
|
|
286
|
+
port_user[i]=int(port_user[i])
|
|
287
|
+
for port in range(len(port_user)):
|
|
288
|
+
if is_port_open(host, port_user[port]):
|
|
289
|
+
print(
|
|
290
|
+
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
291
|
+
)
|
|
292
|
+
else:
|
|
293
|
+
try:
|
|
294
|
+
print(
|
|
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)):
|
|
279
300
|
if is_port_open(host, port):
|
|
280
301
|
for name in ports:
|
|
281
302
|
if port == name:
|
|
282
303
|
OpenPorts = [port]
|
|
283
304
|
portsopen += 1
|
|
284
305
|
else:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
portsclosed = 0
|
|
303
|
-
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
304
|
-
portsopen = 0
|
|
305
|
-
print("-" * 60)
|
|
306
|
+
portsclosed += 1
|
|
307
|
+
if OpenPorts:
|
|
308
|
+
for i in OpenPorts:
|
|
309
|
+
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
310
|
+
print(f"{host}".center(60, "-"))
|
|
311
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
312
|
+
portsclosed = 0
|
|
313
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
314
|
+
portsopen = 0
|
|
315
|
+
print("-" * 60)
|
|
316
|
+
else:
|
|
317
|
+
print(f"{host}".center(60, "-"))
|
|
318
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
319
|
+
portsclosed = 0
|
|
320
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
321
|
+
portsopen = 0
|
|
322
|
+
print("-" * 60)
|
snakescan-1.6.2/README.md
DELETED
|
@@ -1,55 +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 port search
|
|
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
|
-
for SnakeScan import Watcher
|
|
20
|
-
Watcher(host:str,port:int)
|
|
21
|
-
```
|
|
22
|
-
## Added multiple use Watcher:
|
|
23
|
-
```
|
|
24
|
-
from SnakeScan import Watcher
|
|
25
|
-
ports=[53,80,100,160]
|
|
26
|
-
for i in range(len(ports)):
|
|
27
|
-
Watcher("127.0.0.1",ports[i])
|
|
28
|
-
```
|
|
29
|
-
## Added CLI command line use snake or Snake
|
|
30
|
-
```
|
|
31
|
-
usage: Snake [-h] [-sp] [-v] [-i] [-p PORTS] [-s SINGLE]
|
|
32
|
-
[-t] [-ch] [-l]
|
|
33
|
-
[host]
|
|
34
|
-
|
|
35
|
-
Snake - It's a command line module SnakeScan. Use him for
|
|
36
|
-
more fast starting
|
|
37
|
-
|
|
38
|
-
positional arguments:
|
|
39
|
-
host
|
|
40
|
-
|
|
41
|
-
options:
|
|
42
|
-
-h, --help show this help message and exit
|
|
43
|
-
-sp, --speed speed scan
|
|
44
|
-
-v, --version version
|
|
45
|
-
-i, --info ip info
|
|
46
|
-
-p, --ports PORTS ports
|
|
47
|
-
-s, --single SINGLE single scan
|
|
48
|
-
-t, --thread fast scan
|
|
49
|
-
-ch, --check scan subnet
|
|
50
|
-
-l, --local view you public ip - need internet
|
|
51
|
-
```
|
|
52
|
-
## Added Info about ipv6
|
|
53
|
-
```
|
|
54
|
-
snake 2001:db8:: -i or snake [2001:4860:4860::8888] -i
|
|
55
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|