SnakeScan 1.4.4__tar.gz → 1.4.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.4.6/PKG-INFO +34 -0
- snakescan-1.4.6/README.md +20 -0
- snakescan-1.4.6/SnakeScan/__init__.py +307 -0
- snakescan-1.4.4/PKG-INFO +0 -27
- snakescan-1.4.4/README.md +0 -13
- snakescan-1.4.4/SnakeScan/__init__.py +0 -287
- {snakescan-1.4.4 → snakescan-1.4.6}/LICENSE +0 -0
- {snakescan-1.4.4 → snakescan-1.4.6}/pyproject.toml +0 -0
snakescan-1.4.6/PKG-INFO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SnakeScan
|
|
3
|
+
Version: 1.4.6
|
|
4
|
+
Summary: Module SnakeScan using to scan port or ports in you device or other devices
|
|
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
|
+
Scanner to scan devices or watch if you server down or up in time work
|
|
19
|
+
```
|
|
20
|
+
import SnakeScan
|
|
21
|
+
SnakeScan.run()
|
|
22
|
+
```
|
|
23
|
+
##Attrinutes
|
|
24
|
+
- --l need internet to view public ip you device
|
|
25
|
+
- --t threading port search
|
|
26
|
+
- --d dos
|
|
27
|
+
- --s single port search
|
|
28
|
+
- --i information about host
|
|
29
|
+
- --h in host /--h port in host
|
|
30
|
+
##Added class Watcher:
|
|
31
|
+
```
|
|
32
|
+
for SnakeScan import Watcher
|
|
33
|
+
Watcher(host:str,port:int)
|
|
34
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#SnakeScan
|
|
2
|
+

|
|
3
|
+

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