SnakeScan 1.7.4__tar.gz → 1.7.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.
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: SnakeScan
3
+ Version: 1.7.6
4
+ Summary: IPv4 address scanner for collecting address information.Scan or get the IPv4 address from the IPv6 host
5
+ Author: Den*Ram
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Dist: art
11
+ Requires-Dist: tqdm
12
+ Requires-Dist: termcolor
13
+
14
+ <!--
15
+
16
+ This documentation was created with the assistance of the GeekBot language model and Den*Ram
17
+
18
+ -->
19
+
20
+ # 🐍 SnakeScan: A Robust Python Port Scanner
21
+
22
+ A versatile and efficient Python library designed for comprehensive network port scanning.
23
+
24
+ [![PyPI](https://img.shields.io/pypi/v/SnakeScan?color=blue&label=PyPI)](https://pypi.org/project/SnakeScan/)
25
+
26
+ [![MIT License](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)
27
+
28
+ [![Python 3.7+](https://img.shields.io/badge/Python-3.7+-brightgreen)](https://www.python.org/)
29
+
30
+ [![Status: Beta](https://img.shields.io/badge/Status-Beta-yellow)](https://img.shields.io/badge/Status-Beta-yellow)
31
+
32
+ **SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers requiring reliable port scanning capabilities. From basic port verification to advanced, multi-threaded subnet analysis, SnakeScan delivers the tools necessary for effective network assessment.
33
+
34
+ ## ⚙️ Key Features:
35
+
36
+ * **Flexible Port Specification:** Define target ports as single values, ranges, or through pre-configured sets.
37
+
38
+ * **Multi-Threaded Architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
39
+
40
+ * **IP Information Retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
41
+
42
+ * **Real-time Port Monitoring:** Utilize the `Watcher` class for continuous monitoring of critical port statuses.
43
+
44
+ * **Concise Command-Line Interface & API:** Integrate SnakeScan seamlessly into workflows via CLI or programmatic access.
45
+
46
+ * **UDP Port Scanning:** Native support for scanning UDP ports.
47
+
48
+ ## ⬇️ Installation:
49
+
50
+ Install SnakeScan using pip:
51
+
52
+ bash
53
+
54
+ pip install SnakeScan
55
+
56
+ ## ⌨️ Command Line Usage:
57
+
58
+ ### 💡 Attribute Reference:
59
+
60
+ * **-p**: Specify target ports for scanning (single port or range). Note: Range specifications exclude the lower bound on the first entry. Example: To scan from port 80 to 443, define the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
61
+
62
+ * **-u**: Enable UDP port scanning. Example: `snake -p 53 -u`
63
+
64
+ * **-h**: Display the complete list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
65
+
66
+ * **-sp**: Initiate a scan using a predefined set of common ports with `ProcessPoolExecutor`. Example: `snake -sp`
67
+
68
+ * **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
69
+
70
+ * **-gs**: Retrieve the SSL/TLS certificate from a specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
71
+
72
+ * **-t**: Enable multi-threading for enhanced scan performance. Example: `snake -t`
73
+
74
+ * **-ch**: Scan a subnet to discover active IP addresses on the network. Example: `snake -ch`
75
+
76
+ * **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
77
+
78
+ * **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
79
+
80
+ ## 💻 Python Code Integration:
81
+
82
+ ### ⏱️ Watcher Class: Real-Time Port Status
83
+
84
+ The `Watcher` class facilitates continuous monitoring of a specified port.
85
+
86
+ python
87
+
88
+ from SnakeScan import Watcher
89
+
90
+ watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
91
+
92
+ watcher.start() # Begin monitoring!
93
+
94
+ #### `Watcher` Methods:
95
+
96
+ * `Watcher.start()` - Initiate the port monitoring process.
97
+
98
+ * `Watcher.stop()` - Terminate the port monitoring process.
99
+
100
+ ---
101
+
102
+ **Latest Update:** 1.7.6 (Introduced UDP port scanning)
@@ -0,0 +1,89 @@
1
+ <!--
2
+
3
+ This documentation was created with the assistance of the GeekBot language model and Den*Ram
4
+
5
+ -->
6
+
7
+ # 🐍 SnakeScan: A Robust Python Port Scanner
8
+
9
+ A versatile and efficient Python library designed for comprehensive network port scanning.
10
+
11
+ [![PyPI](https://img.shields.io/pypi/v/SnakeScan?color=blue&label=PyPI)](https://pypi.org/project/SnakeScan/)
12
+
13
+ [![MIT License](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)
14
+
15
+ [![Python 3.7+](https://img.shields.io/badge/Python-3.7+-brightgreen)](https://www.python.org/)
16
+
17
+ [![Status: Beta](https://img.shields.io/badge/Status-Beta-yellow)](https://img.shields.io/badge/Status-Beta-yellow)
18
+
19
+ **SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers requiring reliable port scanning capabilities. From basic port verification to advanced, multi-threaded subnet analysis, SnakeScan delivers the tools necessary for effective network assessment.
20
+
21
+ ## ⚙️ Key Features:
22
+
23
+ * **Flexible Port Specification:** Define target ports as single values, ranges, or through pre-configured sets.
24
+
25
+ * **Multi-Threaded Architecture:** Accelerate scanning operations with parallel processing for rapid analysis.
26
+
27
+ * **IP Information Retrieval:** Obtain detailed information about target IP addresses, supporting both IPv4 and IPv6.
28
+
29
+ * **Real-time Port Monitoring:** Utilize the `Watcher` class for continuous monitoring of critical port statuses.
30
+
31
+ * **Concise Command-Line Interface & API:** Integrate SnakeScan seamlessly into workflows via CLI or programmatic access.
32
+
33
+ * **UDP Port Scanning:** Native support for scanning UDP ports.
34
+
35
+ ## ⬇️ Installation:
36
+
37
+ Install SnakeScan using pip:
38
+
39
+ bash
40
+
41
+ pip install SnakeScan
42
+
43
+ ## ⌨️ Command Line Usage:
44
+
45
+ ### 💡 Attribute Reference:
46
+
47
+ * **-p**: Specify target ports for scanning (single port or range). Note: Range specifications exclude the lower bound on the first entry. Example: To scan from port 80 to 443, define the range as `79-443`. Examples: `snake -p 80,443` or `snake -p 80,3437,8080,20-30,79-443`
48
+
49
+ * **-u**: Enable UDP port scanning. Example: `snake -p 53 -u`
50
+
51
+ * **-h**: Display the complete list of available command-line attributes and their descriptions. Example: `snake -h` or `snake -help`
52
+
53
+ * **-sp**: Initiate a scan using a predefined set of common ports with `ProcessPoolExecutor`. Example: `snake -sp`
54
+
55
+ * **-v**: Display the current version of the SnakeScan library. Example: `snake -v`
56
+
57
+ * **-gs**: Retrieve the SSL/TLS certificate from a specified web server. Example: `snake www.google.com -gs` (Requires a valid hostname to avoid connection errors.)
58
+
59
+ * **-t**: Enable multi-threading for enhanced scan performance. Example: `snake -t`
60
+
61
+ * **-ch**: Scan a subnet to discover active IP addresses on the network. Example: `snake -ch`
62
+
63
+ * **-l**: Display your public IP address (requires an active internet connection). Example: `snake -l`
64
+
65
+ * **-i**: Show detailed information about a specific IP address (supports both IPv4 and IPv6). Example: `snake www.google.com -i`
66
+
67
+ ## 💻 Python Code Integration:
68
+
69
+ ### ⏱️ Watcher Class: Real-Time Port Status
70
+
71
+ The `Watcher` class facilitates continuous monitoring of a specified port.
72
+
73
+ python
74
+
75
+ from SnakeScan import Watcher
76
+
77
+ watcher = Watcher("localhost", 53, 2) # Host, port, check interval (in seconds)
78
+
79
+ watcher.start() # Begin monitoring!
80
+
81
+ #### `Watcher` Methods:
82
+
83
+ * `Watcher.start()` - Initiate the port monitoring process.
84
+
85
+ * `Watcher.stop()` - Terminate the port monitoring process.
86
+
87
+ ---
88
+
89
+ **Latest Update:** 1.7.6 (Introduced UDP port scanning)
@@ -11,6 +11,7 @@ from tqdm import tqdm
11
11
  from SnakeScan.Check_subnet import Check_network
12
12
  from SnakeScan.PoolExecutor import PoolProcessExecutor
13
13
  from SnakeScan.Get_ssl import Get_ssl
14
+ from SnakeScan.Pool_UDP_Executor import PoolExecutorUDP
14
15
 
15
16
 
16
17
  def main():
@@ -27,160 +28,49 @@ Bool = True
27
28
  boolsd = True
28
29
  boolean = 0
29
30
  ports = {
30
- 1: "Tcpmux",
31
- 2: "Compressnet-Managment",
32
- 3: "Compressnet-Compression",
33
- 5: "RUE",
34
- 7: "Echo",
35
- 9: "Discard",
36
- 11: "Systat",
37
- 13: "Daytime",
38
- 17: "QOTD",
39
- 18: "MSP",
40
- 19: "Chargen",
41
31
  20: "FTP-Data",
42
32
  21: "FTP-Control",
43
33
  22: "SSH",
44
34
  23: "Telnet",
45
35
  24: "Priv-mail",
46
36
  25: "SMTP",
47
- 27: "NSW-FE",
48
37
  29: "MSG-ICP",
49
38
  31: "MSG-AUTH",
50
39
  33: "DSP",
51
40
  35: "Priv-print",
52
- 37: "Time",
53
- 38: "RAP",
54
- 39: "RLP",
55
41
  41: "Graphics",
56
42
  42: "WINS",
57
43
  43: "Whois",
58
- 44: "MPM-FLAGS",
59
- 45: "MPM",
60
- 46: "MPM-SND",
61
- 47: "NI-FTP",
62
44
  48: "AUDITD",
63
- 49: "TACACS",
64
- 50: "RE-MAIL-CK",
65
- 52: "XNS-TIME",
66
- 53: "DNS",
67
- 54: "XNS-CH",
68
- 55: "ISI-GL",
69
45
  57: "Priv-term",
70
- 58: "XNS-MAIL",
71
46
  59: "Priv-file",
72
- 61: "NI-MAIL",
73
- 62: "ACAS",
74
47
  63: "WHOISPP",
75
- 64: "COVIA",
76
- 65: "TACACS-DS",
77
48
  66: "SQL-NET",
78
- 67: "BOOTPS/DHCP server",
79
- 68: "BOOTPC/DHCP client",
80
- 69: "TFTP",
81
- 70: "Gopher",
82
49
  75: "Priv-dial",
83
- 76: "DEOS",
84
- 77: "Priv-RUE",
85
- 78: "VETTCP",
86
- 79: "Finger",
87
50
  80: "HTTP",
88
- 84: "CTF",
89
- 87: "Priv-term-L",
90
- 88: "Kerberos",
91
- 92: "NPP",
92
- 93: "DCP",
93
- 97: "SWIFT-RVF",
94
- 98: "TACNEWS",
95
- 99: "METAGRAM",
96
- 101: "HOSTNAMESERVER",
97
- 102: "ISO-TSAP",
98
- 103: "GPPITNP",
99
- 104: "ACR-NEMA",
100
- 105: "CSO,CSNET-NS",
101
- 106: "3COM-TSMUX",
102
- 107: "RTELNET",
103
- 108: "SNAGAS",
104
51
  109: "POP2",
105
52
  110: "POP3",
106
- 111: "RPCbind",
107
- 112: "MCIDAS",
108
53
  113: "ident",
109
54
  115: "SFTP",
110
- 116: "ANSANOTIFY",
111
- 117: "UUCP-PATH",
112
55
  118: "SQLServ",
113
56
  119: "NNTP",
114
- 120: "CFDPTKT",
115
- 121: "ERPC",
116
- 122: "SMAKYNET",
117
- 123: "NTP",
118
- 135: "MS-Locator",
119
- 137: "NetBIOS-NS",
120
- 138: "NetBIOS-DGM",
121
57
  139: "NetBIOS-SSN",
122
58
  143: "IMAP",
123
- 161: "SNMP",
124
- 162: "SNMP-trap",
125
59
  179: "BGP",
126
60
  194: "IRC",
127
61
  199: "SMUX",
128
62
  200: "SRC",
129
- 201: "AppleTalk routing maintenance",
130
63
  220: "IMAP3",
131
64
  311: "ASIP-WEBADMIN",
132
- 318: "PKIX-TIMESTAMP",
133
- 321: "PIP",
134
- 322: "RTSPS",
135
- 322: "RPKI-RTR",
136
- 324: "RPKI-RTR-TLS",
137
- 343: "TEXAR",
138
65
  344: "PDAP",
139
66
  345: "PAWSERV",
140
67
  346: "ZSERV",
141
68
  347: "FATSERV",
142
- 381: "HP-COLLECTOR",
143
- 382: "HP-MANAGED-NODE",
144
- 383: "HP-ALARM-MGR",
145
- 384: "ARNS",
146
- 385: "IBM-APP",
147
- 386: "ASA",
148
- 387: "AURP",
149
- 388: "UNIDATA-LDM",
150
- 389: "LDAP",
151
69
  401: "UPS",
152
70
  413: "SMSP",
153
71
  427: "SVRLOC",
154
72
  443: "HTTPS",
155
73
  444: "SNPP",
156
- 445: "SMB/MICROSOFT-DS",
157
- 464: "KPASSWD",
158
- 465: "URD/IGMPV3LITE/SMTPS",
159
- 500: "ISAKMP",
160
- 512: "EXEC/COMSAT/BIFF",
161
- 513: "LOGIN/WHO",
162
- 514: "SHELL/SYSLOG",
163
- 515: "PRINTER",
164
- 520: "RIP",
165
- 524: "NCP",
166
- 530: "COURIER-RPC",
167
- 540: "UUCP",
168
- 541: "UUCP-RLOGIN",
169
- 543: "KLOGIN",
170
- 544: "KSHELL",
171
- 546: "DHCPv6 client",
172
- 547: "DHCPv6 server",
173
- 551: "CYBERCASH",
174
- 554: "RTSP",
175
- 556: "REMOTEFS",
176
- 587: "Submission",
177
- 593: "HTTP-RPC-EPMAP",
178
- 600: "IPCSERVER",
179
- 601: "SYSLOG-CONN",
180
- 602: "XMLRPV-BEEP",
181
- 603: "IDPX",
182
- 604: "TUNNEL",
183
- 605: "SOAP-BEEP",
184
74
  606: "URM",
185
75
  607: "NQS",
186
76
  631: "IPP",
@@ -189,78 +79,41 @@ ports = {
189
79
  646: "LDP",
190
80
  647: "DHCP-FAILOVER",
191
81
  648: "RRP",
192
- 654: "AODV",
193
- 674: "ACAP",
194
- 691: "MSEXCH-ROUTING",
195
- 698: "OLSR",
196
- 700: "EPP",
197
- 701: "LMP",
198
- 702: "IRIS-BEEP",
199
- 704: "ELCSD",
200
- 705: "AGENTX",
201
- 706: "SILC",
202
- 707: "BORLAND-DSJ",
203
- 709: "ENTRUST-KMSH",
204
- 710: "ENTRUST-ASH",
205
- 711: "CISCO-TDP",
206
- 712: "TBRPF",
207
- 713: "IRIS-XPC/IRIS-XPCS",
208
- 715: "IRIS-LWZ",
209
- 716: "PANA",
210
- 729: "NETVIEWDM1",
211
- 730: "NETVIEWDM2",
212
- 731: "NETVIEWDM3",
213
- 748: "KERBEROS-ADM/RIS-CM",
214
- 750: "KERBEROS-IV",
215
82
  753: "RRH",
216
83
  830: "NETCONF-SSH",
217
84
  831: "NETCONF-BEEP",
218
85
  832: "NETCONFSOAPHTTP",
219
86
  833: "NETCONFSOAPBEEP",
220
- 847: "DHCP-FAILOVER2",
221
- 848: "GDOI",
222
- 860: "ISCSI",
223
87
  861: "OWAMP-CONTROL",
224
88
  862: "TWAPM-CONTROL",
225
89
  873: "RSYNC",
226
90
  989: "FTPS-DATA",
227
91
  990: "FTPS",
228
- 991: "NAS",
229
- 992: "TELNETS",
230
- 993: "IMAPS",
231
92
  995: "POP3S",
232
93
  1038: "MTQP",
233
94
  1080: "SOCKS",
234
95
  1194: "OpenVPN",
235
- 1433: "Microsoft SQL server",
236
- 1521: "Oracle",
96
+ 1433: "SQL server",
237
97
  1723: "PPTP",
238
- 2049: "NFS",
239
98
  2222: "SSH",
240
- 3050: "gds_db-Interbase/Firebird",
241
- 3074: "Xbox Live",
242
99
  3128: "HTTP",
243
100
  3268: "LDAP",
244
101
  3306: "MySQL",
245
- 3386: "GTP 3GPP GSM/UMTS CDR logging protocol",
246
102
  3389: "RDP",
247
103
  3455: "RSVP",
248
104
  3632: "Distributed compiler",
249
105
  3689: "DAAP",
250
- 3702: "WS-Discovery",
251
- 5060: "SIP",
252
- 5353: "MDNS",
253
106
  5432: "PostgreSQL",
254
107
  5900: "VNC",
255
- 8000: "HTTP alternate",
256
- 8080: "HTTP alternate",
257
- 8443: "HTTPS alternate",
258
- 8888: "HTTP alternate",
108
+ 8000: "HTTP",
109
+ 8080: "HTTP",
110
+ 8443: "HTTPS",
111
+ 8888: "HTTP",
259
112
  10000: "Webmin",
260
113
  }
261
114
 
262
115
 
263
- version = "1.7.4"
116
+ version = "1.7.6"
264
117
 
265
118
 
266
119
  def is_port_open(host, port):
@@ -320,6 +173,9 @@ def SnakeArgs():
320
173
  description="SnakeScan - It's a command line library for scan and get information about ip."
321
174
  )
322
175
  parser.add_argument("host", nargs="?", default="None")
176
+ parser.add_argument(
177
+ "-u", "--udp", action="store_true", help="Use UDP ports for scanning"
178
+ )
323
179
  parser.add_argument(
324
180
  "-gs", "--getssl", action="store_true", help="Get official ssl certificate"
325
181
  )
@@ -373,6 +229,170 @@ for n in range(len(host)):
373
229
  host[n] = host[n][0:i]
374
230
  if host[0] == "None":
375
231
  host[0] = "localhost"
232
+ if SnakeArgs().udp:
233
+
234
+ def is_port_open(host, port, timeout=1):
235
+ try:
236
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
237
+ sock.settimeout(timeout)
238
+ message = b"Test UDP packet"
239
+ address = (host, port)
240
+
241
+ sock.sendto(message, address)
242
+
243
+ try:
244
+ data, server = sock.recvfrom(4096)
245
+ print(f"Response received: {data.decode()} from {server}")
246
+ is_open = True
247
+ except socket.timeout:
248
+ is_open = False
249
+ except ConnectionRefusedError:
250
+ is_open = False
251
+
252
+ sock.close()
253
+ return is_open
254
+
255
+ except socket.gaierror:
256
+ print("Error: Unable to resolve host name.")
257
+ return None
258
+ except socket.error as e:
259
+ print(f"Socket error: {e}")
260
+ return False
261
+
262
+ def is_port_open_threads(host, port, timeout=1):
263
+ try:
264
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
265
+ sock.settimeout(timeout)
266
+ message = b"Test UDP packet"
267
+ address = (host, port)
268
+
269
+ sock.sendto(message, address)
270
+
271
+ try:
272
+ data, server = sock.recvfrom(4096)
273
+ print(f"Response received: {data.decode()} from {server}")
274
+ print(
275
+ f"Open{colored('[√]','green')}-->{ports.get(port)}|{port}| may be listening on host"
276
+ )
277
+ except socket.timeout:
278
+ print(
279
+ f"Closed{colored('[X]','red')}-->{ports.get(port)}|{port}| is likely closed on host"
280
+ )
281
+ except ConnectionRefusedError:
282
+ print("An error occurred while scanning.")
283
+ sock.close()
284
+ except socket.gaierror:
285
+ print("Error: Unable to resolve host name.")
286
+ except socket.error as e:
287
+ print(f"Socket error: {e}")
288
+
289
+ ports = {
290
+ 7: "Echo",
291
+ 9: "Discard",
292
+ 19: "Chargen",
293
+ 37: "Time",
294
+ 53: "DNS",
295
+ 67: "BOOTPS/DHCP server",
296
+ 68: "BOOTPC/DHCP client",
297
+ 69: "TFTP",
298
+ 123: "NTP",
299
+ 137: "NetBIOS-NS",
300
+ 138: "NetBIOS-DGM",
301
+ 161: "SNMP",
302
+ 162: "SNMP-trap",
303
+ 389: "LDAP",
304
+ 500: "ISAKMP",
305
+ 520: "RIP",
306
+ 5353: "MDNS",
307
+ 546: "DHCPv6 client",
308
+ 547: "DHCPv6 server",
309
+ 2049: "NFS",
310
+ }
311
+ else:
312
+ ports = {
313
+ 20: "FTP-Data",
314
+ 21: "FTP-Control",
315
+ 22: "SSH",
316
+ 23: "Telnet",
317
+ 24: "Priv-mail",
318
+ 25: "SMTP",
319
+ 29: "MSG-ICP",
320
+ 31: "MSG-AUTH",
321
+ 33: "DSP",
322
+ 35: "Priv-print",
323
+ 41: "Graphics",
324
+ 42: "WINS",
325
+ 43: "Whois",
326
+ 48: "AUDITD",
327
+ 57: "Priv-term",
328
+ 59: "Priv-file",
329
+ 63: "WHOISPP",
330
+ 66: "SQL-NET",
331
+ 75: "Priv-dial",
332
+ 80: "HTTP",
333
+ 109: "POP2",
334
+ 110: "POP3",
335
+ 113: "ident",
336
+ 115: "SFTP",
337
+ 118: "SQLServ",
338
+ 119: "NNTP",
339
+ 139: "NetBIOS-SSN",
340
+ 143: "IMAP",
341
+ 179: "BGP",
342
+ 194: "IRC",
343
+ 199: "SMUX",
344
+ 200: "SRC",
345
+ 220: "IMAP3",
346
+ 311: "ASIP-WEBADMIN",
347
+ 344: "PDAP",
348
+ 345: "PAWSERV",
349
+ 346: "ZSERV",
350
+ 347: "FATSERV",
351
+ 401: "UPS",
352
+ 413: "SMSP",
353
+ 427: "SVRLOC",
354
+ 443: "HTTPS",
355
+ 444: "SNPP",
356
+ 606: "URM",
357
+ 607: "NQS",
358
+ 631: "IPP",
359
+ 636: "LDAPS",
360
+ 639: "MSDP",
361
+ 646: "LDP",
362
+ 647: "DHCP-FAILOVER",
363
+ 648: "RRP",
364
+ 753: "RRH",
365
+ 830: "NETCONF-SSH",
366
+ 831: "NETCONF-BEEP",
367
+ 832: "NETCONFSOAPHTTP",
368
+ 833: "NETCONFSOAPBEEP",
369
+ 861: "OWAMP-CONTROL",
370
+ 862: "TWAPM-CONTROL",
371
+ 873: "RSYNC",
372
+ 989: "FTPS-DATA",
373
+ 990: "FTPS",
374
+ 995: "POP3S",
375
+ 1038: "MTQP",
376
+ 1080: "SOCKS",
377
+ 1194: "OpenVPN",
378
+ 1433: "SQL server",
379
+ 1723: "PPTP",
380
+ 2222: "SSH",
381
+ 3128: "HTTP",
382
+ 3268: "LDAP",
383
+ 3306: "MySQL",
384
+ 3389: "RDP",
385
+ 3455: "RSVP",
386
+ 3632: "Distributed compiler",
387
+ 3689: "DAAP",
388
+ 5432: "PostgreSQL",
389
+ 5900: "VNC",
390
+ 8000: "HTTP",
391
+ 8080: "HTTP",
392
+ 8443: "HTTPS",
393
+ 8888: "HTTP",
394
+ 10000: "Webmin",
395
+ }
376
396
  if SnakeArgs().ports:
377
397
  rangeports, port_user = Ports(port_user)
378
398
  for i in range(len(port_user)):
@@ -538,6 +558,11 @@ if SnakeArgs().thread:
538
558
  if SnakeArgs().version:
539
559
  print(f"SnakeScan_Build_{version}")
540
560
  if SnakeArgs().speed:
561
+ if SnakeArgs().udp:
562
+ for n in range(len(host)):
563
+ print(f"{host[n]}".center(60, "—"))
564
+ PoolExecutorUDP(host[n])
565
+ sys.exit()
541
566
  for n in range(len(host)):
542
567
  print(f"{host[n]}".center(60, "—"))
543
568
  PoolProcessExecutor(host[n])
@@ -9,7 +9,7 @@ def Get_ssl(host, port=443, timeout=2, protocol="HTTP/1.0"):
9
9
  context = ssl.create_default_context()
10
10
  ssock = context.wrap_socket(sock, server_hostname=host)
11
11
  ssock.sendall(f"GET / {protocol}\r\nHost:{host}\r\n\r\n".encode("utf-8"))
12
- data = ssock.recv(8192)
12
+ data = ssock.recv(4096)
13
13
  print(data.decode(errors="replace"))
14
14
  ssock.close()
15
15
  except Exception as e:
@@ -0,0 +1,112 @@
1
+ import socket
2
+ from termcolor import colored
3
+ from concurrent.futures import ProcessPoolExecutor
4
+
5
+ ports = {
6
+ 20: "FTP-Data",
7
+ 21: "FTP-Control",
8
+ 22: "SSH",
9
+ 23: "Telnet",
10
+ 24: "Priv-mail",
11
+ 25: "SMTP",
12
+ 29: "MSG-ICP",
13
+ 31: "MSG-AUTH",
14
+ 33: "DSP",
15
+ 35: "Priv-print",
16
+ 41: "Graphics",
17
+ 42: "WINS",
18
+ 43: "Whois",
19
+ 48: "AUDITD",
20
+ 57: "Priv-term",
21
+ 59: "Priv-file",
22
+ 63: "WHOISPP",
23
+ 66: "SQL-NET",
24
+ 75: "Priv-dial",
25
+ 80: "HTTP",
26
+ 109: "POP2",
27
+ 110: "POP3",
28
+ 113: "ident",
29
+ 115: "SFTP",
30
+ 118: "SQLServ",
31
+ 119: "NNTP",
32
+ 139: "NetBIOS-SSN",
33
+ 143: "IMAP",
34
+ 179: "BGP",
35
+ 194: "IRC",
36
+ 199: "SMUX",
37
+ 200: "SRC",
38
+ 220: "IMAP3",
39
+ 311: "ASIP-WEBADMIN",
40
+ 344: "PDAP",
41
+ 345: "PAWSERV",
42
+ 346: "ZSERV",
43
+ 347: "FATSERV",
44
+ 401: "UPS",
45
+ 413: "SMSP",
46
+ 427: "SVRLOC",
47
+ 443: "HTTPS",
48
+ 444: "SNPP",
49
+ 606: "URM",
50
+ 607: "NQS",
51
+ 631: "IPP",
52
+ 636: "LDAPS",
53
+ 639: "MSDP",
54
+ 646: "LDP",
55
+ 647: "DHCP-FAILOVER",
56
+ 648: "RRP",
57
+ 753: "RRH",
58
+ 830: "NETCONF-SSH",
59
+ 831: "NETCONF-BEEP",
60
+ 832: "NETCONFSOAPHTTP",
61
+ 833: "NETCONFSOAPBEEP",
62
+ 861: "OWAMP-CONTROL",
63
+ 862: "TWAPM-CONTROL",
64
+ 873: "RSYNC",
65
+ 989: "FTPS-DATA",
66
+ 990: "FTPS",
67
+ 995: "POP3S",
68
+ 1038: "MTQP",
69
+ 1080: "SOCKS",
70
+ 1194: "OpenVPN",
71
+ 1433: "SQL server",
72
+ 1723: "PPTP",
73
+ 2222: "SSH",
74
+ 3128: "HTTP",
75
+ 3268: "LDAP",
76
+ 3306: "MySQL",
77
+ 3389: "RDP",
78
+ 3455: "RSVP",
79
+ 3632: "Distributed compiler",
80
+ 3689: "DAAP",
81
+ 5432: "PostgreSQL",
82
+ 5900: "VNC",
83
+ 8000: "HTTP",
84
+ 8080: "HTTP",
85
+ 8443: "HTTPS",
86
+ 8888: "HTTP",
87
+ 10000: "Webmin",
88
+ }
89
+
90
+
91
+ def is_port_open_threads(host, port):
92
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
93
+ try:
94
+ s.settimeout(1)
95
+ s.connect((host, port))
96
+ except (OSError, socket.timeout):
97
+ try:
98
+ print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
99
+ except:
100
+ print(f"Closed{colored('|X|','red')}-->|{port}|")
101
+ else:
102
+ print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
103
+
104
+
105
+ def PoolProcessExecutor(host):
106
+ with ProcessPoolExecutor(max_workers=None) as executor:
107
+ try:
108
+ for port in ports.keys():
109
+ future = executor.submit(is_port_open_threads, host, port)
110
+
111
+ except Exception as e:
112
+ print(e)
@@ -0,0 +1,64 @@
1
+ import socket
2
+ from termcolor import colored
3
+ from concurrent.futures import ProcessPoolExecutor
4
+
5
+ ports = {
6
+ 7: "Echo",
7
+ 9: "Discard",
8
+ 19: "Chargen",
9
+ 37: "Time",
10
+ 53: "DNS",
11
+ 67: "BOOTPS/DHCP server",
12
+ 68: "BOOTPC/DHCP client",
13
+ 69: "TFTP",
14
+ 123: "NTP",
15
+ 137: "NetBIOS-NS",
16
+ 138: "NetBIOS-DGM",
17
+ 161: "SNMP",
18
+ 162: "SNMP-trap",
19
+ 389: "LDAP",
20
+ 500: "ISAKMP",
21
+ 520: "RIP",
22
+ 5353: "MDNS",
23
+ 546: "DHCPv6 client",
24
+ 547: "DHCPv6 server",
25
+ 2049: "NFS",
26
+ }
27
+
28
+
29
+ def is_port_open_threads(host, port, timeout=1):
30
+ try:
31
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
32
+ sock.settimeout(timeout)
33
+ message = b"Test UDP packet"
34
+ address = (host, port)
35
+
36
+ sock.sendto(message, address)
37
+
38
+ try:
39
+ data, server = sock.recvfrom(4096)
40
+ print(f"Response received: {data.decode()} from {server}")
41
+ print(
42
+ f"Open{colored('[√]','green')}-->{ports.get(port)}|{port}| may be listening on host"
43
+ )
44
+ except socket.timeout:
45
+ print(
46
+ f"Closed{colored('[X]','red')}-->{ports.get(port)}|{port}| is likely closed on host"
47
+ )
48
+ except ConnectionRefusedError:
49
+ print("An error occurred while scanning.")
50
+ sock.close()
51
+ except socket.gaierror:
52
+ print("Error: Unable to resolve host name.")
53
+ except socket.error as e:
54
+ print(f"Socket error: {e}")
55
+
56
+
57
+ def PoolExecutorUDP(host):
58
+ with ProcessPoolExecutor(max_workers=None) as executor:
59
+ try:
60
+ for port in ports.keys():
61
+ future = executor.submit(is_port_open_threads, host, port)
62
+
63
+ except Exception as e:
64
+ print(e)
@@ -1,6 +1,6 @@
1
1
  """IPv4 address scanner for collecting address information.Scan or get the IPv4 address from the IPv6 host"""
2
2
 
3
- __version__ = "1.7.4"
3
+ __version__ = "1.7.6"
4
4
  import socket
5
5
  from time import sleep
6
6
  from termcolor import colored
snakescan-1.7.4/PKG-INFO DELETED
@@ -1,67 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: SnakeScan
3
- Version: 1.7.4
4
- Summary: IPv4 address scanner for collecting address information.Scan or get the IPv4 address from the IPv6 host
5
- Author: Den*Ram
6
- Requires-Python: >=3.7
7
- Description-Content-Type: text/markdown
8
- License-Expression: MIT
9
- License-File: LICENSE
10
- Requires-Dist: art
11
- Requires-Dist: tqdm
12
- Requires-Dist: termcolor
13
-
14
- # SnakeScan
15
- ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
16
- ![License](https://img.shields.io/badge/License-MIT-blue.svg)
17
- ![Requires-python](https://img.shields.io/badge/requires--python-3.7+-black)
18
- ![Status](https://img.shields.io/badge/Version-in%20Beta-black)
19
- ![Platforms](https://img.shields.io/badge/Platforms-macOS%20%7C%20Linux%20%7C%20Windows-blue)
20
-
21
- ## Help with using the library
22
- - -l need internet to view public ip you device
23
- - -t threading port search
24
- - -s single search ports
25
- - -i information about host
26
- - -help in host /-help port in host
27
- - -check [host] scan subnet in ip
28
- - exit in host or port off script
29
-
30
- ### Watcher commands
31
- ```
32
- Watcher.start() - Starts checking ports
33
- Watcher.stop() - Stops port checking
34
- ```
35
- ### Watcher
36
- ```
37
- from SnakeScan import Watcher
38
- watcher = Watcher("localhost",53,2)
39
- watcher.start()
40
- ```
41
- ### Help with attributes
42
- ```
43
- -P:
44
- snake -p 80,443 #Scanning specific ports
45
- snake -p 80,3437,8080,20-30,79-443 #Scanning individual ports and ranges. If you use ranges, then one port from the beginning is not be taken into account. For example:80-443 then it will start with 81-443, so you need to enter it from 79-443, then it will be taken into account
46
- snake -p 80,3437,10-0,20-10,443-79 #You can enter ranges the other way around: 80-443,443-80 but the first value will start one port higher
47
- -H:
48
- #Displays a list of attribute usages
49
- snake -h
50
- snake -help
51
- -SP:
52
- -sp:snake -sp #Uses selected pre-selected range and uses for scanning ProcessPoolExecutor
53
- -V:
54
- snake -v #Shows the library version
55
- -GS:
56
- snake www.google.com -gs #Get a certificate from the official website. If you don't enter the hostname, you'll get this error [Errno 111] Connection refused
57
- -T:
58
- snake -t #Uses threads for port scanning
59
- -CH:
60
- snake -ch #Scans the subnet for others IP
61
- -L:
62
- snake -l #Shows your public internet IP address. Internet connection required for use
63
- -I:
64
- snake www.google.com -i #Shows information about the IP address.Can receive information from IPV4 and IPV6
65
-
66
- #Update in 1.7.4
67
- - Added more standart ports to fast scan
snakescan-1.7.4/README.md DELETED
@@ -1,54 +0,0 @@
1
- # SnakeScan
2
- ![PyPI version](https://badge.fury.io/py/SnakeScan.svg)
3
- ![License](https://img.shields.io/badge/License-MIT-blue.svg)
4
- ![Requires-python](https://img.shields.io/badge/requires--python-3.7+-black)
5
- ![Status](https://img.shields.io/badge/Version-in%20Beta-black)
6
- ![Platforms](https://img.shields.io/badge/Platforms-macOS%20%7C%20Linux%20%7C%20Windows-blue)
7
-
8
- ## Help with using the library
9
- - -l need internet to view public ip you device
10
- - -t threading port search
11
- - -s single search ports
12
- - -i information about host
13
- - -help in host /-help port in host
14
- - -check [host] scan subnet in ip
15
- - exit in host or port off script
16
-
17
- ### Watcher commands
18
- ```
19
- Watcher.start() - Starts checking ports
20
- Watcher.stop() - Stops port checking
21
- ```
22
- ### Watcher
23
- ```
24
- from SnakeScan import Watcher
25
- watcher = Watcher("localhost",53,2)
26
- watcher.start()
27
- ```
28
- ### Help with attributes
29
- ```
30
- -P:
31
- snake -p 80,443 #Scanning specific ports
32
- snake -p 80,3437,8080,20-30,79-443 #Scanning individual ports and ranges. If you use ranges, then one port from the beginning is not be taken into account. For example:80-443 then it will start with 81-443, so you need to enter it from 79-443, then it will be taken into account
33
- snake -p 80,3437,10-0,20-10,443-79 #You can enter ranges the other way around: 80-443,443-80 but the first value will start one port higher
34
- -H:
35
- #Displays a list of attribute usages
36
- snake -h
37
- snake -help
38
- -SP:
39
- -sp:snake -sp #Uses selected pre-selected range and uses for scanning ProcessPoolExecutor
40
- -V:
41
- snake -v #Shows the library version
42
- -GS:
43
- snake www.google.com -gs #Get a certificate from the official website. If you don't enter the hostname, you'll get this error [Errno 111] Connection refused
44
- -T:
45
- snake -t #Uses threads for port scanning
46
- -CH:
47
- snake -ch #Scans the subnet for others IP
48
- -L:
49
- snake -l #Shows your public internet IP address. Internet connection required for use
50
- -I:
51
- snake www.google.com -i #Shows information about the IP address.Can receive information from IPV4 and IPV6
52
-
53
- #Update in 1.7.4
54
- - Added more standart ports to fast scan
@@ -1,260 +0,0 @@
1
- import socket
2
- from termcolor import colored
3
- from concurrent.futures import ProcessPoolExecutor
4
-
5
- ports = {
6
- 1: "Tcpmux",
7
- 2: "Compressnet-Managment",
8
- 3: "Compressnet-Compression",
9
- 5: "RUE",
10
- 7: "Echo",
11
- 9: "Discard",
12
- 11: "Systat",
13
- 13: "Daytime",
14
- 17: "QOTD",
15
- 18: "MSP",
16
- 19: "Chargen",
17
- 20: "FTP-Data",
18
- 21: "FTP-Control",
19
- 22: "SSH",
20
- 23: "Telnet",
21
- 24: "Priv-mail",
22
- 25: "SMTP",
23
- 27: "NSW-FE",
24
- 29: "MSG-ICP",
25
- 31: "MSG-AUTH",
26
- 33: "DSP",
27
- 35: "Priv-print",
28
- 37: "Time",
29
- 38: "RAP",
30
- 39: "RLP",
31
- 41: "Graphics",
32
- 42: "WINS",
33
- 43: "Whois",
34
- 44: "MPM-FLAGS",
35
- 45: "MPM",
36
- 46: "MPM-SND",
37
- 47: "NI-FTP",
38
- 48: "AUDITD",
39
- 49: "TACACS",
40
- 50: "RE-MAIL-CK",
41
- 52: "XNS-TIME",
42
- 53: "DNS",
43
- 54: "XNS-CH",
44
- 55: "ISI-GL",
45
- 57: "Priv-term",
46
- 58: "XNS-MAIL",
47
- 59: "Priv-file",
48
- 61: "NI-MAIL",
49
- 62: "ACAS",
50
- 63: "WHOISPP",
51
- 64: "COVIA",
52
- 65: "TACACS-DS",
53
- 66: "SQL-NET",
54
- 67: "BOOTPS/DHCP server",
55
- 68: "BOOTPC/DHCP client",
56
- 69: "TFTP",
57
- 70: "Gopher",
58
- 75: "Priv-dial",
59
- 76: "DEOS",
60
- 77: "Priv-RUE",
61
- 78: "VETTCP",
62
- 79: "Finger",
63
- 80: "HTTP",
64
- 84: "CTF",
65
- 87: "Priv-term-L",
66
- 88: "Kerberos",
67
- 92: "NPP",
68
- 93: "DCP",
69
- 97: "SWIFT-RVF",
70
- 98: "TACNEWS",
71
- 99: "METAGRAM",
72
- 101: "HOSTNAMESERVER",
73
- 102: "ISO-TSAP",
74
- 103: "GPPITNP",
75
- 104: "ACR-NEMA",
76
- 105: "CSO,CSNET-NS",
77
- 106: "3COM-TSMUX",
78
- 107: "RTELNET",
79
- 108: "SNAGAS",
80
- 109: "POP2",
81
- 110: "POP3",
82
- 111: "RPCbind",
83
- 112: "MCIDAS",
84
- 113: "ident",
85
- 115: "SFTP",
86
- 116: "ANSANOTIFY",
87
- 117: "UUCP-PATH",
88
- 118: "SQLServ",
89
- 119: "NNTP",
90
- 120: "CFDPTKT",
91
- 121: "ERPC",
92
- 122: "SMAKYNET",
93
- 123: "NTP",
94
- 135: "MS-Locator",
95
- 137: "NetBIOS-NS",
96
- 138: "NetBIOS-DGM",
97
- 139: "NetBIOS-SSN",
98
- 143: "IMAP",
99
- 161: "SNMP",
100
- 162: "SNMP-trap",
101
- 179: "BGP",
102
- 194: "IRC",
103
- 199: "SMUX",
104
- 200: "SRC",
105
- 201: "AppleTalk routing maintenance",
106
- 220: "IMAP3",
107
- 311: "ASIP-WEBADMIN",
108
- 318: "PKIX-TIMESTAMP",
109
- 321: "PIP",
110
- 322: "RTSPS",
111
- 322: "RPKI-RTR",
112
- 324: "RPKI-RTR-TLS",
113
- 343: "TEXAR",
114
- 344: "PDAP",
115
- 345: "PAWSERV",
116
- 346: "ZSERV",
117
- 347: "FATSERV",
118
- 381: "HP-COLLECTOR",
119
- 382: "HP-MANAGED-NODE",
120
- 383: "HP-ALARM-MGR",
121
- 384: "ARNS",
122
- 385: "IBM-APP",
123
- 386: "ASA",
124
- 387: "AURP",
125
- 388: "UNIDATA-LDM",
126
- 389: "LDAP",
127
- 401: "UPS",
128
- 413: "SMSP",
129
- 427: "SVRLOC",
130
- 443: "HTTPS",
131
- 444: "SNPP",
132
- 445: "SMB/MICROSOFT-DS",
133
- 464: "KPASSWD",
134
- 465: "URD/IGMPV3LITE/SMTPS",
135
- 500: "ISAKMP",
136
- 512: "EXEC/COMSAT/BIFF",
137
- 513: "LOGIN/WHO",
138
- 514: "SHELL/SYSLOG",
139
- 515: "PRINTER",
140
- 520: "RIP",
141
- 524: "NCP",
142
- 530: "COURIER-RPC",
143
- 540: "UUCP",
144
- 541: "UUCP-RLOGIN",
145
- 543: "KLOGIN",
146
- 544: "KSHELL",
147
- 546: "DHCPv6 client",
148
- 547: "DHCPv6 server",
149
- 551: "CYBERCASH",
150
- 554: "RTSP",
151
- 556: "REMOTEFS",
152
- 587: "Submission",
153
- 593: "HTTP-RPC-EPMAP",
154
- 600: "IPCSERVER",
155
- 601: "SYSLOG-CONN",
156
- 602: "XMLRPV-BEEP",
157
- 603: "IDPX",
158
- 604: "TUNNEL",
159
- 605: "SOAP-BEEP",
160
- 606: "URM",
161
- 607: "NQS",
162
- 631: "IPP",
163
- 636: "LDAPS",
164
- 639: "MSDP",
165
- 646: "LDP",
166
- 647: "DHCP-FAILOVER",
167
- 648: "RRP",
168
- 654: "AODV",
169
- 674: "ACAP",
170
- 691: "MSEXCH-ROUTING",
171
- 698: "OLSR",
172
- 700: "EPP",
173
- 701: "LMP",
174
- 702: "IRIS-BEEP",
175
- 704: "ELCSD",
176
- 705: "AGENTX",
177
- 706: "SILC",
178
- 707: "BORLAND-DSJ",
179
- 709: "ENTRUST-KMSH",
180
- 710: "ENTRUST-ASH",
181
- 711: "CISCO-TDP",
182
- 712: "TBRPF",
183
- 713: "IRIS-XPC/IRIS-XPCS",
184
- 715: "IRIS-LWZ",
185
- 716: "PANA",
186
- 729: "NETVIEWDM1",
187
- 730: "NETVIEWDM2",
188
- 731: "NETVIEWDM3",
189
- 748: "KERBEROS-ADM/RIS-CM",
190
- 750: "KERBEROS-IV",
191
- 753: "RRH",
192
- 830: "NETCONF-SSH",
193
- 831: "NETCONF-BEEP",
194
- 832: "NETCONFSOAPHTTP",
195
- 833: "NETCONFSOAPBEEP",
196
- 847: "DHCP-FAILOVER2",
197
- 848: "GDOI",
198
- 860: "ISCSI",
199
- 861: "OWAMP-CONTROL",
200
- 862: "TWAPM-CONTROL",
201
- 873: "RSYNC",
202
- 989: "FTPS-DATA",
203
- 990: "FTPS",
204
- 991: "NAS",
205
- 992: "TELNETS",
206
- 993: "IMAPS",
207
- 995: "POP3S",
208
- 1038: "MTQP",
209
- 1080: "SOCKS",
210
- 1194: "OpenVPN",
211
- 1433: "Microsoft SQL server",
212
- 1521: "Oracle",
213
- 1723: "PPTP",
214
- 2049: "NFS",
215
- 2222: "SSH",
216
- 3050: "gds_db-Interbase/Firebird",
217
- 3074: "Xbox Live",
218
- 3128: "HTTP",
219
- 3268: "LDAP",
220
- 3306: "MySQL",
221
- 3386: "GTP 3GPP GSM/UMTS CDR logging protocol",
222
- 3389: "RDP",
223
- 3455: "RSVP",
224
- 3632: "Distributed compiler",
225
- 3689: "DAAP",
226
- 3702: "WS-Discovery",
227
- 5060: "SIP",
228
- 5353: "MDNS",
229
- 5432: "PostgreSQL",
230
- 5900: "VNC",
231
- 8000: "HTTP alternate",
232
- 8080: "HTTP alternate",
233
- 8443: "HTTPS alternate",
234
- 8888: "HTTP alternate",
235
- 10000: "Webmin",
236
- }
237
-
238
-
239
- def is_port_open_threads(host, port):
240
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
241
- try:
242
- s.settimeout(1)
243
- s.connect((host, port))
244
- except (OSError, socket.timeout):
245
- try:
246
- print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
247
- except:
248
- print(f"Closed{colored('|X|','red')}-->|{port}|")
249
- else:
250
- print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
251
-
252
-
253
- def PoolProcessExecutor(host):
254
- with ProcessPoolExecutor(max_workers=None) as executor:
255
- try:
256
- for port in ports.keys():
257
- future = executor.submit(is_port_open_threads, host, port)
258
-
259
- except Exception as e:
260
- print(e)
File without changes
File without changes