SnakeScan 1.7.6__tar.gz → 1.7.7__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.7.6
3
+ Version: 1.7.7
4
4
  Summary: IPv4 address scanner for collecting address information.Scan or get the IPv4 address from the IPv6 host
5
5
  Author: Den*Ram
6
6
  Requires-Python: >=3.7
@@ -24,96 +24,57 @@ OpenPorts = []
24
24
  threads = []
25
25
  portsopen = 0
26
26
  portsclosed = 0
27
- Bool = True
28
- boolsd = True
29
- boolean = 0
30
27
  ports = {
31
28
  20: "FTP-Data",
32
29
  21: "FTP-Control",
33
30
  22: "SSH",
34
31
  23: "Telnet",
35
- 24: "Priv-mail",
36
32
  25: "SMTP",
37
- 29: "MSG-ICP",
38
- 31: "MSG-AUTH",
39
- 33: "DSP",
40
- 35: "Priv-print",
41
- 41: "Graphics",
42
- 42: "WINS",
43
33
  43: "Whois",
44
- 48: "AUDITD",
45
- 57: "Priv-term",
46
- 59: "Priv-file",
47
- 63: "WHOISPP",
48
- 66: "SQL-NET",
49
- 75: "Priv-dial",
34
+ 53: "DNS",
35
+ 70: "Gopher",
36
+ 79: "FINGER",
50
37
  80: "HTTP",
51
- 109: "POP2",
52
38
  110: "POP3",
39
+ 111: "RPC",
53
40
  113: "ident",
54
41
  115: "SFTP",
55
- 118: "SQLServ",
56
- 119: "NNTP",
42
+ 135: "MSRPC",
57
43
  139: "NetBIOS-SSN",
58
44
  143: "IMAP",
59
45
  179: "BGP",
60
46
  194: "IRC",
61
- 199: "SMUX",
62
- 200: "SRC",
63
- 220: "IMAP3",
64
- 311: "ASIP-WEBADMIN",
65
- 344: "PDAP",
66
- 345: "PAWSERV",
67
- 346: "ZSERV",
68
- 347: "FATSERV",
69
- 401: "UPS",
70
- 413: "SMSP",
71
- 427: "SVRLOC",
47
+ 389: "LDAP",
72
48
  443: "HTTPS",
73
- 444: "SNPP",
74
- 606: "URM",
75
- 607: "NQS",
49
+ 445: "SMB",
50
+ 465: "SMTPS",
51
+ 587: "SMTP Submission",
76
52
  631: "IPP",
77
53
  636: "LDAPS",
78
- 639: "MSDP",
79
- 646: "LDP",
80
- 647: "DHCP-FAILOVER",
81
- 648: "RRP",
82
- 753: "RRH",
83
- 830: "NETCONF-SSH",
84
- 831: "NETCONF-BEEP",
85
- 832: "NETCONFSOAPHTTP",
86
- 833: "NETCONFSOAPBEEP",
87
- 861: "OWAMP-CONTROL",
88
- 862: "TWAPM-CONTROL",
89
54
  873: "RSYNC",
90
- 989: "FTPS-DATA",
91
- 990: "FTPS",
55
+ 993: "IMAPS",
92
56
  995: "POP3S",
93
- 1038: "MTQP",
94
57
  1080: "SOCKS",
95
- 1194: "OpenVPN",
96
- 1433: "SQL server",
97
- 1723: "PPTP",
58
+ 1433: "SQL Server",
59
+ 1521: "Oracle",
60
+ 2082: "CPanel",
61
+ 2083: "CPanel",
98
62
  2222: "SSH",
99
- 3128: "HTTP",
100
- 3268: "LDAP",
63
+ 3128: "HTTP Proxy",
101
64
  3306: "MySQL",
102
65
  3389: "RDP",
103
- 3455: "RSVP",
104
- 3632: "Distributed compiler",
105
- 3689: "DAAP",
106
66
  5432: "PostgreSQL",
107
67
  5900: "VNC",
108
- 8000: "HTTP",
109
- 8080: "HTTP",
110
- 8443: "HTTPS",
111
- 8888: "HTTP",
68
+ 8000: "HTTP Alternate",
69
+ 8080: "HTTP Alternate",
70
+ 8443: "HTTPS Alternate",
71
+ 8888: "HTTP Alternate",
112
72
  10000: "Webmin",
73
+ 27017: "MongoDB",
113
74
  }
114
75
 
115
76
 
116
- version = "1.7.6"
77
+ version = "1.7.7"
117
78
 
118
79
 
119
80
  def is_port_open(host, port):
@@ -134,11 +95,15 @@ def is_port_open_threads(host, port):
134
95
  s.connect((host, port))
135
96
  except (OSError, socket.timeout):
136
97
  try:
137
- print(f"Closed{colored('|X|','red')}-->{ports.get(port)}|{port}|")
138
- except:
139
- print(f"Closed{colored('|X|','red')}-->|{port}|")
98
+ print(
99
+ f"Closed{colored('|X|','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')}"
100
+ )
101
+ except Exception as e:
102
+ print(f"Closed{colored('|X|','red')}-->{colored(f'|{port}|','red')}")
140
103
  else:
141
- print(f"Open{colored('|√|','green')}-->{ports.get(port)}|{port}|")
104
+ print(
105
+ f"Open{colored('|√|','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')}"
106
+ )
142
107
 
143
108
 
144
109
  def Ports(str=""):
@@ -272,11 +237,11 @@ if SnakeArgs().udp:
272
237
  data, server = sock.recvfrom(4096)
273
238
  print(f"Response received: {data.decode()} from {server}")
274
239
  print(
275
- f"Open{colored('[√]','green')}-->{ports.get(port)}|{port}| may be listening on host"
240
+ f"Open{colored('[√]','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')} may be listening on host"
276
241
  )
277
242
  except socket.timeout:
278
243
  print(
279
- f"Closed{colored('[X]','red')}-->{ports.get(port)}|{port}| is likely closed on host"
244
+ f"Closed{colored('[X]','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')} is likely closed on host"
280
245
  )
281
246
  except ConnectionRefusedError:
282
247
  print("An error occurred while scanning.")
@@ -287,130 +252,120 @@ if SnakeArgs().udp:
287
252
  print(f"Socket error: {e}")
288
253
 
289
254
  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",
255
+ 7: "ECHO",
256
+ 9: "DISCARD",
257
+ 13: "DAYTIME",
258
+ 17: "QOTD (Quote of the Day)",
259
+ 19: "CHARGEN (Character Generator)",
260
+ 53: "DNS (Domain Name System)",
261
+ 67: "DHCP Server",
262
+ 68: "DHCP Client",
263
+ 69: "TFTP (Trivial File Transfer Protocol)",
264
+ 111: "RPC (Remote Procedure Call)",
265
+ 123: "NTP (Network Time Protocol)",
266
+ 137: "NetBIOS Name Service",
267
+ 138: "NetBIOS Datagram Service",
268
+ 161: "SNMP (Simple Network Management Protocol)",
269
+ 162: "SNMP Trap",
270
+ 443: "QUIC (Quick UDP Internet Connections)",
271
+ 500: "ISAKMP (Internet Security Association and Key Management Protocol)",
272
+ 520: "RIP (Routing Information Protocol)",
273
+ 1434: "Microsoft SQL Server Dynamic Port Allocation",
274
+ 4500: "IPsec NAT-Traversal (NAT-T)",
275
+ 5353: "mDNS (Multicast DNS)",
276
+ 5355: "LLMNR (Link-Local Multicast Name Resolution)",
277
+ 1900: "SSDP (Simple Service Discovery Protocol)",
278
+ 3478: "STUN (Session Traversal Utilities for NAT)",
279
+ 5060: "SIP (Session Initiation Protocol)",
280
+ 5061: "SIP (Session Initiation Protocol) (TLS)",
281
+ 20777: "Garmin Training Center",
282
+ 3074: "Xbox Live",
283
+ 3479: "TURN (Traversal Using Relays around NAT)",
284
+ 4126: "Muon",
285
+ 50000: "Drone (Drone Protocol)",
286
+ 60000: "RDP (Remote Desktop Protocol) over UDP",
287
+ 5000: "fCoE (Fibre Channel over Ethernet)",
288
+ 5001: "HP OpenView Operations Agent",
289
+ 1719: "H.323 Gatekeeper RAS",
290
+ 1720: "H.323 Call Signaling",
291
+ 1812: "RADIUS authentication",
292
+ 1813: "RADIUS accounting",
293
+ 5222: "XMPP client connection",
294
+ 5269: "XMPP server connection",
310
295
  }
296
+
311
297
  else:
312
298
  ports = {
313
299
  20: "FTP-Data",
314
300
  21: "FTP-Control",
315
301
  22: "SSH",
316
302
  23: "Telnet",
317
- 24: "Priv-mail",
318
303
  25: "SMTP",
319
- 29: "MSG-ICP",
320
- 31: "MSG-AUTH",
321
- 33: "DSP",
322
- 35: "Priv-print",
323
- 41: "Graphics",
324
- 42: "WINS",
325
304
  43: "Whois",
326
- 48: "AUDITD",
327
- 57: "Priv-term",
328
- 59: "Priv-file",
329
- 63: "WHOISPP",
330
- 66: "SQL-NET",
331
- 75: "Priv-dial",
305
+ 53: "DNS",
306
+ 70: "Gopher",
307
+ 79: "FINGER",
332
308
  80: "HTTP",
333
- 109: "POP2",
334
309
  110: "POP3",
310
+ 111: "RPC",
335
311
  113: "ident",
336
312
  115: "SFTP",
337
- 118: "SQLServ",
338
- 119: "NNTP",
313
+ 135: "MSRPC",
339
314
  139: "NetBIOS-SSN",
340
315
  143: "IMAP",
341
316
  179: "BGP",
342
317
  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",
318
+ 389: "LDAP",
354
319
  443: "HTTPS",
355
- 444: "SNPP",
356
- 606: "URM",
357
- 607: "NQS",
320
+ 445: "SMB",
321
+ 465: "SMTPS",
322
+ 587: "SMTP Submission",
358
323
  631: "IPP",
359
324
  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
325
  873: "RSYNC",
372
- 989: "FTPS-DATA",
373
- 990: "FTPS",
326
+ 993: "IMAPS",
374
327
  995: "POP3S",
375
- 1038: "MTQP",
376
328
  1080: "SOCKS",
377
- 1194: "OpenVPN",
378
- 1433: "SQL server",
379
- 1723: "PPTP",
329
+ 1433: "SQL Server",
330
+ 1521: "Oracle",
331
+ 2082: "CPanel",
332
+ 2083: "CPanel",
380
333
  2222: "SSH",
381
- 3128: "HTTP",
382
- 3268: "LDAP",
334
+ 3128: "HTTP Proxy",
383
335
  3306: "MySQL",
384
336
  3389: "RDP",
385
- 3455: "RSVP",
386
- 3632: "Distributed compiler",
387
- 3689: "DAAP",
388
337
  5432: "PostgreSQL",
389
338
  5900: "VNC",
390
- 8000: "HTTP",
391
- 8080: "HTTP",
392
- 8443: "HTTPS",
393
- 8888: "HTTP",
339
+ 8000: "HTTP Alternate",
340
+ 8080: "HTTP Alternate",
341
+ 8443: "HTTPS Alternate",
342
+ 8888: "HTTP Alternate",
394
343
  10000: "Webmin",
344
+ 27017: "MongoDB",
395
345
  }
346
+
396
347
  if SnakeArgs().ports:
397
348
  rangeports, port_user = Ports(port_user)
398
349
  for i in range(len(port_user)):
399
- port_user[i] = int(port_user[i])
350
+ try:
351
+ port_user[i] = int(port_user[i])
352
+ except Exception as e:
353
+ print(f"Incorrect input,please check the help documentation:{e}")
354
+ sys.exit()
400
355
  for n in range(len(host)):
401
356
  for port in range(len(port_user)):
402
357
  if is_port_open(host[n], port_user[port]):
403
358
  print(
404
- f"Open{colored('|√|','green')}{host[n]}-->{ports[port_user[port]]}|{port_user[port]}|"
359
+ f"Open{colored('|√|','green')}{host[n]}-->{colored(f'{str(ports.get(port_user[port],''))}','light_green')}{colored(f'|{port_user[port]}|','green')}"
405
360
  )
406
361
  else:
407
362
  try:
408
363
  print(
409
- f"Closed{colored('|X|','red')}{host[n]}-->{ports[port_user[port]]}|{port_user[port]}|"
364
+ f"Closed{colored('|X|','red')}{host[n]}-->{colored(str(ports.get(port_user[port],'')),'light_red')}{colored(f'|{port_user[port]}|','red')}"
410
365
  )
411
366
  except:
412
367
  print(
413
- f"Closed{colored('|X|','red')}{host[n]}-->|{port_user[port]}|"
368
+ f"Closed{colored('|X|','red')}{host[n]}-->{colored(f'|{port_user[port]}|','red')}"
414
369
  )
415
370
  try:
416
371
  first = rangeports[::2]
@@ -0,0 +1,80 @@
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
+ 25: "SMTP",
11
+ 43: "Whois",
12
+ 53: "DNS",
13
+ 70: "Gopher",
14
+ 79: "FINGER",
15
+ 80: "HTTP",
16
+ 110: "POP3",
17
+ 111: "RPC",
18
+ 113: "ident",
19
+ 115: "SFTP",
20
+ 135: "MSRPC",
21
+ 139: "NetBIOS-SSN",
22
+ 143: "IMAP",
23
+ 179: "BGP",
24
+ 194: "IRC",
25
+ 389: "LDAP",
26
+ 443: "HTTPS",
27
+ 445: "SMB",
28
+ 465: "SMTPS",
29
+ 587: "SMTP Submission",
30
+ 631: "IPP",
31
+ 636: "LDAPS",
32
+ 873: "RSYNC",
33
+ 993: "IMAPS",
34
+ 995: "POP3S",
35
+ 1080: "SOCKS",
36
+ 1433: "SQL Server",
37
+ 1521: "Oracle",
38
+ 2082: "CPanel",
39
+ 2083: "CPanel",
40
+ 2222: "SSH",
41
+ 3128: "HTTP Proxy",
42
+ 3306: "MySQL",
43
+ 3389: "RDP",
44
+ 5432: "PostgreSQL",
45
+ 5900: "VNC",
46
+ 8000: "HTTP Alternate",
47
+ 8080: "HTTP Alternate",
48
+ 8443: "HTTPS Alternate",
49
+ 8888: "HTTP Alternate",
50
+ 10000: "Webmin",
51
+ 27017: "MongoDB",
52
+ }
53
+
54
+
55
+ def is_port_open_threads(host, port):
56
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
57
+ try:
58
+ s.settimeout(1)
59
+ s.connect((host, port))
60
+ except (OSError, socket.timeout):
61
+ try:
62
+ print(
63
+ f"Closed{colored('|X|','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')}"
64
+ )
65
+ except:
66
+ print(f"Closed{colored('|X|','red')}-->{colored(f'|{port}|','red')}")
67
+ else:
68
+ print(
69
+ f"Open{colored('|√|','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')}"
70
+ )
71
+
72
+
73
+ def PoolProcessExecutor(host):
74
+ with ProcessPoolExecutor(max_workers=None) as executor:
75
+ try:
76
+ for port in ports.keys():
77
+ future = executor.submit(is_port_open_threads, host, port)
78
+
79
+ except Exception as e:
80
+ print(e)
@@ -0,0 +1,84 @@
1
+ import socket
2
+ from termcolor import colored
3
+ from concurrent.futures import ProcessPoolExecutor
4
+
5
+ ports = {
6
+ 7: "ECHO",
7
+ 9: "DISCARD",
8
+ 13: "DAYTIME",
9
+ 17: "QOTD (Quote of the Day)",
10
+ 19: "CHARGEN (Character Generator)",
11
+ 53: "DNS (Domain Name System)",
12
+ 67: "DHCP Server",
13
+ 68: "DHCP Client",
14
+ 69: "TFTP (Trivial File Transfer Protocol)",
15
+ 111: "RPC (Remote Procedure Call)",
16
+ 123: "NTP (Network Time Protocol)",
17
+ 137: "NetBIOS Name Service",
18
+ 138: "NetBIOS Datagram Service",
19
+ 161: "SNMP (Simple Network Management Protocol)",
20
+ 162: "SNMP Trap",
21
+ 443: "QUIC (Quick UDP Internet Connections)",
22
+ 500: "ISAKMP (Internet Security Association and Key Management Protocol)",
23
+ 520: "RIP (Routing Information Protocol)",
24
+ 1434: "Microsoft SQL Server Dynamic Port Allocation",
25
+ 4500: "IPsec NAT-Traversal (NAT-T)",
26
+ 5353: "mDNS (Multicast DNS)",
27
+ 5355: "LLMNR (Link-Local Multicast Name Resolution)",
28
+ 1900: "SSDP (Simple Service Discovery Protocol)",
29
+ 3478: "STUN (Session Traversal Utilities for NAT)",
30
+ 5060: "SIP (Session Initiation Protocol)",
31
+ 5061: "SIP (Session Initiation Protocol) (TLS)",
32
+ 20777: "Garmin Training Center",
33
+ 3074: "Xbox Live",
34
+ 3479: "TURN (Traversal Using Relays around NAT)",
35
+ 4126: "Muon",
36
+ 50000: "Drone (Drone Protocol)",
37
+ 60000: "RDP (Remote Desktop Protocol) over UDP",
38
+ 5000: "fCoE (Fibre Channel over Ethernet)",
39
+ 5001: "HP OpenView Operations Agent",
40
+ 1719: "H.323 Gatekeeper RAS",
41
+ 1720: "H.323 Call Signaling",
42
+ 1812: "RADIUS authentication",
43
+ 1813: "RADIUS accounting",
44
+ 5222: "XMPP client connection",
45
+ 5269: "XMPP server connection",
46
+ }
47
+
48
+
49
+ def is_port_open_threads(host, port, timeout=1):
50
+ try:
51
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
52
+ sock.settimeout(timeout)
53
+ message = b"Test UDP packet"
54
+ address = (host, port)
55
+
56
+ sock.sendto(message, address)
57
+
58
+ try:
59
+ data, server = sock.recvfrom(4096)
60
+ print(f"Response received: {data.decode()} from {server}")
61
+ print(
62
+ f"Open{colored('[√]','green')}-->{colored(ports.get(port),'light_green')}{colored(f'|{port}|','green')} may be listening on host"
63
+ )
64
+ except socket.timeout:
65
+ print(
66
+ f"Closed{colored('[X]','red')}-->{colored(ports.get(port),'light_red')}{colored(f'|{port}|','red')} is likely closed on host"
67
+ )
68
+ except ConnectionRefusedError:
69
+ print("An error occurred while scanning.")
70
+ sock.close()
71
+ except socket.gaierror:
72
+ print("Error: Unable to resolve host name.")
73
+ except socket.error as e:
74
+ print(f"Socket error: {e}")
75
+
76
+
77
+ def PoolExecutorUDP(host):
78
+ with ProcessPoolExecutor(max_workers=None) as executor:
79
+ try:
80
+ for port in ports.keys():
81
+ future = executor.submit(is_port_open_threads, host, port)
82
+
83
+ except Exception as e:
84
+ 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.6"
3
+ __version__ = "1.7.7"
4
4
  import socket
5
5
  from time import sleep
6
6
  from termcolor import colored
@@ -1,112 +0,0 @@
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)
@@ -1,64 +0,0 @@
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)
File without changes
File without changes
File without changes