sciveo 0.1.42__tar.gz → 0.1.44__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.
Files changed (148) hide show
  1. {sciveo-0.1.42 → sciveo-0.1.44}/PKG-INFO +1 -1
  2. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/cli.py +8 -1
  3. sciveo-0.1.44/sciveo/network/tools.py +204 -0
  4. sciveo-0.1.44/sciveo/tools/queue.py +31 -0
  5. sciveo-0.1.44/sciveo/version.py +2 -0
  6. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo.egg-info/PKG-INFO +1 -1
  7. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo.egg-info/SOURCES.txt +1 -0
  8. sciveo-0.1.42/sciveo/network/tools.py +0 -102
  9. sciveo-0.1.42/sciveo/version.py +0 -2
  10. {sciveo-0.1.42 → sciveo-0.1.44}/README.md +0 -0
  11. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/__init__.py +0 -0
  12. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/api/__init__.py +0 -0
  13. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/api/base.py +0 -0
  14. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/api/upload.py +0 -0
  15. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/common/__init__.py +0 -0
  16. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/common/configuration.py +0 -0
  17. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/common/model.py +0 -0
  18. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/common/optimizers.py +0 -0
  19. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/common/sampling.py +0 -0
  20. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/content/__init__.py +0 -0
  21. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/content/dataset.py +0 -0
  22. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/content/experiment.py +0 -0
  23. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/content/project.py +0 -0
  24. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/content/runner.py +0 -0
  25. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/__init__.py +0 -0
  26. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/__init__.py +0 -0
  27. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/base.py +0 -0
  28. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/encoders/__init__.py +0 -0
  29. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/encoders/base.py +0 -0
  30. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/encoders/normalizer.py +0 -0
  31. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/nlp/__init__.py +0 -0
  32. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/nlp/search.py +0 -0
  33. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/time_series/__init__.py +0 -0
  34. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/time_series/dataset.py +0 -0
  35. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/time_series/predictor.py +0 -0
  36. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/time_series/trainer.py +0 -0
  37. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/ml/time_series/window_generator.py +0 -0
  38. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/__init__.py +0 -0
  39. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/base.py +0 -0
  40. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/job_daemon.py +0 -0
  41. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/layouts/__init__.py +0 -0
  42. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/layouts/base.py +0 -0
  43. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/pipeline.py +0 -0
  44. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/postprocessors/__init__.py +0 -0
  45. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/postprocessors/base.py +0 -0
  46. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/postprocessors/default.py +0 -0
  47. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/__init__.py +0 -0
  48. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/audio/__init__.py +0 -0
  49. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/audio/audio.py +0 -0
  50. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/audio/audio_extractor_process.py +0 -0
  51. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/aws.py +0 -0
  52. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/base.py +0 -0
  53. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/file/__init__.py +0 -0
  54. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/file/archive.py +0 -0
  55. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/__init__.py +0 -0
  56. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/album.py +0 -0
  57. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/album_in_image.py +0 -0
  58. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/depth_esimation.py +0 -0
  59. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/embeddings.py +0 -0
  60. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/filters.py +0 -0
  61. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/generators.py +0 -0
  62. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/histogram.py +0 -0
  63. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/mask.py +0 -0
  64. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/object_detection.py +0 -0
  65. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/resize.py +0 -0
  66. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/segmentation.py +0 -0
  67. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/image/watermark.py +0 -0
  68. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/media_info.py +0 -0
  69. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/nlp/__init__.py +0 -0
  70. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/nlp/address.py +0 -0
  71. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/qr.py +0 -0
  72. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/sci/__init__.py +0 -0
  73. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/sci/base.py +0 -0
  74. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/sci/dataset.py +0 -0
  75. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/sci/time_series/__init__.py +0 -0
  76. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/sci/time_series/predictor.py +0 -0
  77. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/sci/time_series/trainer.py +0 -0
  78. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/tpu_base.py +0 -0
  79. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/__init__.py +0 -0
  80. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/generators.py +0 -0
  81. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/motion_detection.py +0 -0
  82. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/resize.py +0 -0
  83. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/video_album.py +0 -0
  84. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/video_frames.py +0 -0
  85. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/processors/video/video_resample.py +0 -0
  86. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/queues.py +0 -0
  87. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/server.py +0 -0
  88. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/web/__init__.py +0 -0
  89. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/media/pipelines/web/server.py +0 -0
  90. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/__init__.py +0 -0
  91. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/base.py +0 -0
  92. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/evaluation/__init__.py +0 -0
  93. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/evaluation/object_detection.py +0 -0
  94. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/__init__.py +0 -0
  95. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/base.py +0 -0
  96. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/description.py +0 -0
  97. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/embeddings.py +0 -0
  98. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/object_detection.py +0 -0
  99. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/segmentation.py +0 -0
  100. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/tools.py +0 -0
  101. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/images/transformers.py +0 -0
  102. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/nlp/__init__.py +0 -0
  103. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/nlp/embeddings.py +0 -0
  104. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/nlp/tokenizers/__init__.py +0 -0
  105. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/nlp/tokenizers/bpe.py +0 -0
  106. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/video/__init__.py +0 -0
  107. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/ml/video/description.py +0 -0
  108. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/monitoring/__init__.py +0 -0
  109. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/monitoring/monitor.py +0 -0
  110. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/monitoring/start.py +0 -0
  111. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/network/__init__.py +0 -0
  112. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/network/camera.py +0 -0
  113. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/network/sniffer.py +0 -0
  114. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/__init__.py +0 -0
  115. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/array.py +0 -0
  116. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/aws/__init__.py +0 -0
  117. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/aws/priority_queue.py +0 -0
  118. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/aws/s3.py +0 -0
  119. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/common.py +0 -0
  120. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/complexity.py +0 -0
  121. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/compress.py +0 -0
  122. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/configuration.py +0 -0
  123. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/crypto.py +0 -0
  124. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/daemon.py +0 -0
  125. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/formating.py +0 -0
  126. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/hardware.py +0 -0
  127. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/http.py +0 -0
  128. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/logger.py +0 -0
  129. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/os.py +0 -0
  130. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/random.py +0 -0
  131. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/remote.py +0 -0
  132. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/simple_counter.py +0 -0
  133. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/synchronized.py +0 -0
  134. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo/tools/timers.py +0 -0
  135. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo.egg-info/dependency_links.txt +0 -0
  136. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo.egg-info/entry_points.txt +0 -0
  137. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo.egg-info/requires.txt +0 -0
  138. {sciveo-0.1.42 → sciveo-0.1.44}/sciveo.egg-info/top_level.txt +0 -0
  139. {sciveo-0.1.42 → sciveo-0.1.44}/setup.cfg +0 -0
  140. {sciveo-0.1.42 → sciveo-0.1.44}/setup.py +0 -0
  141. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_complexity.py +0 -0
  142. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_compress.py +0 -0
  143. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_configuration.py +0 -0
  144. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_crypto.py +0 -0
  145. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_monitoring.py +0 -0
  146. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_runner.py +0 -0
  147. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_sampling.py +0 -0
  148. {sciveo-0.1.42 → sciveo-0.1.44}/test/test_tokenizers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.42
