SnakeScan 1.6.9__tar.gz → 1.7.1__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.9 → snakescan-1.7.1}/PKG-INFO +8 -15
- {snakescan-1.6.9 → snakescan-1.7.1}/README.md +7 -12
- {snakescan-1.6.9 → snakescan-1.7.1}/SnakeScan/CLI.py +106 -31
- snakescan-1.7.1/SnakeScan/__init__.py +44 -0
- {snakescan-1.6.9 → snakescan-1.7.1}/pyproject.toml +0 -3
- snakescan-1.6.9/SnakeScan/__init__.py +0 -327
- {snakescan-1.6.9 → snakescan-1.7.1}/LICENSE +0 -0
- {snakescan-1.6.9 → snakescan-1.7.1}/SnakeScan/Check_subnet.py +0 -0
- {snakescan-1.6.9 → snakescan-1.7.1}/SnakeScan/Get_ssl.py +0 -0
- {snakescan-1.6.9 → snakescan-1.7.1}/SnakeScan/PoolExecutor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SnakeScan
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.1
|
|
4
4
|
Summary: IPv4 address scanner for collecting address information.Use carefully for your network safety.Scan only IPv4 or get the IPv4 address from the IPv6 host
|
|
5
5
|
Author: Den*Ram
|
|
6
6
|
Requires-Python: >=3.7
|
|
@@ -10,25 +10,15 @@ License-File: LICENSE
|
|
|
10
10
|
Requires-Dist: art
|
|
11
11
|
Requires-Dist: tqdm
|
|
12
12
|
Requires-Dist: termcolor
|
|
13
|
-
Project-URL: Homepage, https://github.com/Den-Ram/SnakeScan
|
|
14
|
-
Project-URL: Repository, https://github.com/Den-Ram/SnakeScan
|
|
15
13
|
|
|
16
14
|
# SnakeScan
|
|
17
15
|

|
|
18
16
|

|
|
19
17
|

|
|
20
|
-

|
|
21
19
|

|
|
22
20
|
|
|
23
|
-
Use the library in the terminal, because that's what it's focused on. If you don't want to use the terminal, run it in code, but then some new functions won't be present there.You will need to use it differently.
|
|
24
|
-
|
|
25
21
|
## Help with using the library
|
|
26
|
-
|
|
27
|
-
### If you use the library directly in your code:
|
|
28
|
-
```
|
|
29
|
-
import SnakeScan
|
|
30
|
-
SnakeScan.run()
|
|
31
|
-
```
|
|
32
22
|
- -l need internet to view public ip you device
|
|
33
23
|
- -t threading port search
|
|
34
24
|
- -s single search ports
|
|
@@ -48,7 +38,7 @@ SnakeScan.run()
|
|
|
48
38
|
watcher = Watcher("localhost",53,2)
|
|
49
39
|
watcher.start()
|
|
50
40
|
```
|
|
51
|
-
|
|
41
|
+
### Help with attributes
|
|
52
42
|
```
|
|
53
43
|
-P:
|
|
54
44
|
snake -p 80,443 #Scanning specific ports
|
|
@@ -72,5 +62,8 @@ snake -ch #Scans the subnet for others IP
|
|
|
72
62
|
snake -l #Shows your public internet IP address. Internet connection required for use
|
|
73
63
|
-I:
|
|
74
64
|
snake www.google.com -i #Shows information about the IP address.Can receive information from IPV4 and IPV6
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
|
|
66
|
+
#Update in 1.7.1
|
|
67
|
+
- Unnecessary functions have been removed and some bugs have been fixed.
|
|
68
|
+
- Now SnakeScan run is deleted and run in code is now impossible.
|
|
69
|
+
- Added more ports.
|
|
@@ -2,18 +2,10 @@
|
|
|
2
2
|

|
|
3
3
|

|
|
4
4
|

|
|
5
|
-

|
|
6
6
|

