SnakeScan 1.5.8__tar.gz → 1.6.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SnakeScan
3
- Version: 1.5.8
3
+ Version: 1.6.0
4
4
  Summary: Module SnakeScan
5
5
  Author: Den*Ram
6
6
  Description-Content-Type: text/markdown
@@ -40,25 +40,26 @@ SnakeScan.run()
40
40
  for i in range(len(ports)):
41
41
  Watcher("127.0.0.1",ports[i])
42
42
  ```
43
- ## Added CLI command line use
43
+ ## Added CLI command line use snake or Snake
44
44
  ```
45
- $ SnakeConsole -h
46
- usage: SnakeConsole [-h] [-i] [-p PORTS] [-s SINGLE] [-t]
47
- [-ch] [-l]
48
- [host]
45
+ usage: Snake [-h] [-sp] [-v] [-i] [-p PORTS] [-s SINGLE]
46
+ [-t] [-ch] [-l]
47
+ [host]
49
48
 
50
- SnakeCLI - It's a command line module SnakeScan. Use him
51
- for more fast starting
49
+ Snake - It's a command line module SnakeScan. Use him for
50
+ more fast starting
52
51
 
53
52
  positional arguments:
54
53
  host
55
54
 
56
55
  options:
57
56
  -h, --help show this help message and exit
58
- -i, --info info about host
57
+ -sp, --speed speed scan
58
+ -v, --version version
59
+ -i, --info ip info
59
60
  -p, --ports PORTS ports
60
61
  -s, --single SINGLE single scan
61
62
  -t, --thread fast scan
62
63
  -ch, --check scan subnet
63
- -l, --local view you public local ip:need internet
64
+ -l, --local view you public ip - need internet
64
65
  ```
@@ -26,25 +26,26 @@ SnakeScan.run()
26
26
  for i in range(len(ports)):
27
27
  Watcher("127.0.0.1",ports[i])
28
28
  ```
29
- ## Added CLI command line use
29
+ ## Added CLI command line use snake or Snake
30
30
  ```
31
- $ SnakeConsole -h
32
- usage: SnakeConsole [-h] [-i] [-p PORTS] [-s SINGLE] [-t]
33
- [-ch] [-l]
34
- [host]
31
+ usage: Snake [-h] [-sp] [-v] [-i] [-p PORTS] [-s SINGLE]
32
+ [-t] [-ch] [-l]
33
+ [host]
35
34
 
36
- SnakeCLI - It's a command line module SnakeScan. Use him
37
- for more fast starting
35
+ Snake - It's a command line module SnakeScan. Use him for
36
+ more fast starting
38
37
 
39
38
  positional arguments:
40
39
  host
41
40
 
42
41
  options:
43
42
  -h, --help show this help message and exit
44
- -i, --info info about host
43
+ -sp, --speed speed scan
44
+ -v, --version version
45
+ -i, --info ip info
45
46
  -p, --ports PORTS ports
46
47
  -s, --single SINGLE single scan
47
48
  -t, --thread fast scan
48
49
  -ch, --check scan subnet
49
- -l, --local view you public local ip:need internet
50
+ -l, --local view you public ip - need internet
50
51
  ```
@@ -1,11 +1,13 @@
1
+ import sys
1
2
  import argparse
2
3
  import socket
3
4
  import ipaddress
4
-
5
- from tqdm import tqdm
5
+ from concurrent.futures import ProcessPoolExecutor
6
6
  from termcolor import colored
7
7
  from threading import Thread
8
+ from tqdm import tqdm
8
9
  from SnakeScan.Check_subnet import Check_network
10
+ from SnakeScan.PoolExecutor import PoolProcessExecutor
9
11
 
10
12
 
11
13
  def main():
@@ -63,6 +65,7 @@ ports = {
63
65
  8080: "Tomcat",
64
66
  10000: "Webmin",
65
67
  }
68
+ version = "1.6.0"
66
69
 
67
70
 
68
71
  def is_port_open(host, port):
@@ -92,10 +95,12 @@ def is_port_open_threads(host, port):
92
95
 
93
96
  def SnakeArgs():
94
97
  parser = argparse.ArgumentParser(
95
- description="SnakeCLI - It's a command line module SnakeScan. Use him for more fast starting"
98
+ description="Snake - It's a command line module SnakeScan. Use him for more fast starting"
96
99
  )
