SnakeScan 1.5.7__tar.gz → 1.5.9__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.5.9/PKG-INFO +65 -0
- snakescan-1.5.9/README.md +51 -0
- snakescan-1.5.9/SnakeScan/CLI.py +268 -0
- {snakescan-1.5.7 → snakescan-1.5.9}/SnakeScan/Check_subnet.py +1 -1
- snakescan-1.5.9/SnakeScan/PoolExecutor.py +65 -0
- {snakescan-1.5.7 → snakescan-1.5.9}/SnakeScan/__init__.py +34 -34
- {snakescan-1.5.7 → snakescan-1.5.9}/pyproject.toml +2 -1
- snakescan-1.5.7/PKG-INFO +0 -43
- snakescan-1.5.7/README.md +0 -29
- {snakescan-1.5.7 → snakescan-1.5.9}/LICENSE +0 -0
snakescan-1.5.9/PKG-INFO
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SnakeScan
|
|
3
|
+
Version: 1.5.9
|
|
4
|
+
Summary: Module SnakeScan
|
|
5
|
+
Author: Den*Ram
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: art
|
|
10
|
+
Requires-Dist: tqdm
|
|
11
|
+
Requires-Dist: termcolor
|
|
12
|
+
Project-URL: Homepage, https://github.com/Den-Ram/SnakeScan
|
|
13
|
+
Project-URL: Repository, https://github.com/Den-Ram/SnakeScan
|
|
14
|
+
|
|
15
|
+
# SnakeScan
|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+
```
|
|
20
|
+
import SnakeScan
|
|
21
|
+
SnakeScan.run()
|
|
22
|
+
```
|
|
23
|
+
## Help
|
|
24
|
+
- -l need internet to view public ip you device
|
|
25
|
+
- -t threading port search
|
|
26
|
+
- -s single port search
|
|
27
|
+
- -i information about host
|
|
28
|
+
- -help in host /-help port in host
|
|
29
|
+
- -check [host] scan subnet in ip
|
|
30
|
+
- exit in host or port off script
|
|
31
|
+
## Added class Watcher:
|
|
32
|
+
```
|
|
33
|
+
for SnakeScan import Watcher
|
|
34
|
+
Watcher(host:str,port:int)
|
|
35
|
+
```
|
|
36
|
+
## Added multiple use Watcher:
|
|
37
|
+
```
|
|
38
|
+
from SnakeScan import Watcher
|
|
39
|
+
ports=[53,80,100,160]
|
|
40
|
+
for i in range(len(ports)):
|
|
41
|
+
Watcher("127.0.0.1",ports[i])
|
|
42
|
+
```
|
|
43
|
+
## Added CLI command line use
|
|
44
|
+
```
|
|
45
|
+
usage: Snake [-h] [-sp] [-v] [-i] [-p PORTS] [-s SINGLE]
|
|
46
|
+
[-t] [-ch] [-l]
|
|
47
|
+
[host]
|
|
48
|
+
|
|
49
|
+
Snake - It's a command line module SnakeScan. Use him for
|
|
50
|
+
more fast starting
|
|
51
|
+
|
|
52
|
+
positional arguments:
|
|
53
|
+
host
|
|
54
|
+
|
|
55
|
+
options:
|
|
56
|
+
-h, --help show this help message and exit
|
|
57
|
+
-sp, --speed speed scan
|
|
58
|
+
-v, --version version
|
|
59
|
+
-i, --info ip info
|
|
60
|
+
-p, --ports PORTS ports
|
|
61
|
+
-s, --single SINGLE single scan
|
|
62
|
+
-t, --thread fast scan
|
|
63
|
+
-ch, --check scan subnet
|
|
64
|
+
-l, --local view you public ip - need internet
|
|
65
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
|
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
|
+
```
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import socket
|
|
3
|
+
import ipaddress
|
|
4
|
+
from concurrent.futures import ProcessPoolExecutor
|
|
5
|
+
from tqdm import tqdm
|
|
6
|
+
from termcolor import colored
|
|
7
|
+
from threading import Thread
|
|
8
|
+
from SnakeScan.Check_subnet import Check_network
|
|
9
|
+
from SnakeScan.PoolExecutor import PoolProcessExecutor
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
main()
|
|
17
|
+
OpenPorts = []
|
|
18
|
+
threads = []
|
|
19
|
+
portsopen = 0
|
|
20
|
+
portsclosed = 0
|
|
21
|
+
Bool = True
|
|
22
|
+
boolsd = True
|
|
23
|
+
boolean = 0
|
|
24
|
+
ports = {
|
|
25
|
+
20: "FTP-DATA",
|
|
26
|
+
21: "FTP",
|
|
27
|
+
22: "SSH",
|
|
28
|
+
23: "Telnet",
|
|
29
|
+
25: "SMTP",
|
|
30
|
+
43: "WHOIS",
|
|
31
|
+
53: "DNS",
|
|
32
|
+
67: "DHCP",
|
|
33
|
+
68: "DHCP",
|
|
34
|
+
69: "TFTP",
|
|
35
|
+
80: "http",
|
|
36
|
+
110: "POP3",
|
|
37
|
+
115: "SFTP",
|
|
38
|
+
123: "NTP",
|
|
39
|
+
139: "NetBios",
|
|
40
|
+
143: "IMAP",
|
|
41
|
+
161: "SNMP",
|
|
42
|
+
179: "BGP",
|
|
43
|
+
443: "HTTPS",
|
|
44
|
+
445: "MICROSOFT-DS",
|
|
45
|
+
465: "SSL/TLS",
|
|
46
|
+
514: "SYSLOG",
|
|
47
|
+
515: "PRINTER",
|
|
48
|
+
554: "RTSP",
|
|
49
|
+
587: "TLS/STARTTLS",
|
|
50
|
+
993: "IMAPS",
|
|
51
|
+
995: "POP3S",
|
|
52
|
+
1080: "SOCKS",
|
|
53
|
+
1194: "OpenVPN",
|
|
54
|
+
1433: "SQL Server",
|
|
55
|
+
1723: "PPTP",
|
|
56
|
+
2222: "SSH",
|
|
57
|
+
3128: "HTTP",
|
|
58
|
+
3268: "LDAP",
|
|
59
|
+
3306: "MySQL",
|
|
60
|
+
3389: "RDP",
|
|
61
|
+
5432: "PostgreSQL",
|
|
62
|
+
5900: "VNC",
|
|
63
|
+
8080: "Tomcat",
|
|
64
|
+
10000: "Webmin",
|
|
65
|
+
}
|
|
66
|
+
__version__ = "1.5.9"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def is_port_open(host, port):
|
|
70
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
71
|
+
try:
|
|
72
|
+
s.settimeout(1)
|
|
73
|
+
s.connect((host, port))
|
|
74
|
+
except (OSError, socket.timeout):
|
|
75
|
+
return False
|
|
76
|
+
else:
|
|
77
|
+
return True
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def is_port_open_threads(host, port):
|
|
81
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
82
|
+
try:
|
|
83
|
+
s.settimeout(1)
|
|
84
|
+
s.connect((host, port))
|
|
85
|
+
except (OSError, socket.timeout):
|
|
86
|
+
try:
|
|
87
|
+
print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
|
|
88
|
+
except:
|
|
89
|
+
print(f"Closed{colored('|X|','red')}-->|{port}|")
|
|
90
|
+
else:
|
|
91
|
+
print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def SnakeArgs():
|
|
95
|
+
parser = argparse.ArgumentParser(
|
|
96
|
+
description="Snake - It's a command line module SnakeScan. Use him for more fast starting"
|
|
97
|
+
)
|
|
98
|
+
parser.add_argument("host", nargs="?", default="None")
|
|
99
|
+
parser.add_argument("-sp", "--speed", action="store_true", help="speed scan")
|
|
100
|
+
parser.add_argument("-v", "--version", action="store_true", help="version")
|
|
101
|
+
parser.add_argument("-i", "--info", action="store_true", help="ip info")
|
|
102
|
+
parser.add_argument("-p", "--ports", help="ports")
|
|
103
|
+
parser.add_argument("-s", "--single", help="single scan")
|
|
104
|
+
parser.add_argument("-t", "--thread", action="store_true", help="fast scan")
|
|
105
|
+
parser.add_argument("-ch", "--check", action="store_true", help="scan subnet")
|
|
106
|
+
parser.add_argument(
|
|
107
|
+
"-l",
|
|
108
|
+
"--local",
|
|
109
|
+
action="store_true",
|
|
110
|
+
help="view you public ip - need internet",
|
|
111
|
+
)
|
|
112
|
+
args = parser.parse_args()
|
|
113
|
+
return args
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
port_user = SnakeArgs().ports
|
|
117
|
+
host = SnakeArgs().host
|
|
118
|
+
if host == "None":
|
|
119
|
+
host = "localhost"
|
|
120
|
+
if SnakeArgs().ports:
|
|
121
|
+
try:
|
|
122
|
+
length = int(port_user)
|
|
123
|
+
except:
|
|
124
|
+
port_user = "100"
|
|
125
|
+
print(f"{colored('[!]','red')}Port:invalid value")
|
|
126
|
+
for i in range(0, len(port_user)):
|
|
127
|
+
if port_user[i] == " ":
|
|
128
|
+
port_user = 100
|
|
129
|
+
port_user = int(port_user)
|
|
130
|
+
length = port_user
|
|
131
|
+
length = int(length) + 1
|
|
132
|
+
for port in tqdm(range(1, length)):
|
|
133
|
+
if is_port_open(host, port):
|
|
134
|
+
for name in ports:
|
|
135
|
+
if port == name:
|
|
136
|
+
OpenPorts = [port]
|
|
137
|
+
portsopen += 1
|
|
138
|
+
else:
|
|
139
|
+
portsclosed += 1
|
|
140
|
+
if port_user != "":
|
|
141
|
+
if int(port_user) == port:
|
|
142
|
+
if port_user == "":
|
|
143
|
+
pass
|
|
144
|
+
elif int(port_user) == port:
|
|
145
|
+
if is_port_open(host, port):
|
|
146
|
+
Bool = True
|
|
147
|
+
boolean += 1
|
|
148
|
+
else:
|
|
149
|
+
Bool = False
|
|
150
|
+
if boolean == 1:
|
|
151
|
+
pass
|
|
152
|
+
for i in OpenPorts:
|
|
153
|
+
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
154
|
+
print(f"{host}".center(60, "-"))
|
|
155
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
156
|
+
portsclosed = 0
|
|
157
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
158
|
+
portsopen = 0
|
|
159
|
+
print("-" * 60)
|
|
160
|
+
if "http://" in host:
|
|
161
|
+
host = host.strip()
|
|
162
|
+
host = host.split("http:")
|
|
163
|
+
host = host.strip("//")
|
|
164
|
+
for i in range(len(host)):
|
|
165
|
+
if host[i] == "/":
|
|
166
|
+
host = host[0:i]
|
|
167
|
+
if "https://" in host:
|
|
168
|
+
host = host.strip()
|
|
169
|
+
host = host.strip("https:")
|
|
170
|
+
host = host.strip("//")
|
|
171
|
+
for i in range(len(host)):
|
|
172
|
+
if host[i] == "/":
|
|
173
|
+
host = host[0:i]
|
|
174
|
+
if host == "None":
|
|
175
|
+
host = "localhost"
|
|
176
|
+
if SnakeArgs().check:
|
|
177
|
+
Check_network(host)
|
|
178
|
+
if SnakeArgs().single:
|
|
179
|
+
port_user = SnakeArgs().single.split(",")
|
|
180
|
+
|
|
181
|
+
port_list = port_user
|
|
182
|
+
port_user = []
|
|
183
|
+
for i in range(len(port_list)):
|
|
184
|
+
try:
|
|
185
|
+
port_user.append(int(port_list[i]))
|
|
186
|
+
except:
|
|
187
|
+
print(f"{port_list[i]}-->Invalid value")
|
|
188
|
+
|
|
189
|
+
for port in range(len(port_user)):
|
|
190
|
+
if is_port_open(host, port_user[port]):
|
|
191
|
+
print(
|
|
192
|
+
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
193
|
+
)
|
|
194
|
+
else:
|
|
195
|
+
try:
|
|
196
|
+
print(
|
|
197
|
+
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
198
|
+
)
|
|
199
|
+
except:
|
|
200
|
+
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
201
|
+
if SnakeArgs().local:
|
|
202
|
+
local = ""
|
|
203
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
204
|
+
try:
|
|
205
|
+
s.connect(("10.255.255.255", 1))
|
|
206
|
+
local = s.getsockname()[0]
|
|
207
|
+
except Exception as e:
|
|
208
|
+
local = f"127.0.0.1:{e}"
|
|
209
|
+
finally:
|
|
210
|
+
s.close()
|
|
211
|
+
print(local)
|
|
212
|
+
if SnakeArgs().info:
|
|
213
|
+
if host == "None":
|
|
214
|
+
host = "localhost"
|
|
215
|
+
host = host.strip("-i").strip()
|
|
216
|
+
print("".center(60, "-"))
|
|
217
|
+
try:
|
|
218
|
+
host = socket.gethostbyname(host)
|
|
219
|
+
except Exception as e:
|
|
220
|
+
print(e)
|
|
221
|
+
print("".center(60, "^"))
|
|
222
|
+
print("".center(60, "-"))
|
|
223
|
+
|
|
224
|
+
hosting = ""
|
|
225
|
+
hosting = host.split(".")
|
|
226
|
+
hosting[len(hosting) - 1] = "0"
|
|
227
|
+
network = ""
|
|
228
|
+
for i in range(len(hosting) - 1):
|
|
229
|
+
network += hosting[i] + "."
|
|
230
|
+
network += "0"
|
|
231
|
+
network += "/24"
|
|
232
|
+
hosting = network
|
|
233
|
+
ip_obj = ipaddress.ip_address(host)
|
|
234
|
+
print(f"Type IP: {type(ip_obj)}")
|
|
235
|
+
print(f"Version IP: {ip_obj.version}")
|
|
236
|
+
network_obj = ipaddress.ip_network(network)
|
|
237
|
+
print(f"Network: {network_obj}")
|
|
238
|
+
print(f"Subnet mask: {network_obj.netmask}")
|
|
239
|
+
try:
|
|
240
|
+
hostname = socket.gethostbyaddr(host)
|
|
241
|
+
print(f"Host:{hostname[0]}")
|
|
242
|
+
except:
|
|
243
|
+
hostname = "Undefined"
|
|
244
|
+
print(f"Host:{hostname}")
|
|
245
|
+
try:
|
|
246
|
+
print(f"IP:{socket.gethostbyname(host)}")
|
|
247
|
+
except Exception as e:
|
|
248
|
+
print(f"IP:{e}")
|
|
249
|
+
|
|
250
|
+
finally:
|
|
251
|
+
print("".center(60, "-"))
|
|
252
|
+
if SnakeArgs().thread:
|
|
253
|
+
print(f"Thread".center(60, "-"))
|
|
254
|
+
PoolProcessExecutor(host)
|
|
255
|
+
for port in ports.keys():
|
|
256
|
+
t = Thread(
|
|
257
|
+
target=is_port_open_threads,
|
|
258
|
+
kwargs={"host": host, "port": port},
|
|
259
|
+
)
|
|
260
|
+
threads.append(t)
|
|
261
|
+
t.start()
|
|
262
|
+
for t in threads:
|
|
263
|
+
t.join()
|
|
264
|
+
if SnakeArgs().version:
|
|
265
|
+
print(f"Build_{__version__}")
|
|
266
|
+
if SnakeArgs().speed:
|
|
267
|
+
print(f"ProcessPoolExecutor".center(60, "-"))
|
|
268
|
+
PoolProcessExecutor(host)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import socket
|
|
2
|
+
from termcolor import colored
|
|
3
|
+
from concurrent.futures import ProcessPoolExecutor
|
|
4
|
+
ports = {
|
|
5
|
+
20: "FTP-DATA",
|
|
6
|
+
21: "FTP",
|
|
7
|
+
22: "SSH",
|
|
8
|
+
23: "Telnet",
|
|
9
|
+
25: "SMTP",
|
|
10
|
+
43: "WHOIS",
|
|
11
|
+
53: "DNS",
|
|
12
|
+
67: "DHCP",
|
|
13
|
+
68: "DHCP",
|
|
14
|
+
69: "TFTP",
|
|
15
|
+
80: "http",
|
|
16
|
+
110: "POP3",
|
|
17
|
+
115: "SFTP",
|
|
18
|
+
123: "NTP",
|
|
19
|
+
139: "NetBios",
|
|
20
|
+
143: "IMAP",
|
|
21
|
+
161: "SNMP",
|
|
22
|
+
179: "BGP",
|
|
23
|
+
443: "HTTPS",
|
|
24
|
+
445: "MICROSOFT-DS",
|
|
25
|
+
465: "SSL/TLS",
|
|
26
|
+
514: "SYSLOG",
|
|
27
|
+
515: "PRINTER",
|
|
28
|
+
554: "RTSP",
|
|
29
|
+
587: "TLS/STARTTLS",
|
|
30
|
+
993: "IMAPS",
|
|
31
|
+
995: "POP3S",
|
|
32
|
+
1080: "SOCKS",
|
|
33
|
+
1194: "OpenVPN",
|
|
34
|
+
1433: "SQL Server",
|
|
35
|
+
1723: "PPTP",
|
|
36
|
+
2222: "SSH",
|
|
37
|
+
3128: "HTTP",
|
|
38
|
+
3268: "LDAP",
|
|
39
|
+
3306: "MySQL",
|
|
40
|
+
3389: "RDP",
|
|
41
|
+
5432: "PostgreSQL",
|
|
42
|
+
5900: "VNC",
|
|
43
|
+
8080: "Tomcat",
|
|
44
|
+
10000: "Webmin",
|
|
45
|
+
}
|
|
46
|
+
def is_port_open_threads(host, port):
|
|
47
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
48
|
+
try:
|
|
49
|
+
s.settimeout(1)
|
|
50
|
+
s.connect((host, port))
|
|
51
|
+
except (OSError, socket.timeout):
|
|
52
|
+
try:
|
|
53
|
+
print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
|
|
54
|
+
except:
|
|
55
|
+
print(f"Closed{colored('|X|','red')}-->|{port}|")
|
|
56
|
+
else:
|
|
57
|
+
print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
|
|
58
|
+
def PoolProcessExecutor(host):
|
|
59
|
+
with ProcessPoolExecutor(max_workers=None) as executor:
|
|
60
|
+
try:
|
|
61
|
+
for port in ports.keys():
|
|
62
|
+
future = executor.submit(is_port_open_threads,host,port)
|
|
63
|
+
|
|
64
|
+
except Exception as e:
|
|
65
|
+
print(e)
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
"""Module SnakeScan"""
|
|
2
2
|
|
|
3
|
-
__version__ = "1.5.
|
|
3
|
+
__version__ = "1.5.9"
|
|
4
4
|
import socket
|
|
5
5
|
import ipaddress
|
|
6
6
|
from art import tprint
|
|
7
|
-
from datetime import datetime
|
|
8
7
|
from tqdm import tqdm
|
|
9
8
|
from termcolor import colored
|
|
10
9
|
from threading import Thread
|
|
11
|
-
import threading
|
|
12
10
|
from SnakeScan.Check_subnet import Check_network
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
class Watcher:
|
|
15
14
|
def __init__(self, host, port_user):
|
|
16
15
|
self.host = host
|
|
17
16
|
self.port_user = port_user
|
|
18
|
-
|
|
19
|
-
def run(host,port_user):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
|
|
18
|
+
def run(host, port_user):
|
|
19
|
+
previous = None
|
|
20
|
+
while True:
|
|
21
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
22
|
+
connection = sock.connect_ex((host, port_user))
|
|
23
|
+
if previous != connection:
|
|
24
|
+
if connection == 0:
|
|
25
|
+
print(f"Service is up {host}-->|{port_user}|")
|
|
26
|
+
else:
|
|
27
|
+
print(f"Service is down {host}-->|{port_user}|")
|
|
28
|
+
previous = connection
|
|
29
|
+
|
|
30
|
+
w = Thread(target=run, kwargs={"host": self.host, "port_user": self.port_user})
|
|
32
31
|
w.start()
|
|
33
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
34
|
def run():
|
|
35
35
|
portsopen = 0
|
|
36
36
|
portsclosed = 0
|
|
@@ -113,26 +113,26 @@ def run():
|
|
|
113
113
|
print("–" * 60)
|
|
114
114
|
while Run_now:
|
|
115
115
|
host = input(f"{colored('[$]','green')}Host-->")
|
|
116
|
-
if "
|
|
117
|
-
host = host.strip("
|
|
116
|
+
if "-check" in host:
|
|
117
|
+
host = host.strip("-check")
|
|
118
118
|
host = host.strip()
|
|
119
119
|
Check_network(host)
|
|
120
120
|
continue
|
|
121
|
-
if "
|
|
121
|
+
if "-v" in host:
|
|
122
122
|
print(f"Build_{__version__}")
|
|
123
123
|
continue
|
|
124
|
-
if "
|
|
125
|
-
host = host.strip("
|
|
124
|
+
if "-help" in host:
|
|
125
|
+
host = host.strip("-help")
|
|
126
126
|
host = host.strip()
|
|
127
127
|
if host == "port":
|
|
128
|
-
print("Port
|
|
128
|
+
print("Port:|-s port,-t|")
|
|
129
129
|
if host:
|
|
130
130
|
pass
|
|
131
131
|
else:
|
|
132
|
-
print("Host:|host
|
|
132
|
+
print("Host:|host -check,host -i,-l,-v|")
|
|
133
133
|
continue
|
|
134
|
-
if "
|
|
135
|
-
host = host.strip("
|
|
134
|
+
if "-i" in host:
|
|
135
|
+
host = host.strip("-i").strip()
|
|
136
136
|
print("".center(60, "-"))
|
|
137
137
|
try:
|
|
138
138
|
host = socket.gethostbyname(host)
|
|
@@ -192,7 +192,7 @@ def run():
|
|
|
192
192
|
host = input(f"{colored('[$]','green')}Host-->")
|
|
193
193
|
if host:
|
|
194
194
|
break
|
|
195
|
-
if "
|
|
195
|
+
if "-l" in host:
|
|
196
196
|
local = ""
|
|
197
197
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
198
198
|
try:
|
|
@@ -218,7 +218,7 @@ def run():
|
|
|
218
218
|
try:
|
|
219
219
|
length = int(port_user)
|
|
220
220
|
except:
|
|
221
|
-
if "
|
|
221
|
+
if "-t" in str(port_user):
|
|
222
222
|
print(f"Thread".center(60, "-"))
|
|
223
223
|
for port in ports.keys():
|
|
224
224
|
t = Thread(
|
|
@@ -229,8 +229,8 @@ def run():
|
|
|
229
229
|
t.start()
|
|
230
230
|
for t in threads:
|
|
231
231
|
t.join()
|
|
232
|
-
if "
|
|
233
|
-
port_user = port_single.strip("
|
|
232
|
+
if "-s" in str(port_user):
|
|
233
|
+
port_user = port_single.strip("-s")
|
|
234
234
|
port_user = port_user.split()
|
|
235
235
|
port_list = port_user
|
|
236
236
|
port_user = []
|
|
@@ -258,7 +258,7 @@ def run():
|
|
|
258
258
|
continue
|
|
259
259
|
|
|
260
260
|
else:
|
|
261
|
-
if "
|
|
261
|
+
if "-t" in port_user:
|
|
262
262
|
continue
|
|
263
263
|
port_user = "100"
|
|
264
264
|
print(f"{colored('[!]','red')}Port:invalid value")
|
|
@@ -273,7 +273,7 @@ def run():
|
|
|
273
273
|
port_user = 100
|
|
274
274
|
length = port_user
|
|
275
275
|
print(f"{colored('|!|','red')}Listening {host} please wait...")
|
|
276
|
-
#
|
|
276
|
+
# |----------------starting---------------------|
|
|
277
277
|
length = int(length) + 1
|
|
278
278
|
for port in tqdm(range(1, length)):
|
|
279
279
|
if is_port_open(host, port):
|
snakescan-1.5.7/PKG-INFO
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: SnakeScan
|
|
3
|
-
Version: 1.5.7
|
|
4
|
-
Summary: Module SnakeScan
|
|
5
|
-
Author: Den*Ram
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
License-Expression: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: art
|
|
10
|
-
Requires-Dist: tqdm
|
|
11
|
-
Requires-Dist: termcolor
|
|
12
|
-
Project-URL: Homepage, https://github.com/Den-Ram/SnakeScan
|
|
13
|
-
Project-URL: Repository, https://github.com/Den-Ram/SnakeScan
|
|
14
|
-
|
|
15
|
-
# SnakeScan
|
|
16
|
-

|
|
17
|
-

|
|
18
|
-

|
|
19
|
-
```
|
|
20
|
-
import SnakeScan
|
|
21
|
-
SnakeScan.run()
|
|
22
|
-
```
|
|
23
|
-
## Help
|
|
24
|
-
- --l need internet to view public ip you device
|
|
25
|
-
- --t threading port search
|
|
26
|
-
- --s single port search
|
|
27
|
-
- --i information about host
|
|
28
|
-
- --h in host /--h port in host
|
|
29
|
-
- --check [host] scan subnet in ip
|
|
30
|
-
- exit in host or port off script
|
|
31
|
-
## Added class Watcher:
|
|
32
|
-
```
|
|
33
|
-
for SnakeScan import Watcher
|
|
34
|
-
Watcher(host:str,port:int)
|
|
35
|
-
```
|
|
36
|
-
## Added multiple use Watcher:
|
|
37
|
-
```
|
|
38
|
-
from SnakeScan import Watcher
|
|
39
|
-
ports=[53,80,100,160]
|
|
40
|
-
for i in range(len(ports)):
|
|
41
|
-
Watcher("127.0.0.1",ports[i])
|
|
42
|
-
|
|
43
|
-
```
|
snakescan-1.5.7/README.md
DELETED
|
@@ -1,29 +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
|
-
- --h in host /--h 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
|
-
```
|
|
File without changes
|