|
|
7
7
|
|
|
8
|
-
Use the library in the terminal, because that's what it's focused on. If you don't want to use the terminal, run it in code, but then some new functions won't be present there.You will need to use it differently.
|
|
9
|
-
|
|
10
8
|
## Help with using the library
|
|
11
|
-
|
|
12
|
-
### If you use the library directly in your code:
|
|
13
|
-
```
|
|
14
|
-
import SnakeScan
|
|
15
|
-
SnakeScan.run()
|
|
16
|
-
```
|
|
17
9
|
- -l need internet to view public ip you device
|
|
18
10
|
- -t threading port search
|
|
19
11
|
- -s single search ports
|
|
@@ -33,7 +25,7 @@ SnakeScan.run()
|
|
|
33
25
|
watcher = Watcher("localhost",53,2)
|
|
34
26
|
watcher.start()
|
|
35
27
|
```
|
|
36
|
-
|
|
28
|
+
### Help with attributes
|
|
37
29
|
```
|
|
38
30
|
-P:
|
|
39
31
|
snake -p 80,443 #Scanning specific ports
|
|
@@ -57,5 +49,8 @@ snake -ch #Scans the subnet for others IP
|
|
|
57
49
|
snake -l #Shows your public internet IP address. Internet connection required for use
|
|
58
50
|
-I:
|
|
59
51
|
snake www.google.com -i #Shows information about the IP address.Can receive information from IPV4 and IPV6
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
|
|
53
|
+
#Update in 1.7.1
|
|
54
|
+
- Unnecessary functions have been removed and some bugs have been fixed.
|
|
55
|
+
- Now SnakeScan run is deleted and run in code is now impossible.
|
|
56
|
+
- Added more ports.
|
|
@@ -3,6 +3,7 @@ import string
|
|
|
3
3
|
import argparse
|
|
4
4
|
import socket
|
|
5
5
|
import ipaddress
|
|
6
|
+
from art import tprint
|
|
6
7
|
from concurrent.futures import ProcessPoolExecutor
|
|
7
8
|
from termcolor import colored
|
|
8
9
|
from threading import Thread
|
|
@@ -26,50 +27,113 @@ Bool = True
|
|
|
26
27
|
boolsd = True
|
|
27
28
|
boolean = 0
|
|
28
29
|
ports = {
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
1: "tcpmux",
|
|
31
|
+
2: "compressnet",
|
|
32
|
+
3: "compressnet",
|
|
33
|
+
5: "rje",
|
|
34
|
+
7: "Echo",
|
|
35
|
+
9: "Discard",
|
|
36
|
+
11: "Systat",
|
|
37
|
+
13: "Daytime",
|
|
38
|
+
17: "QOTD",
|
|
39
|
+
18: "MSP",
|
|
40
|
+
19: "Chargen",
|
|
41
|
+
20: "FTP-Data",
|
|
42
|
+
21: "FTP-Control",
|
|
31
43
|
22: "SSH",
|
|
32
44
|
23: "Telnet",
|
|
45
|
+
24: "private mail",
|
|
33
46
|
25: "SMTP",
|
|
34
|
-
|
|
47
|
+
27: "nsw-fe",
|
|
48
|
+
29: "msg-icp",
|
|
49
|
+
31: "msg-auth",
|
|
50
|
+
33: "dsp",
|
|
51
|
+
35: "private printer server",
|
|
52
|
+
37: "Time",
|
|
53
|
+
38: "rap",
|
|
54
|
+
39: "rlp",
|
|
55
|
+
41: "graphics",
|
|
56
|
+
42: "WINS",
|
|
57
|
+
43: "Whois",
|
|
58
|
+
44: "mpm-flags",
|
|
59
|
+
45: "mpm",
|
|
60
|
+
46: "mpm-snd",
|
|
61
|
+
47: "ni-ftp",
|
|
62
|
+
48: "auditd",
|
|
63
|
+
49: "TACACS",
|
|
64
|
+
50: "re-mail-ck",
|
|
65
|
+
51: "la-maint",
|
|
66
|
+
52: "xns-time",
|
|
35
67
|
53: "DNS",
|
|
36
|
-
|
|
37
|
-
|
|
68
|
+
54: "xns-ch",
|
|
69
|
+
55: "isi-gl",
|
|
70
|
+
56: "xns-auth",
|
|
71
|
+
57: "private terminal",
|
|
72
|
+
58: "xns-mail",
|
|
73
|
+
67: "DHCP server",
|
|
74
|
+
68: "DHCP client",
|
|
38
75
|
69: "TFTP",
|
|
39
|
-
|
|
76
|
+
70: "Gopher",
|
|
77
|
+
79: "Finger",
|
|
78
|
+
80: "HTTP",
|
|
79
|
+
88: "Kerberos",
|
|
80
|
+
109: "POP2",
|
|
40
81
|
110: "POP3",
|
|
82
|
+
111: "RPCbind",
|
|
83
|
+
113: "ident",
|
|
41
84
|
115: "SFTP",
|
|
85
|
+
118: "SQLServ",
|
|
86
|
+
119: "NNTP",
|
|
42
87
|
123: "NTP",
|
|
43
|
-
|
|
88
|
+
135: "MS-Locator",
|
|
89
|
+
137: "NetBIOS-NS",
|
|
90
|
+
138: "NetBIOS-DGM",
|
|
91
|
+
139: "NetBIOS-SSN",
|
|
44
92
|
143: "IMAP",
|
|
45
93
|
161: "SNMP",
|
|
94
|
+
162: "SNMP-trap",
|
|
46
95
|
179: "BGP",
|
|
96
|
+
194: "IRC",
|
|
97
|
+
201: "AppleTalk routing maintenance",
|
|
98
|
+
220: "IMAP3",
|
|
99
|
+
389: "LDAP",
|
|
47
100
|
443: "HTTPS",
|
|
48
|
-
445: "
|
|
49
|
-
465: "
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
101
|
+
445: "SMB",
|
|
102
|
+
465: "SMTPS",
|
|
103
|
+
500: "ISAKMP",
|
|
104
|
+
514: "Syslog",
|
|
105
|
+
520: "RIP",
|
|
106
|
+
546: "DHCPv6 client",
|
|
107
|
+
547: "DHCPv6 server",
|
|
108
|
+
587: "Submission",
|
|
109
|
+
631: "IPP",
|
|
54
110
|
636: "LDAPS",
|
|
55
111
|
990: "FTPS",
|
|
56
112
|
993: "IMAPS",
|
|
57
113
|
995: "POP3S",
|
|
58
114
|
1080: "SOCKS",
|
|
59
115
|
1194: "OpenVPN",
|
|
60
|
-
1433: "SQL
|
|
116
|
+
1433: "Microsoft SQL server",
|
|
117
|
+
1521: "Oracle",
|
|
61
118
|
1723: "PPTP",
|
|
119
|
+
2049: "NFS",
|
|
62
120
|
2222: "SSH",
|
|
63
121
|
3128: "HTTP",
|
|
64
122
|
3268: "LDAP",
|
|
65
123
|
3306: "MySQL",
|
|
66
124
|
3389: "RDP",
|
|
125
|
+
5060: "SIP",
|
|
126
|
+
5353: "MDNS",
|
|
67
127
|
5432: "PostgreSQL",
|
|
68
128
|
5900: "VNC",
|
|
69
|
-
|
|
129
|
+
8000: "HTTP alternate",
|
|
130
|
+
8080: "HTTP alternate",
|
|
131
|
+
8443: "HTTPS alternate",
|
|
132
|
+
8888: "HTTP alternate",
|
|
70
133
|
10000: "Webmin",
|
|
71
134
|
}
|
|
72
|
-
|
|
135
|
+
|
|
136
|
+
version = "1.7.1"
|
|
73
137
|
|
|
74
138
|
|
|
75
139
|
def is_port_open(host, port):
|
|
@@ -126,23 +190,32 @@ def Ports(str=""):
|
|
|
126
190
|
|
|
127
191
|
def SnakeArgs():
|
|
128
192
|
parser = argparse.ArgumentParser(
|
|
129
|
-
description="
|
|
193
|
+
description="SnakeScan - It's a command line library for scan and get information about ip."
|
|
130
194
|
)
|
|
131
195
|
parser.add_argument("host", nargs="?", default="None")
|
|
132
196
|
parser.add_argument(
|
|
133
|
-
"-gs", "--getssl", action="store_true", help="
|
|
197
|
+
"-gs", "--getssl", action="store_true", help="Get official ssl certificate"
|
|
198
|
+
)
|
|
199
|
+
parser.add_argument(
|
|
200
|
+
"-sp",
|
|
201
|
+
"--speed",
|
|
202
|
+
action="store_true",
|
|
203
|
+
help="Scan with using PoolProcessExecutor",
|
|
134
204
|
)
|
|
135
|
-
parser.add_argument("-
|
|
136
|
-
parser.add_argument(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
parser.add_argument("-
|
|
140
|
-
parser.add_argument(
|
|
205
|
+
parser.add_argument("-v", "--version", action="store_true", help="Library version")
|
|
206
|
+
parser.add_argument(
|
|
207
|
+
"-i", "--info", action="store_true", help="IP information about host"
|
|
208
|
+
)
|
|
209
|
+
parser.add_argument("-p", "--ports", help="Range ports to scan host")
|
|
210
|
+
parser.add_argument(
|
|
211
|
+
"-t", "--thread", action="store_true", help="Scan with using Threading"
|
|
212
|
+
)
|
|
213
|
+
parser.add_argument("-ch", "--check", action="store_true", help="Scan ip subnet")
|
|
141
214
|
parser.add_argument(
|
|
142
215
|
"-l",
|
|
143
216
|
"--local",
|
|
144
217
|
action="store_true",
|
|
145
|
-
help="
|
|
218
|
+
help="View you public ip - need internet",
|
|
146
219
|
)
|
|
147
220
|
args = parser.parse_args()
|
|
148
221
|
return args
|
|
@@ -150,7 +223,7 @@ def SnakeArgs():
|
|
|
150
223
|
|
|
151
224
|
port_user = SnakeArgs().ports
|
|
152
225
|
host = SnakeArgs().host
|
|
153
|
-
host=host.split(",")
|
|
226
|
+
host = host.split(",")
|
|
154
227
|
for n in range(len(host)):
|
|
155
228
|
if host[n].startswith("http://"):
|
|
156
229
|
host[n] = host[n].strip()
|
|
@@ -189,7 +262,9 @@ if SnakeArgs().ports:
|
|
|
189
262
|
f"Closed{colored('|X|','red')}{host[n]}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
190
263
|
)
|
|
191
264
|
except:
|
|
192
|
-
print(
|
|
265
|
+
print(
|
|
266
|
+
f"Closed{colored('|X|','red')}{host[n]}-->|{port_user[port]}|"
|
|
267
|
+
)
|
|
193
268
|
try:
|
|
194
269
|
first = rangeports[::2]
|
|
195
270
|
second = rangeports[1::2]
|
|
@@ -264,7 +339,7 @@ if SnakeArgs().info:
|
|
|
264
339
|
except Exception as e:
|
|
265
340
|
print(e)
|
|
266
341
|
sys.exit()
|
|
267
|
-
|
|
342
|
+
|
|
268
343
|
hosting = ""
|
|
269
344
|
hosting = host[n].split(".")
|
|
270
345
|
hosting[len(hosting) - 1] = "0"
|
|
@@ -284,7 +359,7 @@ if SnakeArgs().info:
|
|
|
284
359
|
host[n] = host[n][0]
|
|
285
360
|
ip_obj = ipaddress.ip_address(host[n])
|
|
286
361
|
if ip_obj.version == 6:
|
|
287
|
-
|
|
362
|
+
|
|
288
363
|
try:
|
|
289
364
|
network = host[n] + "/64"
|
|
290
365
|
network_obj = ipaddress.ip_network(network)
|
|
@@ -323,7 +398,7 @@ if SnakeArgs().info:
|
|
|
323
398
|
if SnakeArgs().thread:
|
|
324
399
|
for n in range(len(host)):
|
|
325
400
|
print(f"{host[n]}".center(60, "-"))
|
|
326
|
-
|
|
401
|
+
|
|
327
402
|
for port in ports.keys():
|
|
328
403
|
t = Thread(
|
|
329
404
|
target=is_port_open_threads,
|
|
@@ -334,7 +409,7 @@ if SnakeArgs().thread:
|
|
|
334
409
|
for t in threads:
|
|
335
410
|
t.join()
|
|
336
411
|
if SnakeArgs().version:
|
|
337
|
-
print(f"
|
|
412
|
+
print(f"SnakeScan_Build_{version}")
|
|
338
413
|
if SnakeArgs().speed:
|
|
339
414
|
for n in range(len(host)):
|
|
340
415
|
print(f"{host[n]}".center(60, "-"))
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""IPv4 address scanner for collecting address information.Use carefully for your network safety.Scan only IPv4 or get the IPv4 address from the IPv6 host"""
|
|
2
|
+
|
|
3
|
+
__version__ = "1.7.1"
|
|
4
|
+
import socket
|
|
5
|
+
from time import sleep
|
|
6
|
+
from termcolor import colored
|
|
7
|
+
from threading import Thread
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Watcher:
|
|
11
|
+
def __init__(self, host, port_user, timeout=1):
|
|
12
|
+
# Initialized class and variables host, port, and delay.
|
|
13
|
+
self.host = host # localhost
|
|
14
|
+
self.port_user = port_user # 80
|
|
15
|
+
self.timeout = timeout # 2 or 2.0
|
|
16
|
+
self.work = False # run value
|
|
17
|
+
|
|
18
|
+
def run(self):
|
|
19
|
+
# Basic process of connecting to a host and checking the port
|
|
20
|
+
previous = None
|
|
21
|
+
while self.work:
|
|
22
|
+
try:
|
|
23
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
24
|
+
connection = sock.connect_ex((self.host, self.port_user))
|
|
25
|
+
if previous != connection:
|
|
26
|
+
if connection == 0:
|
|
27
|
+
print(f"Service is up {self.host}-->|{self.port_user}|")
|
|
28
|
+
else:
|
|
29
|
+
print(f"Service is down {self.host}-->|{self.port_user}|")
|
|
30
|
+
previous = connection
|
|
31
|
+
except Exception as e:
|
|
32
|
+
print(f"Unable to create scanner object:{e}")
|
|
33
|
+
sleep(self.timeout)
|
|
34
|
+
|
|
35
|
+
def start(self):
|
|
36
|
+
# Run a port check to see if it is running or offline.
|
|
37
|
+
self.work = True
|
|
38
|
+
self.thread = Thread(target=self.run)
|
|
39
|
+
self.thread.start()
|
|
40
|
+
|
|
41
|
+
def stop(self):
|
|
42
|
+
# Stops port checking
|
|
43
|
+
self.work = False
|
|
44
|
+
self.thread.join()
|
|
@@ -16,9 +16,6 @@ dependencies = [
|
|
|
16
16
|
"tqdm",
|
|
17
17
|
"termcolor",
|
|
18
18
|
]
|
|
19
|
-
[project.urls]
|
|
20
|
-
Homepage = "https://github.com/Den-Ram/SnakeScan"
|
|
21
|
-
Repository = "https://github.com/Den-Ram/SnakeScan"
|
|
22
19
|
[project.scripts]
|
|
23
20
|
SnakeScan = "SnakeScan:run"
|
|
24
21
|
Snake = "SnakeScan.CLI:main"
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
"""IPv4 address scanner for collecting address information.Use carefully for your network safety.Scan only IPv4 or get the IPv4 address from the IPv6 host"""
|
|
2
|
-
|
|
3
|
-
__version__ = "1.6.9"
|
|
4
|
-
import socket
|
|
5
|
-
import ipaddress
|
|
6
|
-
from art import tprint
|
|
7
|
-
from time import sleep
|
|
8
|
-
from tqdm import tqdm
|
|
9
|
-
from termcolor import colored
|
|
10
|
-
from threading import Thread
|
|
11
|
-
from SnakeScan.Check_subnet import Check_network
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Watcher:
|
|
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
|
-
|
|
22
|
-
def run(self):
|
|
23
|
-
# Basic process of connecting to a host and checking the port
|
|
24
|
-
previous = None
|
|
25
|
-
while self.work:
|
|
26
|
-
try:
|
|
27
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
28
|
-
connection = sock.connect_ex((self.host, self.port_user))
|
|
29
|
-
if previous != connection:
|
|
30
|
-
if connection == 0:
|
|
31
|
-
print(f"Service is up {self.host}-->|{self.port_user}|")
|
|
32
|
-
else:
|
|
33
|
-
print(f"Service is down {self.host}-->|{self.port_user}|")
|
|
34
|
-
previous = connection
|
|
35
|
-
except Exception as e:
|
|
36
|
-
print(f"Unable to create scanner object:{e}")
|
|
37
|
-
sleep(self.timeout)
|
|
38
|
-
|
|
39
|
-
def start(self):
|
|
40
|
-
# Run a port check to see if it is running or offline.
|
|
41
|
-
self.work = True
|
|
42
|
-
self.thread = Thread(target=self.run)
|
|
43
|
-
self.thread.start()
|
|
44
|
-
|
|
45
|
-
def stop(self):
|
|
46
|
-
# Stops port checking
|
|
47
|
-
self.work = False
|
|
48
|
-
self.thread.join()
|
|
49
|
-
|
|
50
|
-
#Run SnakeScan
|
|
51
|
-
def run():
|
|
52
|
-
portsopen = 0
|
|
53
|
-
portsclosed = 0
|
|
54
|
-
Run_now = True
|
|
55
|
-
|
|
56
|
-
global num
|
|
57
|
-
num = 0
|
|
58
|
-
|
|
59
|
-
OpenPorts = []
|
|
60
|
-
threads = []
|
|
61
|
-
ports = {
|
|
62
|
-
20: "FTP-DATA",
|
|
63
|
-
21: "FTP",
|
|
64
|
-
22: "SSH",
|
|
65
|
-
23: "Telnet",
|
|
66
|
-
25: "SMTP",
|
|
67
|
-
43: "WHOIS",
|
|
68
|
-
53: "DNS",
|
|
69
|
-
67: "DHCP",
|
|
70
|
-
68: "DHCP",
|
|
71
|
-
69: "TFTP",
|
|
72
|
-
80: "http",
|
|
73
|
-
110: "POP3",
|
|
74
|
-
115: "SFTP",
|
|
75
|
-
123: "NTP",
|
|
76
|
-
139: "NetBios",
|
|
77
|
-
143: "IMAP",
|
|
78
|
-
161: "SNMP",
|
|
79
|
-
179: "BGP",
|
|
80
|
-
443: "HTTPS",
|
|
81
|
-
445: "MICROSOFT-DS",
|
|
82
|
-
465: "SSL/TLS",
|
|
83
|
-
514: "SYSLOG",
|
|
84
|
-
515: "PRINTER",
|
|
85
|
-
554: "RTSP",
|
|
86
|
-
587: "TLS/STARTTLS",
|
|
87
|
-
636: "LDAPS",
|
|
88
|
-
990: "FTPS",
|
|
89
|
-
993: "IMAPS",
|
|
90
|
-
995: "POP3S",
|
|
91
|
-
1080: "SOCKS",
|
|
92
|
-
1194: "OpenVPN",
|
|
93
|
-
1433: "SQL Server",
|
|
94
|
-
1723: "PPTP",
|
|
95
|
-
2222: "SSH",
|
|
96
|
-
3128: "HTTP",
|
|
97
|
-
3268: "LDAP",
|
|
98
|
-
3306: "MySQL",
|
|
99
|
-
3389: "RDP",
|
|
100
|
-
5432: "PostgreSQL",
|
|
101
|
-
5900: "VNC",
|
|
102
|
-
8080: "Tomcat",
|
|
103
|
-
10000: "Webmin",
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
def Ports(str=""):
|
|
107
|
-
rangeports = []
|
|
108
|
-
port = []
|
|
109
|
-
str = str.split(",")
|
|
110
|
-
for p in range(len(str)):
|
|
111
|
-
if "-" in str[p]:
|
|
112
|
-
rangeports.append(str[p])
|
|
113
|
-
else:
|
|
114
|
-
port.append(str[p])
|
|
115
|
-
for n in range(len(port)):
|
|
116
|
-
for i in string.punctuation:
|
|
117
|
-
if i in port[n]:
|
|
118
|
-
port[n] = port[n].replace(i, "")
|
|
119
|
-
for r in range(len(rangeports)):
|
|
120
|
-
rangeport = rangeports[r].split("-")
|
|
121
|
-
try:
|
|
122
|
-
return rangeport, port
|
|
123
|
-
except Exception as e:
|
|
124
|
-
print("Error: invalid value")
|
|
125
|
-
sys.exit()
|
|
126
|
-
|
|
127
|
-
def is_port_open(host, port):
|
|
128
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
129
|
-
try:
|
|
130
|
-
s.settimeout(1)
|
|
131
|
-
s.connect((host, port))
|
|
132
|
-
except (OSError, socket.timeout):
|
|
133
|
-
return False
|
|
134
|
-
else:
|
|
135
|
-
return True
|
|
136
|
-
|
|
137
|
-
def is_port_open_threads(host, port):
|
|
138
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
139
|
-
try:
|
|
140
|
-
s.settimeout(1)
|
|
141
|
-
s.connect((host, port))
|
|
142
|
-
except (OSError, socket.timeout):
|
|
143
|
-
try:
|
|
144
|
-
print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
|
|
145
|
-
except:
|
|
146
|
-
print(f"Closed{colored('|X|','red')}-->|{port}|")
|
|
147
|
-
else:
|
|
148
|
-
print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
|
|
149
|
-
|
|
150
|
-
print("–" * 60)
|
|
151
|
-
tprint("SnakeScan")
|
|
152
|
-
print("–" * 60)
|
|
153
|
-
while Run_now:
|
|
154
|
-
host = input(f"{colored('[$]','green')}Host-->")
|
|
155
|
-
if "-check" in host:
|
|
156
|
-
host = host.strip("-check")
|
|
157
|
-
host = host.strip()
|
|
158
|
-
Check_network(host)
|
|
159
|
-
continue
|
|
160
|
-
if "-v" in host:
|
|
161
|
-
print(f"Build_{__version__}")
|
|
162
|
-
continue
|
|
163
|
-
if "-help" in host:
|
|
164
|
-
host = host.strip("-help")
|
|
165
|
-
host = host.strip()
|
|
166
|
-
if host == "port":
|
|
167
|
-
print("Port:|-s port,-t|")
|
|
168
|
-
if host:
|
|
169
|
-
pass
|
|
170
|
-
else:
|
|
171
|
-
print("Host:|host -check,host -i,-l,-v|")
|
|
172
|
-
continue
|
|
173
|
-
if "-i" in host:
|
|
174
|
-
host = host.strip("-i").strip()
|
|
175
|
-
print("".center(60, "-"))
|
|
176
|
-
try:
|
|
177
|
-
host = socket.gethostbyname(host)
|
|
178
|
-
except Exception as e:
|
|
179
|
-
print(e)
|
|
180
|
-
print("".center(60, "^"))
|
|
181
|
-
print("".center(60, "-"))
|
|
182
|
-
continue
|
|
183
|
-
hosting = ""
|
|
184
|
-
hosting = host.split(".")
|
|
185
|
-
hosting[len(hosting) - 1] = "0"
|
|
186
|
-
network = ""
|
|
187
|
-
for i in range(len(hosting) - 1):
|
|
188
|
-
network += hosting[i] + "."
|
|
189
|
-
network += "0"
|
|
190
|
-
network += "/24"
|
|
191
|
-
hosting = network
|
|
192
|
-
ip_obj = ipaddress.ip_address(host)
|
|
193
|
-
print(f"Type IP: {type(ip_obj)}")
|
|
194
|
-
print(f"Version IP: {ip_obj.version}")
|
|
195
|
-
network_obj = ipaddress.ip_network(network)
|
|
196
|
-
print(f"Network: {network_obj}")
|
|
197
|
-
print(f"Subnet mask: {network_obj.netmask}")
|
|
198
|
-
try:
|
|
199
|
-
hostname = socket.gethostbyaddr(host)
|
|
200
|
-
print(f"Host:{hostname[0]}")
|
|
201
|
-
except:
|
|
202
|
-
hostname = "Undefined"
|
|
203
|
-
print(f"Host:{hostname}")
|
|
204
|
-
try:
|
|
205
|
-
print(f"IP:{socket.gethostbyname(host)}")
|
|
206
|
-
except Exception as e:
|
|
207
|
-
print(f"IP:{e}")
|
|
208
|
-
continue
|
|
209
|
-
finally:
|
|
210
|
-
print("".center(60, "-"))
|
|
211
|
-
continue
|
|
212
|
-
if host.startswith("http://"):
|
|
213
|
-
host = host.strip()
|
|
214
|
-
host = host.split("http:")
|
|
215
|
-
host = host[1].strip("//")
|
|
216
|
-
for i in range(len(host)):
|
|
217
|
-
if host[i] == "/":
|
|
218
|
-
host = host[0:i]
|
|
219
|
-
if host.startswith("https://"):
|
|
220
|
-
host = host.strip()
|
|
221
|
-
host = host.split("https:")
|
|
222
|
-
host = host[1].strip("//")
|
|
223
|
-
for i in range(len(host)):
|
|
224
|
-
if host[i] == "/":
|
|
225
|
-
host = host[0:i]
|
|
226
|
-
if host == "Exit".lower():
|
|
227
|
-
break
|
|
228
|
-
if host == "":
|
|
229
|
-
while True:
|
|
230
|
-
print(f"{colored('Host','green')}{colored('[X]:Empty value','red')}")
|
|
231
|
-
host = input(f"{colored('[$]','green')}Host-->")
|
|
232
|
-
if host:
|
|
233
|
-
break
|
|
234
|
-
if "-l" in host:
|
|
235
|
-
local = ""
|
|
236
|
-
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
237
|
-
try:
|
|
238
|
-
s.connect(("10.255.255.255", 1))
|
|
239
|
-
local = s.getsockname()[0]
|
|
240
|
-
except Exception as e:
|
|
241
|
-
local = f"127.0.0.1:{e}"
|
|
242
|
-
finally:
|
|
243
|
-
s.close()
|
|
244
|
-
print(local)
|
|
245
|
-
continue
|
|
246
|
-
port_user = input(f"{colored('[$]','green')}Port-->")
|
|
247
|
-
if port_user == "":
|
|
248
|
-
while True:
|
|
249
|
-
print(f"{colored('Port','green')}{colored('[X]:Empty value','red')}")
|
|
250
|
-
port_user = input(f"{colored('[$]','green')}Port-->")
|
|
251
|
-
if port_user:
|
|
252
|
-
break
|
|
253
|
-
port_single = port_user
|
|
254
|
-
if port_user == "Exit".lower():
|
|
255
|
-
break
|
|
256
|
-
if port_user:
|
|
257
|
-
try:
|
|
258
|
-
length = int(port_user)
|
|
259
|
-
except:
|
|
260
|
-
if "-t" in str(port_user):
|
|
261
|
-
print(f"Thread".center(60, "-"))
|
|
262
|
-
for port in ports.keys():
|
|
263
|
-
t = Thread(
|
|
264
|
-
target=is_port_open_threads,
|
|
265
|
-
kwargs={"host": host, "port": port},
|
|
266
|
-
)
|
|
267
|
-
threads.append(t)
|
|
268
|
-
t.start()
|
|
269
|
-
for t in threads:
|
|
270
|
-
t.join()
|
|
271
|
-
|
|
272
|
-
else:
|
|
273
|
-
if "-t" in port_user:
|
|
274
|
-
continue
|
|
275
|
-
port_user = "100"
|
|
276
|
-
print(f"{colored('[!]','red')}Port:invalid value")
|
|
277
|
-
for i in range(0, len(port_user)):
|
|
278
|
-
if port_user[i] == " ":
|
|
279
|
-
port_user = 100
|
|
280
|
-
break
|
|
281
|
-
port_user = int(port_user)
|
|
282
|
-
length = port_user
|
|
283
|
-
else:
|
|
284
|
-
print(f"{colored('|*|','blue')}100")
|
|
285
|
-
port_user = 100
|
|
286
|
-
length = port_user
|
|
287
|
-
print(f"{colored('|!|','red')}Listening {host} please wait...")
|
|
288
|
-
# |----------------starting---------------------|
|
|
289
|
-
rangeports, port_user = Ports(port_user)
|
|
290
|
-
for i in range(len(port_user)):
|
|
291
|
-
port_user[i] = int(port_user[i])
|
|
292
|
-
for port in range(len(port_user)):
|
|
293
|
-
if is_port_open(host, port_user[port]):
|
|
294
|
-
print(
|
|
295
|
-
f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
296
|
-
)
|
|
297
|
-
else:
|
|
298
|
-
try:
|
|
299
|
-
print(
|
|
300
|
-
f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
|
|
301
|
-
)
|
|
302
|
-
except:
|
|
303
|
-
print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
|
|
304
|
-
for port in tqdm(range(int(rangeports[0]), int(rangeports[1]) + 1)):
|
|
305
|
-
if is_port_open(host, port):
|
|
306
|
-
for name in ports:
|
|
307
|
-
if port == name:
|
|
308
|
-
OpenPorts = [port]
|
|
309
|
-
portsopen += 1
|
|
310
|
-
else:
|
|
311
|
-
portsclosed += 1
|
|
312
|
-
if OpenPorts:
|
|
313
|
-
for i in OpenPorts:
|
|
314
|
-
print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
|
|
315
|
-
print(f"{host}".center(60, "-"))
|
|
316
|
-
print(f"Closed{colored('|X|','red')}:{portsclosed}")
|
|
317
|
-
portsclosed = 0
|
|
318
|
-
print(f"Open{colored('|√|','green')}:{portsopen}")
|
|
319
|
-
portsopen = 0
|
|
320
|
-
print("-" * 60)
|
|
321
|
-
else:
|
|
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
|
|
File without changes
|
|
File without changes
|