3
+ Version: 0.1.44
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -11,6 +11,7 @@
11
11
  #
12
12
 
13
13
  import os
14
+ import json
14
15
  import argparse
15
16
 
16
17
  from sciveo.tools.logger import *
@@ -34,7 +35,9 @@ def main():
34
35
  parser.add_argument('--auth', type=str, default=config['secret_access_key'], help='Auth secret access key')
35
36
  parser.add_argument('--timeout', type=float, default=1.0, help='Timeout')
36
37
  parser.add_argument('--net', type=str, default=None, help='Network like 192.168.10.0/24')
38
+ parser.add_argument('--host', type=str, default=None, help='Host ip or name')
37
39
  parser.add_argument('--port', type=int, default=22, help='Host port number, used for network ops')
40
+ parser.add_argument('--ports', type=str, default="[]", help='Host ports list')
38
41
  parser.add_argument('--localhost', type=bool, default=False, help='Add localhost to list of hosts')
39
42
  parser.add_argument('--input-path', type=str, help='Input Path')
40
43
  parser.add_argument('--output-path', type=str, default=None, help='Output Path')
@@ -52,7 +55,11 @@ def main():
52
55
  MonitorStart(period=args.period, block=args.block, output_path=args.output_path)()
53
56
  elif args.command == 'scan':
