SnakeScan 1.6.9__tar.gz → 1.7.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.6.9
3
+ Version: 1.7.0
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,17 @@ 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
  ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
18
16
  ![License](https://img.shields.io/badge/License-MIT-blue.svg)
19
17
  ![Requires-python](https://img.shields.io/badge/requires--python-3.7+-red)
20
- ![Status](https://img.shields.io/badge/%20Beta-orange)
18
+ ![Status](https://img.shields.io/badge/Version%20Beta-orange)
21
19
  ![Platforms](https://img.shields.io/badge/Platforms-macOS%20%7C%20Linux%20%7C%20Windows-blue)
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.
21
+ This library is now used only in the terminal.
24
22
 
25
23
  ## 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
24
  - -l need internet to view public ip you device
33
25
  - -t threading port search
34
26
  - -s single search ports
@@ -48,7 +40,7 @@ SnakeScan.run()
48
40
  watcher = Watcher("localhost",53,2)
49
41
  watcher.start()
50
42
  ```
51
- ## Help with attributes
43
+ ### Help with attributes
52
44
  ```
53
45
  -P:
54
46
  snake -p 80,443 #Scanning specific ports
@@ -72,5 +64,7 @@ snake -ch #Scans the subnet for others IP
72
64
  snake -l #Shows your public internet IP address. Internet connection required for use
73
65
  -I:
74
66
  snake www.google.com -i #Shows information about the IP address.Can receive information from IPV4 and IPV6
75
- ##Update in 1.6.9
76
- - Added support for multi-hosting: snake www.google.com,www.example.com -i -p 53,80,443,0-1000 -ch -sp -t
67
+
68
+ ##Update in 1.7.0
69
+ - Unnecessary functions have been removed and some bugs have been fixed.
70
+ - Now SnakeScan run is deleted and run in code is now impossible.
@@ -2,18 +2,12 @@
2
2
  ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
3
3
  ![License](https://img.shields.io/badge/License-MIT-blue.svg)
4
4
  ![Requires-python](https://img.shields.io/badge/requires--python-3.7+-red)
5
- ![Status](https://img.shields.io/badge/%20Beta-orange)
5
+ ![Status](https://img.shields.io/badge/Version%20Beta-orange)
6
6
  ![Platforms](https://img.shields.io/badge/Platforms-macOS%20%7C%20Linux%20%7C%20Windows-blue)
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.
8
+ This library is now used only in the terminal.
9
9
 
10
10
  ## 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
11
  - -l need internet to view public ip you device
18
12
  - -t threading port search
19
13
  - -s single search ports
@@ -33,7 +27,7 @@ SnakeScan.run()
33
27
  watcher = Watcher("localhost",53,2)
34
28
  watcher.start()
35
29
  ```
36
- ## Help with attributes
30
+ ### Help with attributes
37
31
  ```
38
32
  -P:
39
33
  snake -p 80,443 #Scanning specific ports
@@ -57,5 +51,7 @@ snake -ch #Scans the subnet for others IP
57
51
  snake -l #Shows your public internet IP address. Internet connection required for use
58
52
  -I:
59
53
  snake www.google.com -i #Shows information about the IP address.Can receive information from IPV4 and IPV6
60
- ##Update in 1.6.9
61
- - Added support for multi-hosting: snake www.google.com,www.example.com -i -p 53,80,443,0-1000 -ch -sp -t
54
+
55
+ ##Update in 1.7.0
56
+ - Unnecessary functions have been removed and some bugs have been fixed.
57
+ - Now SnakeScan run is deleted and run in code is now impossible.
@@ -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
@@ -69,7 +70,7 @@ ports = {
69
70
  8080: "Tomcat",
70
71
  10000: "Webmin",
71
72
  }
72
- version = "1.6.9"
73
+ version = "1.7.0"
73
74
 
74
75
 
75
76
  def is_port_open(host, port):
@@ -126,23 +127,32 @@ def Ports(str=""):
126
127
 
127
128
  def SnakeArgs():
128
129
  parser = argparse.ArgumentParser(
129
- description="Snake - It's a command line module SnakeScan. Use him for more fast starting"
130
+ description="SnakeScan - It's a command line library for scan and get information about ip."
130
131
  )
131
132
  parser.add_argument("host", nargs="?", default="None")
132
133
  parser.add_argument(
133
- "-gs", "--getssl", action="store_true", help="get official ssl certificate"
134
+ "-gs", "--getssl", action="store_true", help="Get official ssl certificate"
134
135
  )
135
- parser.add_argument("-sp", "--speed", action="store_true", help="speed scan")
136
- parser.add_argument("-v", "--version", action="store_true", help="version")
137
- parser.add_argument("-i", "--info", action="store_true", help="ip info")
138
- parser.add_argument("-p", "--ports", help="range ports to scan host")
139
- parser.add_argument("-t", "--thread", action="store_true", help="fast scan")
140
- parser.add_argument("-ch", "--check", action="store_true", help="scan subnet")
136
+ parser.add_argument(
137
+ "-sp",
138
+ "--speed",
139
+ action="store_true",
140
+ help="Scan with using PoolProcessExecutor",
141
+ )
142
+ parser.add_argument("-v", "--version", action="store_true", help="Library version")
143
+ parser.add_argument(
144
+ "-i", "--info", action="store_true", help="IP information about host"
145
+ )
146
+ parser.add_argument("-p", "--ports", help="Range ports to scan host")
147
+ parser.add_argument(
148
+ "-t", "--thread", action="store_true", help="Scan with using Threading"
149
+ )
150
+ parser.add_argument("-ch", "--check", action="store_true", help="Scan ip subnet")
141
151
  parser.add_argument(
142
152
  "-l",
143
153
  "--local",
144
154
  action="store_true",
145
- help="view you public ip - need internet",
155
+ help="View you public ip - need internet",
146
156
  )
147
157
  args = parser.parse_args()
148
158
  return args
@@ -150,7 +160,7 @@ def SnakeArgs():
150
160
 
151
161
  port_user = SnakeArgs().ports
152
162
  host = SnakeArgs().host
153
- host=host.split(",")
163
+ host = host.split(",")
154
164
  for n in range(len(host)):
155
165
  if host[n].startswith("http://"):
156
166
  host[n] = host[n].strip()
@@ -189,7 +199,9 @@ if SnakeArgs().ports:
189
199
  f"Closed{colored('|X|','red')}{host[n]}-->{ports[port_user[port]]}|{port_user[port]}|"
190
200
  )
191
201
  except:
192
- print(f"Closed{colored('|X|','red')}{host[n]}-->|{port_user[port]}|")
202
+ print(
203
+ f"Closed{colored('|X|','red')}{host[n]}-->|{port_user[port]}|"
204
+ )
193
205
  try:
194
206
  first = rangeports[::2]
195
207
  second = rangeports[1::2]
@@ -264,7 +276,7 @@ if SnakeArgs().info:
264
276
  except Exception as e:
265
277
  print(e)
266
278
  sys.exit()
267
-
279
+
268
280
  hosting = ""
269
281
  hosting = host[n].split(".")
270
282
  hosting[len(hosting) - 1] = "0"
@@ -284,7 +296,7 @@ if SnakeArgs().info:
284
296
  host[n] = host[n][0]
285
297
  ip_obj = ipaddress.ip_address(host[n])
286
298
  if ip_obj.version == 6:
287
-
299
+
288
300
  try:
289
301
  network = host[n] + "/64"
290
302
  network_obj = ipaddress.ip_network(network)
@@ -323,7 +335,7 @@ if SnakeArgs().info:
323
335
  if SnakeArgs().thread:
324
336
  for n in range(len(host)):
325
337
  print(f"{host[n]}".center(60, "-"))
326
-
338
+
327
339
  for port in ports.keys():
328
340
  t = Thread(
329
341
  target=is_port_open_threads,
@@ -334,7 +346,7 @@ if SnakeArgs().thread:
334
346
  for t in threads:
335
347
  t.join()
336
348
  if SnakeArgs().version:
337
- print(f"Build_{version}")
349
+ print(f"SnakeScan_Build_{version}")
338
350
  if SnakeArgs().speed:
339
351
  for n in range(len(host)):
340
352
  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.0"
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