SnakeScan 1.9.7__tar.gz → 1.9.9__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.9.7
3
+ Version: 1.9.9
4
4
  Summary: Unlock the potential of your network with this powerful IPv4 address scanner. Easily scan IP address ranges, identify active hosts, and even extract IPv4 addresses from IPv6 environments. Enhance your network monitoring, troubleshooting, and security analysis!
5
5
  Author: Den*Ram
6
6
  Requires-Python: >=3.7
@@ -11,7 +11,7 @@ Requires-Dist: tqdm
11
11
  Requires-Dist: termcolor
12
12
 
13
13
  <!--
14
- This documentation was created with GeekBot Language Model and Den*Ram
14
+ This documentation was created using the Language Model Geekbot and DEN-RAM. All code provided in the Python package is created exclusively by the author.
15
15
 
16
16
  -->
17
17
 
@@ -26,8 +26,6 @@ A versatile and efficient Python library designed for comprehensive network port
26
26
 
27
27
  **SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers who need reliable port scanning capabilities. From simple port checks to advanced, multi-threaded subnet analysis, SnakeScan provides the tools necessary for effective network assessment.
28
28
 
29
- Attention: A large number of bugs were found, so the use of several subcommands is not possible at the moment, and this will be corrected after 3 days. Because of this, it is recommended to use version 1.9.5 and below. Version 1.9.7 must be fixed.
30
-
31
29
  ## ⚙️ Key Features:
32
30
 
33
31
  * **Flexible Port Specification:** Define target ports as individual values, ranges, or through preconfigured sets.
@@ -71,10 +69,24 @@ cd [directory where the archive was unpacked]
71
69
  flit install
72
70
 
73
71
  ## ⌨️ Command Line Usage:
72
+
73
+ * Commands for individual actions (Updating 1.9.8): scan{save}, info, dict.
74
+
75
+ * Commands cannot be used in one line: Snake scan -t info -i dict -d ~ cause an error due to incorrect command input.
76
+
77
+ * The optional "save" command was added to the "scan" command.
78
+
79
+ * "save" ~ Attributes -
80
+ "-s", "--save", help= Gives permission to save the file.
81
+ "-n", "--name", help= The name of the file to be saved.
82
+ "-p", "--path", help= Specify your own file save path.
83
+ "-a", "--append", help= Add an existing file with data. **WARNING: By default, the file is overwritten every time you save it using this argument, the file will be supplemented without overwriting the content.
74
84
 
75
85
  ### 💡 Attribute Reference:
76
-
77
- * * Commands for individual actions (Updating 1.9.6): scan, info, dict, save
86
+
87
+ * **-hf --hostfile**: Allows you to use a file with pre-known hosts. **Example: snake -hf myPath/hosts.json,myPath/home/hosts_to_scan.json. **Format: JSON. **WARNING: Can take multiple host file paths or one as an argument value. If this argument is applied, the -hs[host] argument will not be applied.`
88
+
89
+ * **-hs --host**: Provides the ability to enter a host. **WARNING: If value and argument are not specified, the default value will be used. **Default value: localhost.`
78
90
 
79
91
  * **-time**: Sets a timeout for each port. Examples: `snake scan -time 4`
80
92
 
@@ -144,5 +156,5 @@ watcher.start() # Start monitoring!
144
156
 
145
157
  ---
146
158
 
147
- **Last Updated:** 1.9.7 (Added a new argument -time, --timeout, and also added commands for individual actions: scan, info, dict, save)
159
+ **Last Updated:** 1.9.9 (Fix bugs, added the -hf argument, --hostfile.)
148
160
 
@@ -1,5 +1,5 @@
1
1
  <!--
2
- This documentation was created with GeekBot Language Model and Den*Ram
2
+ This documentation was created using the Language Model Geekbot and DEN-RAM. All code provided in the Python package is created exclusively by the author.
3
3
 
4
4
  -->
5
5
 
@@ -14,8 +14,6 @@ A versatile and efficient Python library designed for comprehensive network port
14
14
 
15
15
  **SnakeScan** provides a flexible and powerful solution for network administrators, security professionals, and developers who need reliable port scanning capabilities. From simple port checks to advanced, multi-threaded subnet analysis, SnakeScan provides the tools necessary for effective network assessment.
16
16
 
17
- Attention: A large number of bugs were found, so the use of several subcommands is not possible at the moment, and this will be corrected after 3 days. Because of this, it is recommended to use version 1.9.5 and below. Version 1.9.7 must be fixed.
18
-
19
17
  ## ⚙️ Key Features:
20
18
 
21
19
  * **Flexible Port Specification:** Define target ports as individual values, ranges, or through preconfigured sets.
@@ -59,10 +57,24 @@ cd [directory where the archive was unpacked]
59
57
  flit install
60
58
 
61
59
  ## ⌨️ Command Line Usage:
60
+
61
+ * Commands for individual actions (Updating 1.9.8): scan{save}, info, dict.
62
+
63
+ * Commands cannot be used in one line: Snake scan -t info -i dict -d ~ cause an error due to incorrect command input.
64
+
65
+ * The optional "save" command was added to the "scan" command.
66
+
67
+ * "save" ~ Attributes -
68
+ "-s", "--save", help= Gives permission to save the file.
69
+ "-n", "--name", help= The name of the file to be saved.
70
+ "-p", "--path", help= Specify your own file save path.
71
+ "-a", "--append", help= Add an existing file with data. **WARNING: By default, the file is overwritten every time you save it using this argument, the file will be supplemented without overwriting the content.
62
72
 
63
73
  ### 💡 Attribute Reference:
64
-
65
- * * Commands for individual actions (Updating 1.9.6): scan, info, dict, save
74
+
75
+ * **-hf --hostfile**: Allows you to use a file with pre-known hosts. **Example: snake -hf myPath/hosts.json,myPath/home/hosts_to_scan.json. **Format: JSON. **WARNING: Can take multiple host file paths or one as an argument value. If this argument is applied, the -hs[host] argument will not be applied.`
76
+
77
+ * **-hs --host**: Provides the ability to enter a host. **WARNING: If value and argument are not specified, the default value will be used. **Default value: localhost.`
66
78
 
67
79
  * **-time**: Sets a timeout for each port. Examples: `snake scan -time 4`
68
80
 
@@ -132,4 +144,4 @@ watcher.start() # Start monitoring!
132
144
 
133
145
  ---
134
146
 
135
- **Last Updated:** 1.9.7 (Added a new argument -time, --timeout, and also added commands for individual actions: scan, info, dict, save)
147
+ **Last Updated:** 1.9.9 (Fix bugs, added the -hf argument, --hostfile.)
@@ -176,7 +176,7 @@ async def is_port_open_async(host, port, timeout=1):
176
176
  print(f"[!] WARNING: Error - {e}")
177
177
 
178
178
 
179
- async def is_port_run_threads(host, ports):
179
+ async def is_port_run_threads(host, ports, timeout=1):
180
180
  for n in range(len(host)):
181
181
  try:
182
182
  loop = asyncio.get_event_loop()
@@ -296,7 +296,7 @@ else:
296
296
  if __name__ == "__main__":
297
297
  main()
298
298
 
299
- version = "1.9.7"
299
+ version = "1.9.9"
300
300
 
301
301
 
302
302
  def is_port_open(host, port, argument=None, protocol=socket.SOCK_STREAM, timeout=1):
@@ -430,37 +430,20 @@ def SnakeArgs():
430
430
  description="SnakeScan is a command library / tool for performing port monitoring and maintenance tasks on the target system, it provides the ability to provide reliable protection against any threatening factors that can harm the user's system."
431
431
  )
432
432
  parser.add_argument(
433
- "host",
433
+ "-hs",
434
+ "--host",
434
435
  nargs="?",
435
436
  default="None",
437
+ help="Provides the ability to enter a host. **WARNING: If the value is not specified, the default value will be used. **Default value: localhost.",
436
438
  )
437
- command = parser.add_subparsers(dest="command", help="List of commands")
438
- save = command.add_parser(
439
- name="save", help="Allows you to create a log with port data to a file."
440
- )
441
- save.add_argument(
442
- "-s",
443
- "--save",
444
- help="Gives permission to save the file.",
445
- action="store_true",
446
- required="true",
447
- )
448
- save.add_argument(
449
- "-n",
450
- "--name",
451
- help="The name of the file to be saved.",
439
+ parser.add_argument(
440
+ "-hf",
441
+ "--hostfile",
452
442
  nargs="?",
453
- default="saved_backup_ports_01.json",
454
- )
455
- save.add_argument(
456
- "-p", "--path", help="Specify your own file save path.", nargs="?"
457
- )
458
- save.add_argument(
459
- "-a",
460
- "--append",
461
- help="Add an existing file with data. **WARNING: By default, the file is overwritten every time you save it using this argument, the file will be supplemented without overwriting the content.",
462
- action="store_true",
443
+ default=False,
444
+ help="Allows you to use a file with pre-known hosts. **Example: snake -hf myPath/hosts.json,myPath/home/hosts_to_scan.json. **Format: JSON. **WARNING: Can take multiple host file paths or one as an argument value. If this argument is applied, the -hs[host] argument will not be applied.",
463
445
  )
446
+ command = parser.add_subparsers(dest="command", help="List of commands")
464
447
  scan = command.add_parser(name="scan", help="Allows you to use scanning.")
465
448
  scan.add_argument(
466
449
  "-a",
@@ -492,6 +475,35 @@ def SnakeArgs():
492
475
  action="store_true",
493
476
  help="Use to scan only with using ThreadPoolExecutor. **WARNING: If you use it in a place with the -u argument, then this will change the type of scanned ports to UDP.",
494
477
  )
478
+ save_command = scan.add_subparsers(
479
+ dest="save", help="Allows you to create a log with port data to a file."
480
+ )
481
+ save = save_command.add_parser(
482
+ name="save", help="Use to save data to a file. **Format: JSON."
483
+ )
484
+ save.add_argument(
485
+ "-s",
486
+ "--save",
487
+ help="Gives permission to save the file.",
488
+ action="store_true",
489
+ required="true",
490
+ )
491
+ save.add_argument(
492
+ "-n",
493
+ "--name",
494
+ help="The name of the file to be saved.",
495
+ nargs="?",
496
+ default="saved_backup_ports_01.json",
497
+ )
498
+ save.add_argument(
499
+ "-p", "--path", help="Specify your own file save path.", nargs="?"
500
+ )
501
+ save.add_argument(
502
+ "-a",
503
+ "--append",
504
+ help="Add an existing file with data. **WARNING: By default, the file is overwritten every time you save it using this argument, the file will be supplemented without overwriting the content.",
505
+ action="store_true",
506
+ )
495
507
  info = command.add_parser(
496
508
  name="info", help="Allows you to get the information you need."
497
509
  )
@@ -560,6 +572,26 @@ for n in range(len(host)):
560
572
  if host[0] == "None":
561
573
  host[0] = "localhost"
562
574
 
575
+ if SnakeArgs().hostfile:
576
+ host = []
577
+ hosting = []
578
+ hostfiles = SnakeArgs().hostfile.split(",")
579
+ for h in hostfiles:
580
+ try:
581
+ host.append(load_json_config(h))
582
+ except Exception as e:
583
+ print(f"[!] WARNING: Error - {e}")
584
+ continue
585
+ try:
586
+ for n in host:
587
+ for i in n.values():
588
+ hosting.append(i)
589
+ host = hosting
590
+ except Exception as e:
591
+ print(
592
+ f"[!] Warning: Error - syntax error has been made when entering the file path to the file(s)."
593
+ )
594
+
563
595
  if SnakeArgs().command == "scan":
564
596
  scan_protocol = socket.SOCK_DGRAM if SnakeArgs().udp else socket.SOCK_STREAM
565
597
 
@@ -587,34 +619,37 @@ if SnakeArgs().command == "dict":
587
619
  ports_tcp = load_json_config(filepath[0])
588
620
  Save_config(filepath[0], "")
589
621
 
590
- if SnakeArgs().command == "save":
591
- save = True
622
+ if SnakeArgs().command == "scan":
623
+ if SnakeArgs().save:
624
+ save = True
592
625
 
593
- def Save(data):
594
- if SnakeArgs().path:
626
+ def Save(data):
627
+ if SnakeArgs().path:
628
+ try:
629
+ path = Path(str(SnakeArgs().path)).expanduser()
630
+ except Exception as e:
631
+ print(f"[!] WARNING: Error - {e}")
632
+ sys.exit()
633
+ else:
634
+ path = Path.home() / "SnakeScan"
635
+
636
+ if SnakeArgs().name:
637
+ name = str(SnakeArgs().name)
638
+ else:
639
+ name = "saved_backup_ports_01.json"
595
640
  try:
596
- path = Path(str(SnakeArgs().path)).expanduser()
641
+ name = str(name)
642
+ if name.endswith(".json"):
643
+ pass
644
+ else:
645
+ name = name + ".json"
646
+ with open(
647
+ path / name, "w" if SnakeArgs().append != True else "a"
648
+ ) as path:
649
+ json.dump(data, path, ensure_ascii=False, indent=4)
597
650
  except Exception as e:
598
651
  print(f"[!] WARNING: Error - {e}")
599
652
  sys.exit()
600
- else:
601
- path = Path.home() / "SnakeScan"
602
-
603
- if SnakeArgs().name:
604
- name = str(SnakeArgs().name)
605
- else:
606
- name = "saved_backup_ports_01.json"
607
- try:
608
- name = str(name)
609
- if name.endswith(".json"):
610
- pass
611
- else:
612
- name = name + ".json"
613
- with open(path / name, "w" if SnakeArgs().append != True else "a") as path:
614
- json.dump(data, path, ensure_ascii=False, indent=4)
615
- except Exception as e:
616
- print(f"[!] WARNING: Error - {e}")
617
- sys.exit()
618
653
 
619
654
 
620
655
  if SnakeArgs().command == "scan":
@@ -632,7 +667,7 @@ if SnakeArgs().command == "scan":
632
667
 
633
668
  if SnakeArgs().command == "scan":
634
669
  if SnakeArgs().asynchronous:
635
- asyncio.run(is_port_run_threads(host, ports, timeout))
670
+ asyncio.run(is_port_run_threads(host, ports))
636
671
 
637
672
 
638
673
  if SnakeArgs().command == "dict":
@@ -671,6 +706,7 @@ if SnakeArgs().command == "scan":
671
706
  excepthost = []
672
707
  for n in range(len(host)):
673
708
  OpenPorts = []
709
+ print(f"|{host[n]}|".center(60, "—"))
674
710
  for port in range(len(port_user)):
675
711
  if is_port_open(host[n], port_user[port], None, scan_protocol, timeout):
676
712
  print(
@@ -690,6 +726,7 @@ if SnakeArgs().command == "scan":
690
726
  print(
691
727
  f"{colored(f'{port_user[port]}','red')}-->{colored(f'|X|','red')}"
692
728
  )
729
+ print("".center(60, "—"))
693
730
  try:
694
731
  first = rangeports[::2]
695
732
  second = rangeports[1::2]
@@ -837,7 +874,7 @@ if SnakeArgs().command == "scan":
837
874
  )
838
875
  future.result()
839
876
  except Exception as e:
840
- print("".center(60, "—"))
877
+ print(f"|{host[n]}|".center(60, "—"))
841
878
  print(e)
842
879
  print("".center(60, "—"))
843
880
 
@@ -1,6 +1,6 @@
1
1
  """Unlock the potential of your network with this powerful IPv4 address scanner. Easily scan IP address ranges, identify active hosts, and even extract IPv4 addresses from IPv6 environments. Enhance your network monitoring, troubleshooting, and security analysis!"""
2
2
 
3
- __version__ = "1.9.7"
3
+ __version__ = "1.9.9"
4
4
  import socket
5
5
  from time import sleep
6
6
  from termcolor import colored
File without changes
File without changes