54
57
  from sciveo.network.tools import NetworkTools
55
- NetworkTools(timeout=args.timeout, localhost=args.localhost).scan_port(port=args.port, network=args.net)
58
+ host=args.host
59
+ if host is None:
60
+ NetworkTools(timeout=args.timeout, localhost=args.localhost).scan_port(port=args.port, network=args.net)
61
+ else:
62
+ NetworkTools(timeout=args.timeout, ports=json.loads(args.ports)).scan_host(host)
56
63
  elif args.command == 'init':
57
64
  home = os.path.expanduser('~')
58
65
  base_path = os.path.join(home, '.sciveo')
@@ -0,0 +1,204 @@
1
+ #
2
+ # Pavlin Georgiev, Softel Labs
3
+ #
4
+ # This is a proprietary file and may not be copied,
5
+ # distributed, or modified without express permission
6
+ # from the owner. For licensing inquiries, please
7
+ # contact pavlin@softel.bg.
8
+ #
9
+ # 2024
10
+ #
11
+
12
+ import socket
13
+ import ipaddress
14
+ import threading
15
+ import json
16
+
17
+ from sciveo.tools.logger import *
18
+ from sciveo.tools.timers import Timer
19
+
20
+
21
+ class NetworkTools:
22
+ def __init__(self, **kwargs):
23
+ self.default_arguments = {
24
+ "timeout": 1.0,
25
+ "localhost": False,
26
+ "host": None,
27
+ "ports": []
28
+ }
29
+
30
+ self.arguments = {}
31
+ for k, v in self.default_arguments.items():
32
+ self.arguments[k] = kwargs.get(k, v)
33
+
34
+ self.net_classes = ["192.168.", "10."]
35
+ for i in range(16, 32):
36
+ self.net_classes.append(f"172.{i}.")
37
+
38
+ self.data = {}
39
+ self.data_lock = threading.Lock()
40
+
41
+ # self.known_ports = [20, 21, 22, 23, 25, 53, 67, 68, 69, 80, 110, 123, 143, 161, 162, 179, 194, 389, 443, 465, 514, 587, 636, 993, 995, 1080, 1194, 1433, 1521, 1723, 2049, 2082, 2083, 2086, 2087, 2095, 2096, 2181, 2375, 2376, 3000, 3306, 3389, 5432, 5900, 5984, 6379, 8080, 8443, 8888, 9000, 9090, 9200, 9300, 11211, 27017]
42
+ self.known_ports = {
43
+ 20: socket.SOCK_STREAM, # FTP Data (TCP)
44
+ 21: socket.SOCK_STREAM, # FTP Control (TCP)
45
+ 22: socket.SOCK_STREAM, # SSH (TCP)
46
+ 23: socket.SOCK_STREAM, # Telnet (TCP)
47
+ 25: socket.SOCK_STREAM, # SMTP (TCP)
48
+ 53: socket.SOCK_DGRAM, # DNS (UDP, but also uses TCP for large queries)
49
+ 67: socket.SOCK_DGRAM, # DHCP Server (UDP)
50
+ 68: socket.SOCK_DGRAM, # DHCP Client (UDP)
51
+ 69: socket.SOCK_DGRAM, # TFTP (UDP)
52
+ 80: socket.SOCK_STREAM, # HTTP (TCP)
53
+ 110: socket.SOCK_STREAM, # POP3 (TCP)
54
+ 123: socket.SOCK_DGRAM, # NTP (UDP)
55
+ 143: socket.SOCK_STREAM, # IMAP (TCP)
56
+ 161: socket.SOCK_DGRAM, # SNMP (UDP)
57
+ 162: socket.SOCK_DGRAM, # SNMP Trap (UDP)
58
+ 179: socket.SOCK_STREAM, # BGP (TCP)
59
+ 194: socket.SOCK_STREAM, # IRC (TCP)
60
+ 389: socket.SOCK_STREAM, # LDAP (TCP)
61
+ 443: socket.SOCK_STREAM, # HTTPS (TCP)
62
+ 465: socket.SOCK_STREAM, # SMTPS (TCP)
63
+ 514: socket.SOCK_DGRAM, # Syslog (UDP)
64
+ 587: socket.SOCK_STREAM, # SMTP Submission (TCP)
65
+ 636: socket.SOCK_STREAM, # LDAPS (TCP)
66
+ 993: socket.SOCK_STREAM, # IMAPS (TCP)
67
+ 995: socket.SOCK_STREAM, # POP3S (TCP)
68
+ 1080: socket.SOCK_STREAM, # SOCKS (TCP)
69
+ 1194: socket.SOCK_DGRAM, # OpenVPN (UDP)
70
+ 1433: socket.SOCK_STREAM, # MS-SQL (TCP)
71
+ 1521: socket.SOCK_STREAM, # Oracle DB (TCP)
72
+ 1723: socket.SOCK_STREAM, # PPTP (TCP)
73
+ 2049: socket.SOCK_DGRAM, # NFS (UDP)
74
+ 2082: socket.SOCK_STREAM, # cPanel (TCP)
75
+ 2083: socket.SOCK_STREAM, # cPanel SSL (TCP)
76
+ 2086: socket.SOCK_STREAM, # WHM (TCP)
77
+ 2087: socket.SOCK_STREAM, # WHM SSL (TCP)
78
+ 2095: socket.SOCK_STREAM, # Webmail (TCP)
79
+ 2096: socket.SOCK_STREAM, # Webmail SSL (TCP)
80
+ 2181: socket.SOCK_STREAM, # ZooKeeper (TCP)
81
+ 2375: socket.SOCK_STREAM, # Docker (TCP)
82
+ 2376: socket.SOCK_STREAM, # Docker SSL (TCP)
83
+ 3000: socket.SOCK_STREAM, # Node.js (TCP)
84
+ 3306: socket.SOCK_STREAM, # MySQL (TCP)
85
+ 3389: socket.SOCK_STREAM, # RDP (TCP)
86
+ 5432: socket.SOCK_STREAM, # PostgreSQL (TCP)
87
+ 5900: socket.SOCK_STREAM, # VNC (TCP)
88
+ 5984: socket.SOCK_STREAM, # CouchDB (TCP)
89
+ 6379: socket.SOCK_STREAM, # Redis (TCP)
90
+ 8080: socket.SOCK_STREAM, # HTTP Alt (TCP)
91
+ 8443: socket.SOCK_STREAM, # HTTPS Alt (TCP)
92
+ 8888: socket.SOCK_STREAM, # cPanel Alt (TCP)
93
+ 9000: socket.SOCK_STREAM, # PHP-FPM (TCP)
94
+ 9090: socket.SOCK_STREAM, # Prometheus (TCP)
95
+ 9200: socket.SOCK_STREAM, # Elasticsearch (TCP)
96
+ 9300: socket.SOCK_STREAM, # Elasticsearch Cluster (TCP)
97
+ 11211: socket.SOCK_DGRAM, # Memcached (UDP)
98
+ 27017: socket.SOCK_STREAM, # MongoDB (TCP)
99
+ }
100
+
101
+ def get_local_nets(self):
102
+ list_local_ips = []
103
+ try:
104
+ import netifaces
105
+ interfaces = netifaces.interfaces()
106
+ for interface in interfaces:
107
+ addrs = netifaces.ifaddresses(interface)
108
+ if netifaces.AF_INET in addrs:
109
+ ip = addrs[netifaces.AF_INET][0]['addr']
110
+ for net_class in self.net_classes:
111
+ if ip.startswith(net_class):
112
+ list_local_ips.append(ip)
113
+ except Exception as e:
114
+ warning("netifaces not installed")
115
+ return list_local_ips
116
+
117
+ def generate_ip_list(self, base_ip):
118
+ octets = base_ip.split('.')
119
+ network_prefix = '.'.join(octets[:3])
120
+ return [f'{network_prefix}.{i}' for i in range(1, 255)]
121
+
122
+ def scan_port(self, port=22, network=None):
123
+ t = Timer()
124
+ self.data["scan"] = {}
125
+ self.data["scan"].setdefault(port, [])
126
+
127
+ if network is None:
128
+ list_local_ips = self.get_local_nets()
129
+ # debug("scan_port", "list_local_ips", list_local_ips)
130
+ for local_ip in list_local_ips:
131
+ list_ip = self.generate_ip_list(local_ip)
132
+ self.scan_port_hosts(list_ip, port)
133
+ else:
134
+ list_ip = []
135
+ net = ipaddress.ip_network(network, strict=False)
136
+ for ip in net.hosts():
137
+ list_ip.append(str(ip))
138
+ self.scan_port_hosts(list_ip, port)
139
+
140
+ if self.arguments["localhost"]:
141
+ self.scan_port_hosts(["127.0.0.1"], port)
142
+ self.data["scan"][port].sort(key=lambda ip: int(ip.split('.')[-1]))
143
+ info(f"scan_port [{port}] elapsed time {t.stop():.1f}s", self.data["scan"][port])
144
+ return self.data["scan"][port]
145
+
146
+ def scan_port_hosts(self, list_ip, port=22):
147
+ timeout = self.arguments["timeout"]
148
+ list_threads = []
149
+ for ip in list_ip:
150
+ t = threading.Thread(target=self.scan_host_port, args=(ip, port, timeout))
151
+ t.start()
152
+ list_threads.append(t)
153
+ for t in list_threads:
154
+ t.join()
155
+
156
+ def test_socket(self, ip, port, timeout, transport=socket.SOCK_STREAM):
157
+ try:
158
+ with socket.socket(socket.AF_INET, transport) as sock:
159
+ sock.settimeout(timeout)
160
+ if transport == socket.SOCK_STREAM:
161
+ result = sock.connect_ex((ip, port))
162
+ if result == 0:
163
+ return True
164
+ elif transport == socket.SOCK_DGRAM:
165
+ sock.sendto(b"", (ip, port))
166
+ try:
167
+ data, addr = sock.recvfrom(1)
168
+ return True
169
+ except socket.timeout:
170
+ # warning("sock timeout", (ip, port, transport))
171
+ pass
172
+ except socket.error:
173
+ pass
174
+ return False
175
+
176
+ def scan_host_port(self, ip, port, timeout):
177
+ transport = self.known_ports.get(port, socket.SOCK_STREAM)
178
+ if self.test_socket(ip, port, timeout, transport):
179
+ with self.data_lock:
180
+ if "scan" in self.data:
181
+ self.data["scan"][port].append(ip)
182
+ if "host" in self.data:
183
+ self.data["host"][ip].append(port)
184
+
185
+ def scan_host(self, host):
186
+ timer = Timer()
187
+ self.data.setdefault("host", {})
188
+ self.data["host"][host] = []
189
+ timeout = self.arguments["timeout"]
190
+ list_threads = []
191
+ if len(self.arguments["ports"]) == 0:
192
+ list_ports = list(self.known_ports.keys())
193
+ else:
194
+ list_ports = self.arguments["ports"]
195
+ for port in list_ports:
196
+ thr = threading.Thread(target=self.scan_host_port, args=(host, port, timeout))
197
+ thr.start()
198
+ list_threads.append(thr)
199
+ for thr in list_threads:
200
+ thr.join()
201
+
202
+ self.data["host"][host].sort(key=lambda port: int(port))
203
+ info(f"scan host [{host}] elapsed time {timer.stop():.1f}s", self.data["host"][host])
204
+ return self.data["host"][host]
@@ -0,0 +1,31 @@
1
+ #
2
+ # Pavlin Georgiev, Softel Labs
3
+ #
4
+ # This is a proprietary file and may not be copied,
5
+ # distributed, or modified without express permission
6
+ # from the owner. For licensing inquiries, please
7
+ # contact pavlin@softel.bg.
8
+ #
9
+ # 2024
10
+ #
11
+ import os
12
+ import time
13
+ from sciveo.tools.logger import *
14
+
15
+
16
+ class FilePathQueue:
17
+ def __init__(self, path, period=5):
18
+ self.path = path
19
+ self.period = period
20
+
21
+ def filter(self, file_name, file_path):
22
+ return True
23
+
24
+ def pop(self):
25
+ while(True):
26
+ files = [f for f in os.listdir(self.path) if os.path.isfile(os.path.join(self.path, f))]
27
+ for file_name in files:
28
+ file_path = os.path.join(self.path, file_name)
29
+ if self.filter(file_name, file_path):
30
+ return file_name, file_path
31
+ time.sleep(self.period)
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.1.44'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.42
3
+ Version: 0.1.44
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -125,6 +125,7 @@ sciveo/tools/hardware.py
125
125
  sciveo/tools/http.py
