SnakeScan 1.5.3__tar.gz → 1.5.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.5.3 → snakescan-1.5.4}/PKG-INFO +3 -4
- {snakescan-1.5.3 → snakescan-1.5.4}/README.md +3 -4
- snakescan-1.5.4/SnakeScan/Check_subnet.py +58 -0
- snakescan-1.5.4/SnakeScan/__init__.py +309 -0
- snakescan-1.5.3/SnakeScan/__init__.py +0 -327
- {snakescan-1.5.3 → snakescan-1.5.4}/LICENSE +0 -0
- {snakescan-1.5.3 → snakescan-1.5.4}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SnakeScan
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.4
|
|
4
4
|
Summary: Module SnakeScan
|
|
5
5
|
Author: Den*Ram
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -23,14 +23,13 @@ SnakeScan.run()
|
|
|
23
23
|
## Help
|
|
24
24
|
- --l need internet to view public ip you device
|
|
25
25
|
- --t threading port search
|
|
26
|
-
- --d dos
|
|
27
26
|
- --s single port search
|
|
28
27
|
- --i information about host
|
|
29
28
|
- --h in host /--h port in host
|
|
29
|
+
- --ch [host] scan subnet in ip
|
|
30
|
+
- exit in host or port off script
|
|
30
31
|
## Added class Watcher:
|
|
31
32
|
```
|
|
32
33
|
for SnakeScan import Watcher
|
|
33
34
|
Watcher(host:str,port:int)
|
|
34
35
|
```
|
|
35
|
-
## Changelog
|
|
36
|
-
v1.5.3-Added more fast threading scan
|
|
@@ -9,14 +9,13 @@ SnakeScan.run()
|
|
|
9
9
|
## Help
|
|
10
10
|
- --l need internet to view public ip you device
|
|
11
11
|
- --t threading port search
|
|
12
|
-
- --d dos
|
|
13
12
|
- --s single port search
|
|
14
13
|
- --i information about host
|
|
15
14
|
- --h in host /--h port in host
|
|
15
|
+
- --ch [host] scan subnet in ip
|
|
16
|
+
- exit in host or port off script
|
|
16
17
|
## Added class Watcher:
|
|
17
18
|
```
|
|
18
19
|
for SnakeScan import Watcher
|
|
19
20
|
Watcher(host:str,port:int)
|
|
20
|
-
```
|
|
21
|
-
## Changelog
|
|
22
|
-
v1.5.3-Added more fast threading scan
|
|
21
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import ipaddress
|
|
2
|
+
import subprocess
|
|
3
|
+
import platform
|
|
4
|
+
from threading import Thread
|
|
5
|
+
import socket
|
|
6
|
+
from termcolor import colored
|
|
7
|
+
|
|
8
|
+
global threads
|
|
9
|
+
threads = []
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def Check_network(host):
|
|
13
|
+
def check_host(host):
|
|
14
|
+
try:
|
|
15
|
+
if platform.system().lower() == "windows":
|
|
16
|
+
command = ["ping", "-n", "1", str(host)]
|
|
17
|
+
else:
|
|
18
|
+
command = ["ping", "-c", "1", str(host)]
|
|
19
|
+
result = subprocess.run(
|
|
20
|
+
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
|
|
21
|
+
)
|
|
22
|
+
if result.returncode == 0:
|
|
23
|
+
print(f"{ip}-->{colored('|√|','green')}")
|
|
24
|
+
return True
|
|
25
|
+
else:
|
|
26
|
+
print(f"{ip}-->{colored('|X|','red')}")
|
|
27
|
+
return False
|
|
28
|
+
except Exception as e:
|
|
29
|
+
print(f"Check error {ip}: {e}")
|
|
30
|
+
return False
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
print("".center(60, "-"))
|
|
34
|
+
try:
|
|
35
|
+
host = socket.gethostbyname(host)
|
|
36
|
+
except Exception as e:
|
|
37
|
+
print(e)
|
|
38
|
+
print("".center(60, "^"))
|
|
39
|
+
print("".center(60, "-"))
|
|
40
|
+
hosting = ""
|
|
41
|
+
hosting = host.split(".")
|
|
42
|
+
hosting[len(hosting) - 1] = "0"
|
|
43
|
+
network = ""
|
|
44
|
+
for i in range(len(hosting) - 1):
|
|
45
|
+
network += hosting[i] + "."
|
|
46
|
+
network += "0"
|
|
47
|
+
network += "/24"
|
|
48
|
+
network_str = network
|
|
49
|
+
network = ipaddress.ip_network(network_str)
|
|
50
|
+
print(f"Checking the IP addresses in the subset {network_str}...")
|
|
51
|
+
for ip in network.hosts():
|
|
52
|
+
t = Thread(target=check_host, kwargs={"host": host})
|
|
53
|
+
t.start()
|
|
54
|
+
threads.append(t)
|
|
55
|
+
for t in threads:
|
|
56
|
+
t.join()
|
|
57
|
+
except ValueError as e:
|
|
58
|
+
print(f"Ошибка при создании объекта сети: {e}")
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"""Module SnakeScan"""
|
|
2
|
+
|
|
3
|
+
__version__ = "1.5.4"
|
|
4
|
+
import socket
|
|
5
|
+
import ipaddress
|
|
6
|
+
from art import tprint
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from tqdm import tqdm
|
|
9
|
+
from termcolor import colored
|
|
10
|
+
from threading import Thread, Timer
|
|
11
|
+
from SnakeScan.Check_subnet import Check_network
|
|
12
|
+
|
|
13
|
+
next = None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Watcher:
|
|
17
|
+
def __init__(self, host, port_user, sleep=0.5):
|
|
18
|
+
self.host = host
|
|
19
|
+
self.port_user = port_user
|
|
20
|
+
self.sleep = sleep
|
|
21
|
+
global next
|
|
22
|
+
Timer(sleep, Watcher, kwargs={"host": host, "port_user": port_user}).start()
|
|
23
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
24
|
+
connection = sock.connect_ex((host, port_user))
|
|
25
|
+
if next != connection:
|
|
26
|
+
if connection == 0:
|
|
27
|
+
print(f"Service is up {host}-->|{port_user}|")
|
|
28
|
+
else:
|
|
29
|
+
print(f"Service is down {host}-->|{port_user}|")
|
|
30
|
+
next = connection
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def run():
|
|
34
|
+
portsopen = 0
|
|
35
|
+
portsclosed = 0
|
|
36
|
+
Run_now = True
|
|
37
|
+
Bool = True
|
|
38
|
+
boolsd = True
|
|
39
|
+
global num
|
|
40
|
+
num = 0
|
|
41
|
+
boolean = 0
|
|
42
|
+
OpenPorts = []
|
|
43
|
+
threading = []
|
|
44
|
+
ports = {
|
|
45
|
+
20: "FTP-DATA",
|
|
46
|
+
21: "FTP",
|
|
47
|
+
22: "SSH",
|
|
48
|
+
23: "Telnet",
|
|
49
|
+
25: "SMTP",
|
|
50
|
+
43: "WHOIS",
|
|
51
|
+
53: "DNS",
|
|
52
|
+
67: "DHCP",
|
|
53
|
+
68: "DHCP",
|
|
54
|
+
69: "TFTP",
|
|
55
|
+
80: "http",
|
|
56
|
+
110: "POP3",
|
|
57
|
+
115: "SFTP",
|
|
58
|
+
123: "NTP",
|
|
59
|
+
139: "NetBios",
|
|
60
|
+
143: "IMAP",
|
|
61
|
+
161: "SNMP",
|
|
62
|
+
179: "BGP",
|
|
63
|
+
443: "HTTPS",
|
|
64
|
+
445: "MICROSOFT-DS",
|
|
65
|
+
465: "SSL/TLS",
|
|
66
|
+
514: "SYSLOG",
|
|
67
|
+
515: "PRINTER",
|
|
68
|
+
554: "RTSP",
|
|
69
|
+
587: "TLS/STARTTLS",
|
|
70
|
+
993: "IMAPS",
|
|
71
|
+
995: "POP3S",
|
|
72
|
+
1080: "SOCKS",
|
|
73
|
+
1194: "OpenVPN",
|
|
74
|
+
1433: "SQL Server",
|
|
75
|
+
1723: "PPTP",
|
|
76
|
+
2222: "SSH",
|
|
77
|
+
3128: "HTTP",
|
|
78
|
+
3268: "LDAP",
|
|
79
|
+
3306: "MySQL",
|
|
80
|
+
3389: "RDP",
|
|
81
|
+
5432: "PostgreSQL",
|
|
82
|
+
5900: "VNC",
|
|
83
|
+
8080: "Tomcat",
|
|
84
|
+
10000: "Webmin",
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
def is_port_open(host, port):
|
|
88
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
89
|
+
try:
|
|
90
|
+
s.settimeout(1)
|
|
91
|
+
s.connect((host, port))
|
|
92
|
+
except:
|
|
93
|
+
s.close()
|
|
94
|
+
return False
|
|
95
|
+
else:
|
|
96
|
+
s.close()
|
|
97
|
+
return True
|
|
98
|
+
|
|
99
|
+
def is_port_open_threads(host, port):
|
|
100
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
101
|
+
try:
|
|
102
|
+
s.settimeout(1)
|
|
103
|
+
s.connect((host, port))
|
|
104
|
+
except:
|
|
105
|
+
s.close()
|
|
106
|
+
try:
|
|
107
|
+
print(f"Closed{colored('|X|','red')}-->{ports[all]}|{all}|")
|
|
108
|
+
except:
|
|
109
|
+
print(f"Closed{colored('|X|','red')}-->|{all}|")
|
|
110
|
+
finally:
|
|
111
|
+
s.close()
|
|
112
|
+
else:
|
|
113
|
+
print(f"Open{colored('|√|','green')}-->{ports[all]}|{all}|")
|
|
114
|
+
|
|
115
|
+
print("–" * 60)
|
|
116
|
+
tprint("SnakeScan")
|
|
117
|
+
print("–" * 60)
|
|
118
|
+
while Run_now:
|
|
119
|
+
host = input(f"{colored('[$]','green')}Host-->")
|
|
120
|
+
if "--ch" in host:
|
|
121
|
+
host = host.strip("--ch")
|
|
122
|
+
host = host.strip()
|
|
123
|
+
Check_network(host)
|
|
124
|
+
continue
|
|
125
|
+
if "--v" in host:
|
|
126
|
+
print(f"Build_{__version__}")
|
|
127
|
+
continue
|
|
128
|
+
if "--h" in host:
|
|
129
|
+
host = host.strip("--h")
|
|
130
|
+
host = host.strip()
|
|
131
|
+
if host == "port":
|
|
132
|
+
print("Port:|--s port,--t|")
|
|
133
|
+
if host:
|
|
134
|
+
pass
|
|
135
|
+
else:
|
|
136
|
+
print("Host:|host --i,--l|")
|
|
137
|
+
continue
|
|
138
|
+
if "--i" in host:
|
|
139
|
+
host = host.strip("--i").strip()
|
|
140
|
+
print("".center(60, "-"))
|
|
141
|
+
try:
|
|
142
|
+
host = socket.gethostbyname(host)
|
|
143
|
+
except Exception as e:
|
|
144
|
+
print(e)
|
|
145
|
+
print("".center(60, "^"))
|
|
146
|
+
print("".center(60, "-"))
|
|
147
|
+
continue
|
|
148
|
+
hosting = ""
|
|
149
|
+
hosting = host.split(".")
|
|
150
|
+
hosting[len(hosting) - 1] = "0"
|
|
151
|
+
network = ""
|
|
152
|
+
for i in range(len(hosting) - 1):
|
|
153
|
+
network += hosting[i] + "."
|
|
154
|
+
network += "0"
|
|
155
|
+
network += "/24"
|
|
156
|
+
hosting = network
|
|
157
|
+
ip_obj = ipaddress.ip_address(host)
|
|
158
|
+
print(f"Type IP: {type(ip_obj)}")
|
|
159
|
+
print(f"Version IP: {ip_obj.version}")
|
|
160
|
+
network_obj = ipaddress.ip_network(network)
|
|
161
|
+
print(f"Network: {network_obj}")
|
|
162
|
+
print(f"Subnet mask: {network_obj.netmask}")
|
|
163
|
+
try:
|
|
164
|
+
hostname = socket.gethostbyaddr(host)
|
|
165
|
+
print(f"Host:{hostname[0]}")
|
|
166
|
+
except:
|
|
167
|
+
hostname = "Undefined"
|
|
168
|
+
print(f"Host:{hostname}")
|
|
169
|
+
try:
|
|
170
|
+
print(f"IP:{socket.gethostbyname(host)}")
|
|
171
|
+
except Exception as e:
|
|
172
|
+
print(f"IP:{e}")
|
|
173
|
+
continue
|
|
174
|
+
finally:
|
|
175
|
+
print("".center(60, "-"))
|
|
176
|
+
continue
|
|
177
|
+
if "http://" in host:
|
|
178
|
+
host = host.strip()
|
|
179
|
+
host = host.split("http:")
|
|
180
|
+
host = host.strip("//")
|
|
181
|
+
for i in range(len(host)):
|
|
182
|
+
if host[i] == "/":
|
|
183
|
+
host = host[0:i]
|
|
184
|
+
if "https://" in host:
|
|
185
|
+
host = host.strip()
|
|
186
|
+
host = host.strip("https:")
|
|
187
|
+
host = host.strip("//")
|
|
188
|
+
for i in range(len(host)):
|
|
189
|
+
if host[i] == "/":
|
|
190
|
+
host = host[0:i]
|
|
191
|
+
if host == "Exit".lower():
|
|
192
|
+
break
|
|
193
|
+
if host == "":
|
|
194
|
+
while True:
|
|
195
|
+
print(f"{colored('Host','green')}{colored('[X]:Empty value','red')}")
|
|
196
|
+
host = input(f"{colored('[$]','green')}Host-->")
|
|
197
|
+
if host:
|
|
198
|
+
break
|
|
199
|
+
if "--l" in host:
|
|
200
|
+
local = ""
|
|
201
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
202
|
+
try:
|
|
203
|
+
s.connect(("10.255.255.255", 1))
|
|
204
|
+
local = s.getsockname()[0]
|
|
205
|
+
except Exception as e:
|
|
206
|
+
local = f"127.0.0.1:{e}"
|
|
207
|
+
finally:
|
|
208
|
+
s.close()
|
|
209
|
+
print(local)
|
|
210
|
+
continue
|
|
211
|
+
port_user = input(f"{colored('[$]','green')}Port-->")
|
|
212
|
+
if port_user == "":
|
|
213
|
+
while True:
|
|
214
|
+
print(f"{colored('Port','green')}{colored('[X]:Empty value','red')}")
|
|
215
|
+
port_user = input(f"{colored('[$]','green')}Port-->")
|
|
216
|
+
if port_user:
|
|
217
|
+
break
|
|
218
|
+
port_single = port_user
|
|
219
|
+
if port_user == "Exit".lower():
|
|
220
|
+
break
|
|
221
|
+
if port_user:
|
|
222
|
+
try:
|
|
223
|
+
length = int(port_user)
|
|
224
|
+
except:
|
|
225
|
+
if "--t" in str(port_user):
|
|
226
|
+
print(f"Thread".center(60, "-"))
|
|
227
|
+
for all in ports.keys():
|
|
228
|
+
t = Thread(
|
|
229
|
+
target=is_port_open_threads,
|
|
230
|
+
kwargs={"host": host, "port": all},
|
|
231
|
+
)
|
|
232
|
+
threading.append(t)
|
|
233
|
+
t.start()
|
|
234
|
+
for t in threading:
|
|
235
|
+
t.join()
|
|
236
|
+
if "--s" in str(port_user):
|
|
237
|
+
port_user = port_single.strip("--s")
|
|
238
|
+
port_user = port_user.split()
|
|
239
|
+
port_list = port_user
|
|
240
|
+
port_user = []
|
|
241
|
+
for i in range(len(port_list)):
|
|
242
|
+
try:
|
|
243
|
+
port_user.append(int(port_list[i]))
|
|
244
|
+
except:
|
|
245
|
+
print(f"{port_list[i]}-->Invalid value")
|
|
246
|
+
break
|
|
247
|
+
for port in range(len(port_user)):
|
|
248
|
+
if is_port_open(host, port_user[port]):
|
|
249
|
+
print(
|
|
250
|
+
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
251
|
+
)
|
|
252
|
+
else:
|
|
253
|
+
try:
|
|
254
|
+
print(
|
|
255
|
+
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
256
|
+
)
|
|
257
|
+
except:
|
|
258
|
+
print(
|
|
259
|
+
f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|"
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
continue
|
|
263
|
+
|
|
264
|
+
else:
|
|
265
|
+
if "--t" in port_user:
|
|
266
|
+
continue
|
|
267
|
+
port_user = "100"
|
|
268
|
+
print(f"{colored('[!]','red')}Port:invalid value")
|
|
269
|
+
for i in range(0, len(port_user)):
|
|
270
|
+
if port_user[i] == " ":
|
|
271
|
+
port_user = 100
|
|
272
|
+
break
|
|
273
|
+
port_user = int(port_user)
|
|
274
|
+
length = port_user
|
|
275
|
+
else:
|
|
276
|
+
print(f"{colored('|*|','blue')}100")
|
|
277
|
+
port_user = 100
|
|
278
|
+
length = port_user
|
|
279
|
+
print(f"{colored('|!|','red')}Listening {host} please wait...")
|
|
280
|
+
# |-----------------Starting---------------------|
|
|
281
|
+
length = int(length) + 1
|
|
282
|
+
for port in tqdm(range(1, length)):
|
|
283
|
+
if is_port_open(host, port):
|
|
284
|
+
for name in ports:
|
|
285
|
+
if port == name:
|
|
286
|
+
OpenPorts = [port]
|
|
287
|
+
portsopen += 1
|
|
288
|
+
else:
|
|
289
|
+
portsclosed += 1
|
|
290
|
+
if port_user != "":
|
|
291
|
+
if int(port_user) == port:
|
|
292
|
+
if port_user == "":
|
|
293
|
+
pass
|
|
294
|
+
elif int(port_user) == port:
|
|
295
|
+
if is_port_open(host, port):
|
|
296
|
+
Bool = True
|
|
297
|
+
boolean += 1
|
|
298
|
+
else:
|
|
299
|
+
Bool = False
|
|
300
|
+
if boolean == 1:
|
|
301
|
+
pass
|
|
302
|
+
for i in OpenPorts:
|
|
303
|
+
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
304
|
+
print(f"{host}".center(60, "-"))
|
|
305
|
+
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
306
|
+
portsclosed = 0
|
|
307
|
+
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
308
|
+
portsopen = 0
|
|
309
|
+
print("-" * 60)
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
"""Module SnakeScan"""
|
|
2
|
-
__version__="1.5.3"
|
|
3
|
-
import socket
|
|
4
|
-
import ipaddress
|
|
5
|
-
from art import tprint
|
|
6
|
-
from datetime import datetime
|
|
7
|
-
from tqdm import tqdm
|
|
8
|
-
from termcolor import colored
|
|
9
|
-
from threading import Thread, Timer
|
|
10
|
-
next = None
|
|
11
|
-
class Watcher():
|
|
12
|
-
def __init__(self,host,port_user,sleep=0.5):
|
|
13
|
-
self.host=host
|
|
14
|
-
self.port_user=port_user
|
|
15
|
-
self.sleep=sleep
|
|
16
|
-
global next
|
|
17
|
-
Timer(sleep, Watcher,kwargs={"host":host,"port_user":port_user}).start()
|
|
18
|
-
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
19
|
-
connection = sock.connect_ex((host,port_user))
|
|
20
|
-
if next != connection:
|
|
21
|
-
if connection == 0:
|
|
22
|
-
print (f"Service is up {host}-->|{port_user}|")
|
|
23
|
-
else:
|
|
24
|
-
print (f"Service is down {host}-->|{port_user}|")
|
|
25
|
-
next = connection
|
|
26
|
-
def run():
|
|
27
|
-
portsopen=0
|
|
28
|
-
portsclosed=0
|
|
29
|
-
Run_now=True
|
|
30
|
-
Bool=True
|
|
31
|
-
boolsd=True
|
|
32
|
-
global num
|
|
33
|
-
num=0
|
|
34
|
-
boolean=0
|
|
35
|
-
OpenPorts=[]
|
|
36
|
-
threading=[]
|
|
37
|
-
ports = {
|
|
38
|
-
20: "FTP-DATA", 21: "FTP", 22: "SSH", 23: "Telnet",
|
|
39
|
-
25: "SMTP", 43: "WHOIS", 53: "DNS", 67:"DHCP", 68:"DHCP", 69:"TFTP", 80: "http", 110:"POP3",
|
|
40
|
-
115: "SFTP", 123: "NTP", 139:"NetBios", 143: "IMAP", 161: "SNMP",
|
|
41
|
-
179: "BGP", 443: "HTTPS", 445: "MICROSOFT-DS", 465:"SSL/TLS",
|
|
42
|
-
514: "SYSLOG", 515: "PRINTER", 554:"RTSP", 587:"TLS/STARTTLS", 993: "IMAPS",
|
|
43
|
-
995: "POP3S", 1080: "SOCKS", 1194: "OpenVPN",
|
|
44
|
-
1433: "SQL Server", 1723: "PPTP", 2222:"SSH", 3128: "HTTP",
|
|
45
|
-
3268: "LDAP", 3306: "MySQL", 3389: "RDP",
|
|
46
|
-
5432: "PostgreSQL", 5900: "VNC", 8080: "Tomcat", 10000: "Webmin" }
|
|
47
|
-
def is_port_open(host,port):
|
|
48
|
-
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
49
|
-
try:
|
|
50
|
-
s.settimeout(1)
|
|
51
|
-
s.connect((host,port))
|
|
52
|
-
except:
|
|
53
|
-
s.close()
|
|
54
|
-
return False
|
|
55
|
-
else:
|
|
56
|
-
s.close()
|
|
57
|
-
return True
|
|
58
|
-
def dos_threads(host,port,fake_ip):
|
|
59
|
-
host=host.strip("--d")
|
|
60
|
-
host=host.strip()
|
|
61
|
-
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
62
|
-
try:
|
|
63
|
-
s.connect((host,port))
|
|
64
|
-
s.sendto(("GET /"+host+"HTTP/1.1\r\n").encode("ascii"),(host,port))
|
|
65
|
-
s.sendto(("Host: "+fake_ip+"\r\n\r\n").encode("ascii"),(host,port))
|
|
66
|
-
s.close()
|
|
67
|
-
return True
|
|
68
|
-
except:
|
|
69
|
-
s.close()
|
|
70
|
-
return False
|
|
71
|
-
def is_port_open_threads(host,port):
|
|
72
|
-
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
73
|
-
try:
|
|
74
|
-
s.settimeout(1)
|
|
75
|
-
s.connect((host,port))
|
|
76
|
-
except:
|
|
77
|
-
s.close()
|
|
78
|
-
try:
|
|
79
|
-
print(f"Closed{colored('|X|','red')}-->{ports[all]}|{all}|")
|
|
80
|
-
except:
|
|
81
|
-
print(f"Closed{colored('|X|','red')}-->|{all}|")
|
|
82
|
-
finally:
|
|
83
|
-
s.close()
|
|
84
|
-
else:
|
|
85
|
-
print(f"Open{colored('|√|','green')}-->{ports[all]}|{all}|")
|
|
86
|
-
print("–"*60)
|
|
87
|
-
tprint("SnakeScan")
|
|
88
|
-
print("–"*60)
|
|
89
|
-
while Run_now:
|
|
90
|
-
host=input(f"{colored('[$]','green')}Host-->")
|
|
91
|
-
if "--v" in host:
|
|
92
|
-
print(f"Build_{__version__}")
|
|
93
|
-
continue
|
|
94
|
-
if "--h" in host:
|
|
95
|
-
host=host.strip("--h")
|
|
96
|
-
host=host.strip()
|
|
97
|
-
if host == "port":
|
|
98
|
-
print("Port:|--s port,--t|")
|
|
99
|
-
if host:
|
|
100
|
-
pass
|
|
101
|
-
else:
|
|
102
|
-
print("Host:|--l,host --i,host --d|")
|
|
103
|
-
continue
|
|
104
|
-
if "--i" in host:
|
|
105
|
-
host=host.strip("--i").strip()
|
|
106
|
-
print("".center(60,"-"))
|
|
107
|
-
try:
|
|
108
|
-
host=socket.gethostbyname(host)
|
|
109
|
-
except Exception as e:
|
|
110
|
-
print(e)
|
|
111
|
-
print("".center(60,"^"))
|
|
112
|
-
print("".center(60,"-"))
|
|
113
|
-
continue
|
|
114
|
-
hosting=""
|
|
115
|
-
hosting=host.split(".")
|
|
116
|
-
hosting[len(hosting)-1]="0"
|
|
117
|
-
network=""
|
|
118
|
-
for i in range(len(hosting)-1):
|
|
119
|
-
network+=hosting[i]+"."
|
|
120
|
-
network+="0"
|
|
121
|
-
network+="/24"
|
|
122
|
-
hosting=network
|
|
123
|
-
ip_obj = ipaddress.ip_address(host)
|
|
124
|
-
print(f"Type IP: {type(ip_obj)}")
|
|
125
|
-
print(f"Version IP: {ip_obj.version}")
|
|
126
|
-
network_obj = ipaddress.ip_network(network)
|
|
127
|
-
print(f"Network: {network_obj}")
|
|
128
|
-
print(f"Subnet mask: {network_obj.netmask}")
|
|
129
|
-
try:
|
|
130
|
-
hostname=socket.gethostbyaddr(host)
|
|
131
|
-
print(f"Host:{hostname[0]}")
|
|
132
|
-
except:
|
|
133
|
-
hostname="Undefined"
|
|
134
|
-
print(f"Host:{hostname}")
|
|
135
|
-
try:
|
|
136
|
-
print(f"IP:{socket.gethostbyname(host)}")
|
|
137
|
-
except Exception as e:
|
|
138
|
-
print(f"IP:{e}")
|
|
139
|
-
continue
|
|
140
|
-
finally:
|
|
141
|
-
print("".center(60,"-"))
|
|
142
|
-
continue
|
|
143
|
-
if "http://" in host and "--d" in host:
|
|
144
|
-
host=host.strip().strip("--d")
|
|
145
|
-
host=host.split("http:")
|
|
146
|
-
host=host.strip("//")
|
|
147
|
-
host=host+""+"--d"
|
|
148
|
-
for i in range(len(host)):
|
|
149
|
-
if host[i] == "/":
|
|
150
|
-
host=host[0:i]
|
|
151
|
-
if "https://" in host and "--d" in host:
|
|
152
|
-
host=host.strip().strip("--d")
|
|
153
|
-
host=host.strip("https:")
|
|
154
|
-
host=host.strip("//")
|
|
155
|
-
host=host+""+"--d"
|
|
156
|
-
for i in range(len(host)):
|
|
157
|
-
if host[i] == "/":
|
|
158
|
-
host=host[0:i]
|
|
159
|
-
if "http://" in host:
|
|
160
|
-
host=host.strip()
|
|
161
|
-
host=host.split("http:")
|
|
162
|
-
host=host.strip("//")
|
|
163
|
-
for i in range(len(host)):
|
|
164
|
-
if host[i] == "/":
|
|
165
|
-
host=host[0:i]
|
|
166
|
-
if "https://" in host:
|
|
167
|
-
host=host.strip()
|
|
168
|
-
host=host.strip("https:")
|
|
169
|
-
host=host.strip("//")
|
|
170
|
-
for i in range(len(host)):
|
|
171
|
-
if host[i] == "/":
|
|
172
|
-
host=host[0:i]
|
|
173
|
-
if "--d" in host:
|
|
174
|
-
try:
|
|
175
|
-
host=host.strip("--d")
|
|
176
|
-
host=host.strip()
|
|
177
|
-
host=socket.gethostbyname(host)
|
|
178
|
-
host=host+""+"--d"
|
|
179
|
-
except:
|
|
180
|
-
print(f"{host} is not avaible")
|
|
181
|
-
continue
|
|
182
|
-
if "--d" in host:
|
|
183
|
-
try:
|
|
184
|
-
threadsnum=int(input(f"{colored('[$]','green')}Threads-->"))
|
|
185
|
-
dos_port=int(input(f"{colored('[$]','green')}Port-->"))
|
|
186
|
-
fake_ip=input(f"{colored('[$]','green')}Fake_ip-->")
|
|
187
|
-
except:
|
|
188
|
-
while True:
|
|
189
|
-
print(f"{colored('|Threads|Port|','green')}{colored('[X]:Invalid value','red')}")
|
|
190
|
-
|
|
191
|
-
try:
|
|
192
|
-
threadsnum=int(input(f"{colored('[$]','green')}Threads-->"))
|
|
193
|
-
dos_port=int(input(f"{colored('[$]','green')}Port-->"))
|
|
194
|
-
fake_ip=input(f"{colored('[$]','green')}Fake_ip-->")
|
|
195
|
-
|
|
196
|
-
except Exception as error:
|
|
197
|
-
print(f"Error:{error}")
|
|
198
|
-
continue
|
|
199
|
-
if threadsnum:
|
|
200
|
-
break
|
|
201
|
-
for dos in range(0,threadsnum):
|
|
202
|
-
num+=1
|
|
203
|
-
t=Thread(target=dos_threads,kwargs={"host":host,"port":dos_port,"fake_ip":fake_ip})
|
|
204
|
-
t.start()
|
|
205
|
-
if dos_threads(host,dos_port,fake_ip):
|
|
206
|
-
print("Dos-Information".center(60,"-"))
|
|
207
|
-
print(f"{colored('[$]','green')}Threads--> {num} GET/HTTP/1.1")
|
|
208
|
-
num=0
|
|
209
|
-
else:
|
|
210
|
-
try:
|
|
211
|
-
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
212
|
-
host=host.strip("--d")
|
|
213
|
-
host=socket.gethostbyname(host)
|
|
214
|
-
s.connect((host,dos_port))
|
|
215
|
-
except Exception as error:
|
|
216
|
-
print(f"Error:{error}")
|
|
217
|
-
continue
|
|
218
|
-
if host == "Exit" or host == "exit":
|
|
219
|
-
break
|
|
220
|
-
if host == "":
|
|
221
|
-
while True:
|
|
222
|
-
print(f"{colored('Host','green')}{colored('[X]:Empty value','red')}")
|
|
223
|
-
host=input(f"{colored('[$]','green')}Host-->")
|
|
224
|
-
if host:
|
|
225
|
-
break
|
|
226
|
-
if "--l" in host:
|
|
227
|
-
local=""
|
|
228
|
-
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
229
|
-
try:
|
|
230
|
-
s.connect(('10.255.255.255',1))
|
|
231
|
-
local=s.getsockname()[0]
|
|
232
|
-
except Exception as e:
|
|
233
|
-
local=f"127.0.0.1:{e}"
|
|
234
|
-
finally:
|
|
235
|
-
s.close()
|
|
236
|
-
print(local)
|
|
237
|
-
continue
|
|
238
|
-
port_user=input(f"{colored('[$]','green')}Port-->")
|
|
239
|
-
if port_user == "":
|
|
240
|
-
while True:
|
|
241
|
-
print(f"{colored('Port','green')}{colored('[X]:Empty value','red')}")
|
|
242
|
-
port_user=input(f"{colored('[$]','green')}Port-->")
|
|
243
|
-
if port_user:
|
|
244
|
-
break
|
|
245
|
-
port_single=port_user
|
|
246
|
-
if port_user == "Exit" or port_user == "Exit":
|
|
247
|
-
break
|
|
248
|
-
if port_user:
|
|
249
|
-
try:
|
|
250
|
-
length=int(port_user)
|
|
251
|
-
except:
|
|
252
|
-
if "--t" in str(port_user):
|
|
253
|
-
print(f"Thread".center(60,"-"))
|
|
254
|
-
for all in ports.keys():
|
|
255
|
-
t=Thread(target=is_port_open_threads,kwargs={"host":host,"port":all})
|
|
256
|
-
threading.append(t)
|
|
257
|
-
t.start()
|
|
258
|
-
for t in threading:
|
|
259
|
-
t.join()
|
|
260
|
-
if "--s" in str(port_user):
|
|
261
|
-
port_user=port_single.strip("--s")
|
|
262
|
-
port_user=port_user.split()
|
|
263
|
-
port_list=port_user
|
|
264
|
-
port_user=[]
|
|
265
|
-
for i in range(len(port_list)):
|
|
266
|
-
try:
|
|
267
|
-
port_user.append(int(port_list[i]))
|
|
268
|
-
except:
|
|
269
|
-
print(f"{port_list[i]}-->Invalid value")
|
|
270
|
-
break
|
|
271
|
-
for port in range(len(port_user)):
|
|
272
|
-
if is_port_open(host,port_user[port]):
|
|
273
|
-
print(f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|")
|
|
274
|
-
else:
|
|
275
|
-
try:
|
|
276
|
-
print(f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|")
|
|
277
|
-
except:
|
|
278
|
-
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
279
|
-
|
|
280
|
-
continue
|
|
281
|
-
|
|
282
|
-
else:
|
|
283
|
-
if "--t" in port_user:
|
|
284
|
-
continue
|
|
285
|
-
port_user="100"
|
|
286
|
-
print(f"{colored('[!]','red')}Port:invalid value")
|
|
287
|
-
for i in range(0,len(port_user)):
|
|
288
|
-
if port_user[i] == " ":
|
|
289
|
-
port_user=100
|
|
290
|
-
break
|
|
291
|
-
port_user=int(port_user)
|
|
292
|
-
length=port_user
|
|
293
|
-
else:
|
|
294
|
-
print(f"{colored('|*|','blue')}100")
|
|
295
|
-
port_user=100
|
|
296
|
-
length=port_user
|
|
297
|
-
print(f"{colored('|!|','red')}Listening {host} please wait...")
|
|
298
|
-
#|-----------------Starting---------------------|
|
|
299
|
-
length=int(length)+1
|
|
300
|
-
for port in tqdm(range(1,length)):
|
|
301
|
-
if is_port_open(host,port):
|
|
302
|
-
for name in ports:
|
|
303
|
-
if port == name:
|
|
304
|
-
OpenPorts=[port]
|
|
305
|
-
portsopen+=1
|
|
306
|
-
else:
|
|
307
|
-
portsclosed+=1
|
|
308
|
-
if port_user != "":
|
|
309
|
-
if int(port_user) == port:
|
|
310
|
-
if port_user == "":
|
|
311
|
-
pass
|
|
312
|
-
elif int(port_user) == port:
|
|
313
|
-
if is_port_open(host,port):
|
|
314
|
-
Bool=True
|
|
315
|
-
boolean+=1
|
|
316
|
-
else:
|
|
317
|
-
Bool=False
|
|
318
|
-
if boolean == 1:
|
|
319
|
-
pass
|
|
320
|
-
for i in OpenPorts:
|
|
321
|
-
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
322
|
-
print(f"{host}".center(60,"-"))
|
|
323
|
-
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
324
|
-
portsclosed=0
|
|
325
|
-
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
326
|
-
portsopen=0
|
|
327
|
-
print("-"*60)
|
|
File without changes
|
|
File without changes
|