97
100
  parser.add_argument("host", nargs="?", default="None")
98
- parser.add_argument("-i", "--info", action="store_true", help="info about host")
101
+ parser.add_argument("-sp", "--speed", action="store_true", help="speed scan")
102
+ parser.add_argument("-v", "--version", action="store_true", help="version")
103
+ parser.add_argument("-i", "--info", action="store_true", help="ip info")
99
104
  parser.add_argument("-p", "--ports", help="ports")
100
105
  parser.add_argument("-s", "--single", help="single scan")
101
106
  parser.add_argument("-t", "--thread", action="store_true", help="fast scan")
@@ -104,7 +109,7 @@ def SnakeArgs():
104
109
  "-l",
105
110
  "--local",
106
111
  action="store_true",
107
- help="view you public local ip:need internet",
112
+ help="view you public ip - need internet",
108
113
  )
109
114
  args = parser.parse_args()
110
115
  return args
@@ -112,6 +117,24 @@ def SnakeArgs():
112
117
 
113
118
  port_user = SnakeArgs().ports
114
119
  host = SnakeArgs().host
120
+ if host.startswith("http://"):
121
+ host = host.strip()
122
+ host = host.split("http:")
123
+ host = host[1].strip("//")
124
+ host = host.split("/")
125
+ host = host[0]
126
+ for i in range(len(host)):
127
+ if host[i] == "/":
128
+ host = host[0:i]
129
+ if host.startswith("https://"):
130
+ host = host.strip()
131
+ host = host.split("https:")
132
+ host = host[1].strip("//")
133
+ host = host.split("/")
134
+ host = host[0]
135
+ for i in range(len(host)):
136
+ if host[i] == "/":
137
+ host = host[0:i]
115
138
  if host == "None":
116
139
  host = "localhost"
117
140
  if SnakeArgs().ports:
@@ -154,22 +177,6 @@ if SnakeArgs().ports:
154
177
  print(f"Open{colored('|√|','green')}:{portsopen}")
155
178
  portsopen = 0
156
179
  print("-" * 60)
157
- if "http://" in host:
158
- host = host.strip()
159
- host = host.split("http:")
160
- host = host.strip("//")
161
- for i in range(len(host)):
162
- if host[i] == "/":
163
- host = host[0:i]
164
- if "https://" in host:
165
- host = host.strip()
166
- host = host.strip("https:")
167
- host = host.strip("//")
168
- for i in range(len(host)):
169
- if host[i] == "/":
170
- host = host[0:i]
171
- if host == "None":
172
- host = "localhost"
173
180
  if SnakeArgs().check:
174
181
  Check_network(host)
175
182
  if SnakeArgs().single:
@@ -227,7 +234,11 @@ if SnakeArgs().info:
227
234
  network += "0"
228
235
  network += "/24"
229
236
  hosting = network
230
- ip_obj = ipaddress.ip_address(host)
237
+ try:
238
+ ip_obj = ipaddress.ip_address(host)
239
+ except Exception as e:
240
+ print(e)
241
+ sys.exit()
231
242
  print(f"Type IP: {type(ip_obj)}")
232
243
  print(f"Version IP: {ip_obj.version}")
233
244
  network_obj = ipaddress.ip_network(network)
@@ -248,6 +259,7 @@ if SnakeArgs().info:
248
259
  print("".center(60, "-"))
249
260
  if SnakeArgs().thread:
250
261
  print(f"Thread".center(60, "-"))
262
+
251
263
  for port in ports.keys():
252
264
  t = Thread(
253
265
  target=is_port_open_threads,
@@ -255,5 +267,10 @@ if SnakeArgs().thread:
255
267
  )
256
268
  threads.append(t)
257
269
  t.start()
258
- for t in threads:
259
- t.join()
270
+ for t in threads:
271
+ t.join()
272
+ if SnakeArgs().version:
273
+ print(f"Build_{version}")
274
+ if SnakeArgs().speed:
275
+ print(f"ProcessPoolExecutor".center(60, "-"))
276
+ PoolProcessExecutor(host)
@@ -55,4 +55,4 @@ def Check_network(host):
55
55
  for t in threads:
56
56
  t.join()
57
57
  except ValueError as e:
58
- print(f"Ошибка при создании объекта сети: {e}")
58
+ print(f"Error creating network object {e}")
@@ -0,0 +1,70 @@
1
+ import socket
2
+ from termcolor import colored
3
+ from concurrent.futures import ProcessPoolExecutor
4
+
5
+ ports = {
6
+ 20: "FTP-DATA",
7
+ 21: "FTP",
8
+ 22: "SSH",
9
+ 23: "Telnet",
10
+ 25: "SMTP",
11
+ 43: "WHOIS",
12
+ 53: "DNS",
13
+ 67: "DHCP",
14
+ 68: "DHCP",
15
+ 69: "TFTP",
16
+ 80: "http",
17
+ 110: "POP3",
18
+ 115: "SFTP",
19
+ 123: "NTP",
20
+ 139: "NetBios",
21
+ 143: "IMAP",
22
+ 161: "SNMP",
23
+ 179: "BGP",
24
+ 443: "HTTPS",
25
+ 445: "MICROSOFT-DS",
26
+ 465: "SSL/TLS",
27
+ 514: "SYSLOG",
28
+ 515: "PRINTER",
29
+ 554: "RTSP",
30
+ 587: "TLS/STARTTLS",
31
+ 993: "IMAPS",
32
+ 995: "POP3S",
33
+ 1080: "SOCKS",
34
+ 1194: "OpenVPN",
35
+ 1433: "SQL Server",
36
+ 1723: "PPTP",
37
+ 2222: "SSH",
38
+ 3128: "HTTP",
39
+ 3268: "LDAP",
40
+ 3306: "MySQL",
41
+ 3389: "RDP",
42
+ 5432: "PostgreSQL",
43
+ 5900: "VNC",
44
+ 8080: "Tomcat",
45
+ 10000: "Webmin",
46
+ }
47
+
48
+
49
+ def is_port_open_threads(host, port):
50
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
51
+ try:
52
+ s.settimeout(1)
53
+ s.connect((host, port))
54
+ except (OSError, socket.timeout):
55
+ try:
56
+ print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
57
+ except:
58
+ print(f"Closed{colored('|X|','red')}-->|{port}|")
59
+ else:
60
+ print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
61
+
62
+
63
+ def PoolProcessExecutor(host):
64
+ with ProcessPoolExecutor(max_workers=None) as executor:
65
+ try:
66
+ for port in ports.keys():
67
+ future = executor.submit(is_port_open_threads, host, port)
68
+
69
+ except Exception as e:
70
+ print(e)
@@ -1,6 +1,6 @@
1
1
  """Module SnakeScan"""
2
2
 
3
- __version__ = "1.5.8"
3
+ __version__ = "1.6.0"
4
4
  import socket
5
5
  import ipaddress
6
6
  from art import tprint
@@ -170,17 +170,17 @@ def run():
170
170
  finally:
171
171
  print("".center(60, "-"))
172
172
  continue
173
- if "http://" in host:
173
+ if host.startswith("http://"):
174
174
  host = host.strip()
175
175
  host = host.split("http:")
176
- host = host.strip("//")
176
+ host = host[1].strip("//")
177
177
  for i in range(len(host)):
178
178
  if host[i] == "/":
179
179
  host = host[0:i]
180
- if "https://" in host:
180
+ if host.startswith("https://"):
181
181
  host = host.strip()
182
- host = host.strip("https:")
183
- host = host.strip("//")
182
+ host = host.split("https:")
183
+ host = host[1].strip("//")
184
184
  for i in range(len(host)):
185
185
  if host[i] == "/":
186
186
  host = host[0:i]
@@ -227,8 +227,8 @@ def run():
227
227
  )
228
228
  threads.append(t)
229
229
  t.start()
230
- for t in threads:
231
- t.join()
230
+ for t in threads:
231
+ t.join()
232
232
  if "-s" in str(port_user):
233
233
  port_user = port_single.strip("-s")
234
234
  port_user = port_user.split()
@@ -20,4 +20,5 @@ Homepage = "https://github.com/Den-Ram/SnakeScan"
20
20
  Repository = "https://github.com/Den-Ram/SnakeScan"
21
21
  [project.scripts]
22
22
  SnakeScan = "SnakeScan:run"
23
- SnakeConsole = "SnakeScan.SnakeCLI:main"
23
+ Snake = "SnakeScan.CLI:main"
24
+ snake = "SnakeScan.CLI:main"
File without changes