126
126
  sciveo/tools/logger.py
127
127
  sciveo/tools/os.py
128
+ sciveo/tools/queue.py
128
129
  sciveo/tools/random.py
129
130
  sciveo/tools/remote.py
130
131
  sciveo/tools/simple_counter.py
@@ -1,102 +0,0 @@
1
- #
2
- # Pavlin Georgiev, Softel Labs
3
- #
4
- # This is a proprietary file and may not be copied,
5
- # distributed, or modified without express permission
6
- # from the owner. For licensing inquiries, please
7
- # contact pavlin@softel.bg.
8
- #
9
- # 2024
10
- #
11
-
12
- import socket
13
- import ipaddress
14
- import threading
15
-
16
- from sciveo.tools.logger import *
17
- from sciveo.tools.timers import Timer
18
-
19
-
20
- class NetworkTools:
21
- def __init__(self, **kwargs):
22
- self.default_arguments = {
23
- "timeout": 1.0,
24
- "localhost": False,
25
- }
26
-
27
- self.arguments = {}
28
- for k, v in self.default_arguments.items():
29
- self.arguments[k] = kwargs.get(k, v)
30
-
31
- self.net_classes = ["192.168.", "10."]
32
- for i in range(16, 32):
33
- self.net_classes.append(f"172.{i}.")
34
-
35
- self.data = {"scan": {}}
36
- self.data_lock = threading.Lock()
37
-
38
- def get_local_nets(self):
39
- list_local_ips = []
40
- try:
41
- import netifaces
42
- interfaces = netifaces.interfaces()
43
- for interface in interfaces:
44
- addrs = netifaces.ifaddresses(interface)
45
- if netifaces.AF_INET in addrs:
46
- ip = addrs[netifaces.AF_INET][0]['addr']
47
- for net_class in self.net_classes:
48
- if ip.startswith(net_class):
49
- list_local_ips.append(ip)
50
- except Exception as e:
51
- warning("netifaces not installed")
52
- return list_local_ips
53
-
54
- def generate_ip_list(self, base_ip):
55
- octets = base_ip.split('.')
56
- network_prefix = '.'.join(octets[:3])
57
- return [f'{network_prefix}.{i}' for i in range(1, 255)]
58
-
59
- def scan_port(self, port=22, network=None):
60
- t = Timer()
61
- self.data["scan"].setdefault(port, [])
62
-
63
- if network is None:
64
- list_local_ips = self.get_local_nets()
65
- # debug("scan_port", "list_local_ips", list_local_ips)
66
- for local_ip in list_local_ips:
67
- list_ip = self.generate_ip_list(local_ip)
68
- self.scan_port_hosts(list_ip, port)
69
- else:
70
- list_ip = []
71
- net = ipaddress.ip_network(network, strict=False)
72
- for ip in net.hosts():
73
- list_ip.append(str(ip))
74
- self.scan_port_hosts(list_ip, port)
75
-
76
- if self.arguments["localhost"]:
77
- self.scan_port_hosts(["127.0.0.1"], port)
78
- self.data["scan"][port].sort(key=lambda ip: int(ip.split('.')[-1]))
79
- info(f"scan_port [{port}] elapsed time {t.stop():.1f}s", self.data["scan"][port])
80
- return self.data["scan"][port]
81
-
82
- def scan_port_hosts(self, list_ip, port=22):
83
- timeout = self.arguments["timeout"]
84
- list_threads = []
85
- for ip in list_ip:
86
- t = threading.Thread(target=self.scan_host_port, args=(ip, port, timeout))
87
- t.start()
88
- list_threads.append(t)
89
- for t in list_threads:
90
- t.join()
91
-
92
- def scan_host_port(self, ip, port, timeout):
93
- try:
94
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
95
- sock.settimeout(timeout)
96
- result = sock.connect_ex((ip, port))
97
- if result == 0:
98
- with self.data_lock:
99
- self.data["scan"][port].append(ip)
100
- # debug("scan_ports", ip, port, result)
101
- except socket.error:
102
- pass
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.1.42'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes