SnakeScan 1.5.7__tar.gz → 1.5.8__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.
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: SnakeScan
3
+ Version: 1.5.8
4
+ Summary: Module SnakeScan
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
+ ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
17
+ ![Requires-python](https://img.shields.io/badge/requires--python-3.6+-red)
18
+ ![License](https://img.shields.io/badge/License-MIT-blue.svg)
19
+ ```
20
+ import SnakeScan
21
+ SnakeScan.run()
22
+ ```
23
+ ## Help
24
+ - -l need internet to view public ip you device
25
+ - -t threading port search
26
+ - -s single port search
27
+ - -i information about host
28
+ - -help in host /-help port in host
29
+ - -check [host] scan subnet in ip
30
+ - exit in host or port off script
31
+ ## Added class Watcher:
32
+ ```
33
+ for SnakeScan import Watcher
34
+ Watcher(host:str,port:int)
35
+ ```
36
+ ## Added multiple use Watcher:
37
+ ```
38
+ from SnakeScan import Watcher
39
+ ports=[53,80,100,160]
40
+ for i in range(len(ports)):
41
+ Watcher("127.0.0.1",ports[i])
42
+ ```
43
+ ## Added CLI command line use
44
+ ```
45
+ $ SnakeConsole -h
46
+ usage: SnakeConsole [-h] [-i] [-p PORTS] [-s SINGLE] [-t]
47
+ [-ch] [-l]
48
+ [host]
49
+
50
+ SnakeCLI - It's a command line module SnakeScan. Use him
51
+ for more fast starting
52
+
53
+ positional arguments:
54
+ host
55
+
56
+ options:
57
+ -h, --help show this help message and exit
58
+ -i, --info info about host
59
+ -p, --ports PORTS ports
60
+ -s, --single SINGLE single scan
61
+ -t, --thread fast scan
62
+ -ch, --check scan subnet
63
+ -l, --local view you public local ip:need internet
64
+ ```
@@ -0,0 +1,50 @@
1
+ # SnakeScan
2
+ ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
3
+ ![Requires-python](https://img.shields.io/badge/requires--python-3.6+-red)
4
+ ![License](https://img.shields.io/badge/License-MIT-blue.svg)
5
+ ```
6
+ import SnakeScan
7
+ SnakeScan.run()
8
+ ```
9
+ ## Help
10
+ - -l need internet to view public ip you device
11
+ - -t threading port search
12
+ - -s single port search
13
+ - -i information about host
14
+ - -help in host /-help port in host
15
+ - -check [host] scan subnet in ip
16
+ - exit in host or port off script
17
+ ## Added class Watcher:
18
+ ```
19
+ for SnakeScan import Watcher
20
+ Watcher(host:str,port:int)
21
+ ```
22
+ ## Added multiple use Watcher:
23
+ ```
24
+ from SnakeScan import Watcher
25
+ ports=[53,80,100,160]
26
+ for i in range(len(ports)):
27
+ Watcher("127.0.0.1",ports[i])
28
+ ```
29
+ ## Added CLI command line use
30
+ ```
31
+ $ SnakeConsole -h
32
+ usage: SnakeConsole [-h] [-i] [-p PORTS] [-s SINGLE] [-t]
33
+ [-ch] [-l]
34
+ [host]
35
+
36
+ SnakeCLI - It's a command line module SnakeScan. Use him
37
+ for more fast starting
38
+
39
+ positional arguments:
40
+ host
41
+
42
+ options:
43
+ -h, --help show this help message and exit
44
+ -i, --info info about host
45
+ -p, --ports PORTS ports
46
+ -s, --single SINGLE single scan
47
+ -t, --thread fast scan
48
+ -ch, --check scan subnet
49
+ -l, --local view you public local ip:need internet
50
+ ```
@@ -0,0 +1,259 @@
1
+ import argparse
2
+ import socket
3
+ import ipaddress
4
+
5
+ from tqdm import tqdm
6
+ from termcolor import colored
7
+ from threading import Thread
8
+ from SnakeScan.Check_subnet import Check_network
9
+
10
+
11
+ def main():
12
+ pass
13
+
14
+
15
+ if __name__ == "__main__":
16
+ main()
17
+ OpenPorts = []
18
+ threads = []
19
+ portsopen = 0
20
+ portsclosed = 0
21
+ Bool = True
22
+ boolsd = True
23
+ boolean = 0
24
+ ports = {
25
+ 20: "FTP-DATA",
26
+ 21: "FTP",
27
+ 22: "SSH",
28
+ 23: "Telnet",
29
+ 25: "SMTP",
30
+ 43: "WHOIS",
31
+ 53: "DNS",
32
+ 67: "DHCP",
33
+ 68: "DHCP",
34
+ 69: "TFTP",
35
+ 80: "http",
36
+ 110: "POP3",
37
+ 115: "SFTP",
38
+ 123: "NTP",
39
+ 139: "NetBios",
40
+ 143: "IMAP",
41
+ 161: "SNMP",
42
+ 179: "BGP",
43
+ 443: "HTTPS",
44
+ 445: "MICROSOFT-DS",
45
+ 465: "SSL/TLS",
46
+ 514: "SYSLOG",
47
+ 515: "PRINTER",
48
+ 554: "RTSP",
49
+ 587: "TLS/STARTTLS",
50
+ 993: "IMAPS",
51
+ 995: "POP3S",
52
+ 1080: "SOCKS",
53
+ 1194: "OpenVPN",
54
+ 1433: "SQL Server",
55
+ 1723: "PPTP",
56
+ 2222: "SSH",
57
+ 3128: "HTTP",
58
+ 3268: "LDAP",
59
+ 3306: "MySQL",
60
+ 3389: "RDP",
61
+ 5432: "PostgreSQL",
62
+ 5900: "VNC",
63
+ 8080: "Tomcat",
64
+ 10000: "Webmin",
65
+ }
66
+
67
+
68
+ def is_port_open(host, port):
69
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
70
+ try:
71
+ s.settimeout(1)
72
+ s.connect((host, port))
73
+ except (OSError, socket.timeout):
74
+ return False
75
+ else:
76
+ return True
77
+
78
+
79
+ def is_port_open_threads(host, port):
80
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
81
+ try:
82
+ s.settimeout(1)
83
+ s.connect((host, port))
84
+ except (OSError, socket.timeout):
85
+ try:
86
+ print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
87
+ except:
88
+ print(f"Closed{colored('|X|','red')}-->|{port}|")
89
+ else:
90
+ print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
91
+
92
+
93
+ def SnakeArgs():
94
+ parser = argparse.ArgumentParser(
95
+ description="SnakeCLI - It's a command line module SnakeScan. Use him for more fast starting"
96
+ )
97
+ parser.add_argument("host", nargs="?", default="None")
98
+ parser.add_argument("-i", "--info", action="store_true", help="info about host")
99
+ parser.add_argument("-p", "--ports", help="ports")
100
+ parser.add_argument("-s", "--single", help="single scan")
101
+ parser.add_argument("-t", "--thread", action="store_true", help="fast scan")
102
+ parser.add_argument("-ch", "--check", action="store_true", help="scan subnet")
103
+ parser.add_argument(
104
+ "-l",
105
+ "--local",
106
+ action="store_true",
107
+ help="view you public local ip:need internet",
108
+ )
109
+ args = parser.parse_args()
110
+ return args
111
+
112
+
113
+ port_user = SnakeArgs().ports
114
+ host = SnakeArgs().host
115
+ if host == "None":
116
+ host = "localhost"
117
+ if SnakeArgs().ports:
118
+ try:
119
+ length = int(port_user)
120
+ except:
121
+ port_user = "100"
122
+ print(f"{colored('[!]','red')}Port:invalid value")
123
+ for i in range(0, len(port_user)):
124
+ if port_user[i] == " ":
125
+ port_user = 100
126
+ port_user = int(port_user)
127
+ length = port_user
128
+ length = int(length) + 1
129
+ for port in tqdm(range(1, length)):
130
+ if is_port_open(host, port):
131
+ for name in ports:
132
+ if port == name:
133
+ OpenPorts = [port]
134
+ portsopen += 1
135
+ else:
136
+ portsclosed += 1
137
+ if port_user != "":
138
+ if int(port_user) == port:
139
+ if port_user == "":
140
+ pass
141
+ elif int(port_user) == port:
142
+ if is_port_open(host, port):
143
+ Bool = True
144
+ boolean += 1
145
+ else:
146
+ Bool = False
147
+ if boolean == 1:
148
+ pass
149
+ for i in OpenPorts:
150
+ print(f"Open{colored('|√|','green')}-->{ports[i]}|{i}|")
151
+ print(f"{host}".center(60, "-"))
152
+ print(f"Closed{colored('|X|','red')}:{portsclosed}")
153
+ portsclosed = 0
154
+ print(f"Open{colored('|√|','green')}:{portsopen}")
155
+ portsopen = 0
156
+ 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
+ if SnakeArgs().check:
174
+ Check_network(host)
175
+ if SnakeArgs().single:
176
+ port_user = SnakeArgs().single.split(",")
177
+
178
+ port_list = port_user
179
+ port_user = []
180
+ for i in range(len(port_list)):
181
+ try:
182
+ port_user.append(int(port_list[i]))
183
+ except:
184
+ print(f"{port_list[i]}-->Invalid value")
185
+
186
+ for port in range(len(port_user)):
187
+ if is_port_open(host, port_user[port]):
188
+ print(
189
+ f"Open{colored('|√|','green')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
190
+ )
191
+ else:
192
+ try:
193
+ print(
194
+ f"Closed{colored('|X|','red')}{host}-->{ports[port_user[port]]}|{port_user[port]}|"
195
+ )
196
+ except:
197
+ print(f"Closed{colored('|X|','red')}{host}-->|{port_user[port]}|")
198
+ if SnakeArgs().local:
199
+ local = ""
200
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
201
+ try:
202
+ s.connect(("10.255.255.255", 1))
203
+ local = s.getsockname()[0]
204
+ except Exception as e:
205
+ local = f"127.0.0.1:{e}"
206
+ finally:
207
+ s.close()
208
+ print(local)
209
+ if SnakeArgs().info:
210
+ if host == "None":
211
+ host = "localhost"
212
+ host = host.strip("-i").strip()
213
+ print("".center(60, "-"))
214
+ try:
215
+ host = socket.gethostbyname(host)
216
+ except Exception as e:
217
+ print(e)
218
+ print("".center(60, "^"))
219
+ print("".center(60, "-"))
220
+
221
+ hosting = ""
222
+ hosting = host.split(".")
223
+ hosting[len(hosting) - 1] = "0"
224
+ network = ""
225
+ for i in range(len(hosting) - 1):
226
+ network += hosting[i] + "."
227
+ network += "0"
228
+ network += "/24"
229
+ hosting = network
230
+ ip_obj = ipaddress.ip_address(host)
231
+ print(f"Type IP: {type(ip_obj)}")
232
+ print(f"Version IP: {ip_obj.version}")
233
+ network_obj = ipaddress.ip_network(network)
234
+ print(f"Network: {network_obj}")
235
+ print(f"Subnet mask: {network_obj.netmask}")
236
+ try:
237
+ hostname = socket.gethostbyaddr(host)
238
+ print(f"Host:{hostname[0]}")
239
+ except:
240
+ hostname = "Undefined"
241
+ print(f"Host:{hostname}")
242
+ try:
243
+ print(f"IP:{socket.gethostbyname(host)}")
244
+ except Exception as e:
245
+ print(f"IP:{e}")
246
+
247
+ finally:
248
+ print("".center(60, "-"))
249
+ if SnakeArgs().thread:
250
+ print(f"Thread".center(60, "-"))
251
+ for port in ports.keys():
252
+ t = Thread(
253
+ target=is_port_open_threads,
254
+ kwargs={"host": host, "port": port},
255
+ )
256
+ threads.append(t)
257
+ t.start()
258
+ for t in threads:
259
+ t.join()
@@ -1,36 +1,36 @@
1
1
  """Module SnakeScan"""
2
2
 
3
- __version__ = "1.5.7"
3
+ __version__ = "1.5.8"
4
4
  import socket
5
5
  import ipaddress
6
6
  from art import tprint
7
- from datetime import datetime
8
7
  from tqdm import tqdm
9
8
  from termcolor import colored
10
9
  from threading import Thread
11
- import threading
12
10
  from SnakeScan.Check_subnet import Check_network
13
11
 
14
- class Watcher():
12
+
13
+ class Watcher:
15
14
  def __init__(self, host, port_user):
16
15
  self.host = host
17
16
  self.port_user = port_user
18
- watchers=[]
19
- def run(host,port_user):
20
- previous=None
21
- while True:
22
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
23
- connection = sock.connect_ex((host, port_user))
24
- if previous != connection:
25
- if connection == 0:
26
- print(f"Service is up {host}-->|{port_user}|")
27
- else:
28
- print(f"Service is down {host}-->|{port_user}|")
29
- previous = connection
30
- w=Thread(target=run,kwargs={"host":self.host,"port_user":self.port_user})
31
- watchers.append(w)
17
+
18
+ def run(host, port_user):
19
+ previous = None
20
+ while True:
21
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
22
+ connection = sock.connect_ex((host, port_user))
23
+ if previous != connection:
24
+ if connection == 0:
25
+ print(f"Service is up {host}-->|{port_user}|")
26
+ else:
27
+ print(f"Service is down {host}-->|{port_user}|")
28
+ previous = connection
29
+
30
+ w = Thread(target=run, kwargs={"host": self.host, "port_user": self.port_user})
32
31
  w.start()
33
-
32
+
33
+
34
34
  def run():
35
35
  portsopen = 0
36
36
  portsclosed = 0
@@ -113,26 +113,26 @@ def run():
113
113
  print("–" * 60)
114
114
  while Run_now:
115
115
  host = input(f"{colored('[$]','green')}Host-->")
116
- if "--check" in host:
117
- host = host.strip("--check")
116
+ if "-check" in host:
117
+ host = host.strip("-check")
118
118
  host = host.strip()
119
119
  Check_network(host)
120
120
  continue
121
- if "--v" in host:
121
+ if "-v" in host:
122
122
  print(f"Build_{__version__}")
123
123
  continue
124
- if "--h" in host:
125
- host = host.strip("--h")
124
+ if "-help" in host:
125
+ host = host.strip("-help")
126
126
  host = host.strip()
127
127
  if host == "port":
128
- print("Port:|--s port,--t|")
128
+ print("Port:|-s port,-t|")
129
129
  if host:
130
130
  pass
131
131
  else:
132
- print("Host:|host --check,host --i,--l|")
132
+ print("Host:|host -check,host -i,-l,-v|")
133
133
  continue
134
- if "--i" in host:
135
- host = host.strip("--i").strip()
134
+ if "-i" in host:
135
+ host = host.strip("-i").strip()
136
136
  print("".center(60, "-"))
137
137
  try:
138
138
  host = socket.gethostbyname(host)
@@ -192,7 +192,7 @@ def run():
192
192
  host = input(f"{colored('[$]','green')}Host-->")
193
193
  if host:
194
194
  break
195
- if "--l" in host:
195
+ if "-l" in host:
196
196
  local = ""
197
197
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
198
198
  try:
@@ -218,7 +218,7 @@ def run():
218
218
  try:
219
219
  length = int(port_user)
220
220
  except:
221
- if "--t" in str(port_user):
221
+ if "-t" in str(port_user):
222
222
  print(f"Thread".center(60, "-"))
223
223
  for port in ports.keys():
224
224
  t = Thread(
@@ -229,8 +229,8 @@ def run():
229
229
  t.start()
230
230
  for t in threads:
231
231
  t.join()
232
- if "--s" in str(port_user):
233
- port_user = port_single.strip("--s")
232
+ if "-s" in str(port_user):
233
+ port_user = port_single.strip("-s")
234
234
  port_user = port_user.split()
235
235
  port_list = port_user
236
236
  port_user = []
@@ -258,7 +258,7 @@ def run():
258
258
  continue
259
259
 
260
260
  else:
261
- if "--t" in port_user:
261
+ if "-t" in port_user:
262
262
  continue
263
263
  port_user = "100"
264
264
  print(f"{colored('[!]','red')}Port:invalid value")
@@ -273,7 +273,7 @@ def run():
273
273
  port_user = 100
274
274
  length = port_user
275
275
  print(f"{colored('|!|','red')}Listening {host} please wait...")
276
- # |-----------------Starting---------------------|
276
+ # |----------------starting---------------------|
277
277
  length = int(length) + 1
278
278
  for port in tqdm(range(1, length)):
279
279
  if is_port_open(host, port):
@@ -19,4 +19,5 @@ dependencies = [
19
19
  Homepage = "https://github.com/Den-Ram/SnakeScan"
20
20
  Repository = "https://github.com/Den-Ram/SnakeScan"
21
21
  [project.scripts]
22
- SnakeScan = "SnakeScan:run"
22
+ SnakeScan = "SnakeScan:run"
23
+ SnakeConsole = "SnakeScan.SnakeCLI:main"
snakescan-1.5.7/PKG-INFO DELETED
@@ -1,43 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: SnakeScan
3
- Version: 1.5.7
4
- Summary: Module SnakeScan
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
- ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
17
- ![Requires-python](https://img.shields.io/badge/requires--python-3.6+-red)
18
- ![License](https://img.shields.io/badge/License-MIT-blue.svg)
19
- ```
20
- import SnakeScan
21
- SnakeScan.run()
22
- ```
23
- ## Help
24
- - --l need internet to view public ip you device
25
- - --t threading port search
26
- - --s single port search
27
- - --i information about host
28
- - --h in host /--h port in host
29
- - --check [host] scan subnet in ip
30
- - exit in host or port off script
31
- ## Added class Watcher:
32
- ```
33
- for SnakeScan import Watcher
34
- Watcher(host:str,port:int)
35
- ```
36
- ## Added multiple use Watcher:
37
- ```
38
- from SnakeScan import Watcher
39
- ports=[53,80,100,160]
40
- for i in range(len(ports)):
41
- Watcher("127.0.0.1",ports[i])
42
-
43
- ```
snakescan-1.5.7/README.md DELETED
@@ -1,29 +0,0 @@
1
- # SnakeScan
2
- ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
3
- ![Requires-python](https://img.shields.io/badge/requires--python-3.6+-red)
4
- ![License](https://img.shields.io/badge/License-MIT-blue.svg)
5
- ```
6
- import SnakeScan
7
- SnakeScan.run()
8
- ```
9
- ## Help
10
- - --l need internet to view public ip you device
11
- - --t threading port search
12
- - --s single port search
13
- - --i information about host
14
- - --h in host /--h port in host
15
- - --check [host] scan subnet in ip
16
- - exit in host or port off script
17
- ## Added class Watcher:
18
- ```
19
- for SnakeScan import Watcher
20
- Watcher(host:str,port:int)
21
- ```
22
- ## Added multiple use Watcher:
23
- ```
24
- from SnakeScan import Watcher
25
- ports=[53,80,100,160]
26
- for i in range(len(ports)):
27
- Watcher("127.0.0.1",ports[i])
28
-
29
- ```
File without changes