dkinst 0.4.1__py3-none-any.whl → 0.6.1__py3-none-any.whl

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.
dkinst/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """Den K Simple Installer"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '0.4.1'
4
+ __version__ = '0.6.1'
@@ -0,0 +1,117 @@
1
+ from pathlib import Path
2
+ from types import ModuleType
3
+ import os
4
+ import subprocess
5
+ import time
6
+ from typing import Literal
7
+
8
+ from rich.console import Console
9
+
10
+ from atomicshop.wrappers import githubw
11
+ from atomicshop import filesystem
12
+
13
+ from . import _base
14
+ from .helpers.infra import msis
15
+
16
+
17
+ console = Console()
18
+
19
+
20
+ DEFAULT_INSTALLATION_EXE_PATH = r"C:\Program Files\Fibratus\Bin\fibratus.exe"
21
+ WAIT_SECONDS_FOR_EXECUTABLE_TO_APPEAR_AFTER_INSTALLATION: float = 10
22
+
23
+
24
+ class Fibratus(_base.BaseInstaller):
25
+ def __init__(self):
26
+ super().__init__()
27
+ self.name: str = Path(__file__).stem
28
+ self.description: str = "Fibratus Installer"
29
+ self.version: str = "1.0.0"
30
+ self.platforms: list = ["windows"]
31
+ self.helper: ModuleType | None = None
32
+
33
+ def install(
34
+ self
35
+ ):
36
+ install_fibratus()
37
+
38
+ def _show_help(
39
+ self,
40
+ method: Literal["install", "uninstall", "update"]
41
+ ) -> None:
42
+ if method == "install":
43
+ method_help: str = (
44
+ "The latest MSI installer is downloaded from the GitHub releases page and installed silently.\n"
45
+ "\n"
46
+ )
47
+ print(method_help)
48
+ else:
49
+ raise ValueError(f"Unknown method '{method}'.")
50
+
51
+
52
+ def install_fibratus(
53
+ installation_file_download_directory: str = None,
54
+ place_to_download_file: Literal['working', 'temp', 'script'] = 'temp',
55
+ remove_file_after_installation: bool = True
56
+ ) -> int:
57
+ """
58
+ Download latest release from GitHub and install Fibratus.
59
+ :param installation_file_download_directory: Directory to download the installation file. If None, the download
60
+ directory will be automatically determined, by the 'place_to_download_file' parameter.
61
+ :param place_to_download_file: Where to download the installation file.
62
+ 'working' is the working directory of the script.
63
+ 'temp' is the temporary directory.
64
+ 'script' is the directory of the script.
65
+ :param remove_file_after_installation: Whether to remove the installation file after installation.
66
+ :return:
67
+ """
68
+
69
+ if not installation_file_download_directory:
70
+ installation_file_download_directory = filesystem.get_download_directory(
71
+ place=place_to_download_file, script_path=__file__)
72
+
73
+ github_wrapper = githubw.GitHubWrapper(user_name='rabbitstack', repo_name='fibratus')
74
+ fibratus_setup_file_path: str = github_wrapper.download_latest_release(
75
+ target_directory=installation_file_download_directory,
76
+ asset_pattern='*fibratus-*-amd64.msi',
77
+ exclude_string='slim')
78
+
79
+ # Install the MSI file
80
+ msis.install_msi(msi_path=fibratus_setup_file_path)
81
+
82
+ count = 0
83
+ while count != WAIT_SECONDS_FOR_EXECUTABLE_TO_APPEAR_AFTER_INSTALLATION:
84
+ if os.path.isfile(DEFAULT_INSTALLATION_EXE_PATH):
85
+ break
86
+ count += 1
87
+ time.sleep(1)
88
+
89
+ if count == WAIT_SECONDS_FOR_EXECUTABLE_TO_APPEAR_AFTER_INSTALLATION:
90
+ message = \
91
+ (f"Fibratus installation failed. The executable was not found after "
92
+ f"{str(WAIT_SECONDS_FOR_EXECUTABLE_TO_APPEAR_AFTER_INSTALLATION)} seconds.\n"
93
+ f"{DEFAULT_INSTALLATION_EXE_PATH}")
94
+ console.print(message, style="red")
95
+ return 1
96
+
97
+ # Check if the installation was successful
98
+ try:
99
+ result = subprocess.run([DEFAULT_INSTALLATION_EXE_PATH], capture_output=True, text=True)
100
+ except FileNotFoundError:
101
+ console.print("Fibratus executable not found.", style="red")
102
+ return 1
103
+
104
+ if result.returncode == 0:
105
+ console.print("Fibratus installed successfully. Please restart.", style="green")
106
+ else:
107
+ console.print("Fibratus installation failed.", style="red")
108
+ console.print(result.stderr)
109
+ return 1
110
+
111
+ # Wait for the installation to finish before removing the file.
112
+ time.sleep(5)
113
+
114
+ if remove_file_after_installation:
115
+ filesystem.remove_file(fibratus_setup_file_path)
116
+
117
+ return 0
@@ -13,7 +13,8 @@ from ..infra import system
13
13
  console = Console()
14
14
 
15
15
 
16
- VERSION: str = "1.0.0"
16
+ VERSION: str = "1.0.1"
17
+ """Fixed Ubuntu installation"""
17
18
 
18
19
 
19
20
  # === WINDOWS FUNCTIONS ================================================================================================
@@ -23,8 +24,6 @@ import tempfile
23
24
 
24
25
  from atomicshop import web
25
26
 
26
- from ..infra import permissions, msis
27
-
28
27
 
29
28
  WINDOWS_X64_SUFFIX: str = "x64.msi"
30
29
 
@@ -171,6 +170,10 @@ def install_nodejs_win(
171
170
  :param force: bool, if True, the function will install Node.js even if it is already installed.
172
171
  :return: int, 0 if successful, 1 if failed.
173
172
  """
173
+
174
+ from ..infra import permissions, msis
175
+
176
+
174
177
  if not permissions.is_admin():
175
178
  console.print("This script requires administrative privileges to install Node.js.", style="red")
176
179
  return 1
@@ -0,0 +1,46 @@
1
+ from pathlib import Path
2
+ from types import ModuleType
3
+ from typing import Literal
4
+ import subprocess
5
+ import sys
6
+
7
+ from rich.console import Console
8
+
9
+ from . import _base
10
+
11
+
12
+ console = Console()
13
+
14
+
15
+ WHEEL = (
16
+ "https://github.com/fireeye/pywintrace/releases/download/v0.3.0/pywintrace-0.3.0-py3-none-any.whl"
17
+ )
18
+
19
+
20
+ class PyWintrace(_base.BaseInstaller):
21
+ def __init__(self):
22
+ super().__init__()
23
+ self.name: str = Path(__file__).stem
24
+ self.description: str = "PyWintrace Git Wheel Installer"
25
+ self.version: str = "1.0.0"
26
+ self.platforms: list = ["windows"]
27
+ self.helper: ModuleType | None = None
28
+
29
+ def install(
30
+ self,
31
+ force: bool = False
32
+ ):
33
+ subprocess.check_call([sys.executable, "-m", "pip", "install", WHEEL])
34
+
35
+ def _show_help(
36
+ self,
37
+ method: Literal["install", "uninstall", "update"]
38
+ ) -> None:
39
+ if method == "install":
40
+ method_help: str = (
41
+ "This method uses pip and PyWintrace latest wheel on GitHub (because there is a lower version on PyPi:\n"
42
+ " pip install https://github.com/fireeye/pywintrace/releases/download/v0.3.0/pywintrace-0.3.0-py3-none-any.whl\n"
43
+ )
44
+ print(method_help)
45
+ else:
46
+ raise ValueError(f"Unknown method '{method}'.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dkinst
3
- Version: 0.4.1
3
+ Version: 0.6.1
4
4
  Summary: Den K Simple Installer
5
5
  Author: Denis Kras
6
6
  License-Expression: MIT
@@ -29,6 +29,16 @@ So, I will not search for a setup script/line or write one.
29
29
  It is written in Python, currently supports 3.12. Hope to support newer versions in the near future.
30
30
 
31
31
 
32
+ <!-- AVAILABLE INSTALLERS -->
33
+ ## Available Installers
34
+
35
+ You can check the 'installers' folder for the available installers.
36
+ Or execute in CMD:
37
+ ```cmd
38
+ dkinst available
39
+ ```
40
+
41
+
32
42
  <!-- GETTING STARTED -->
33
43
  ## Getting Started
34
44
 
@@ -1,10 +1,12 @@
1
- dkinst/__init__.py,sha256=DJlBbVtolLsH24o0HeILaF4gxpl7DL0axOCiIu97aD8,78
1
+ dkinst/__init__.py,sha256=4UW5adnZG_XFfZJlFqo30hAMKAvA5c73VlqXkLOUImI,78
2
2
  dkinst/cli.py,sha256=4jLmbW73FInE21i1FXhuhM6eymWhA4Pvicl34H62K_4,9278
3
3
  dkinst/config.toml,sha256=OaTuImf9xBIbTNCrC2MfAzpPLeuDdV2R5feIfT7xImA,48
4
4
  dkinst/installers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  dkinst/installers/_base.py,sha256=2Ke4pQevOq3SRpCI1YKB9JrIwKIacPvAAMfjKn7IG20,10280
6
+ dkinst/installers/fibratus.py,sha256=l95ijrd4xZRKnz-lX35pzkIpDvkOuQbzkjPrwISS-SQ,4137
6
7
  dkinst/installers/nodejs.py,sha256=34UObZLKjRIKcQt3Omslcqyuibm1m6u9nR6-W472gqY,1781
7
8
  dkinst/installers/pycharm.py,sha256=GvH8uVCItaIjPSGPg2pyYl-7-LOkvh7gtubWmD2qvTM,1196
9
+ dkinst/installers/pywintrace.py,sha256=UM4kAhU8lyfNPRYQrVDETa9kfEL_6Cyl1XcRNo_xebs,1384
8
10
  dkinst/installers/robocorp.py,sha256=yDBnA6sFjMSiOhwtyMRd59K-k6VC-42e5zVjeYZbmR4,4141
9
11
  dkinst/installers/tesseract_ocr.py,sha256=iEW6S9CxzGRrhzYW0A0FMwgb6SxKXOOfCdiI1EAG5W0,2532
10
12
  dkinst/installers/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,12 +15,12 @@ dkinst/installers/helpers/infra/msis.py,sha256=WQCTo3CsublO_xfyAgim5_HqlzMbjfhuY
13
15
  dkinst/installers/helpers/infra/permissions.py,sha256=CYTDVOI0jh9ks0ZLnnOuPzppgCszFEc9-92DTkVTYi4,522
14
16
  dkinst/installers/helpers/infra/system.py,sha256=CovoRRRz3TFEHKzHjuoSEJ2vrJGSbUETm3j5m-fjC2I,676
15
17
  dkinst/installers/helpers/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- dkinst/installers/helpers/modules/nodejs_installer.py,sha256=crilyPMcFrydvpmgZjj5Q0evT5oQswY-pLmrt2BDr54,14966
18
+ dkinst/installers/helpers/modules/nodejs_installer.py,sha256=bqOXgRe1-BHB-noJIkZmURl6xSK2scqcTPfpWV8Lsl8,15007
17
19
  dkinst/installers/helpers/modules/pycharm_installer.py,sha256=sRuRCvqFBoCxc9XDqb3E05x-M2LmFGV8c47FsXai8Xg,4914
18
20
  dkinst/installers/helpers/modules/tesseract_ocr_manager.py,sha256=lJYVJDp5OTto4GHY1xkvJUkXCR1sgcOwj3UEUvfbPps,17369
19
- dkinst-0.4.1.dist-info/licenses/LICENSE,sha256=ohlj1rmsTHdctr-wyqmP6kbFC6Sff8pJd29v3pruZ18,1088
20
- dkinst-0.4.1.dist-info/METADATA,sha256=aevn_0EpnKKRwGhohQreBnCJXvp2mcZJRDupv72ZEVk,2045
21
- dkinst-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- dkinst-0.4.1.dist-info/entry_points.txt,sha256=YNgO3GufKMdA_oRqWEGAVh6k00oIuPItqqChoUtU278,43
23
- dkinst-0.4.1.dist-info/top_level.txt,sha256=_dGNrME6z6Ihv2sxGC4hfAlnVuhoDlKwx-97LZ2xtQ0,7
24
- dkinst-0.4.1.dist-info/RECORD,,
21
+ dkinst-0.6.1.dist-info/licenses/LICENSE,sha256=ohlj1rmsTHdctr-wyqmP6kbFC6Sff8pJd29v3pruZ18,1088
22
+ dkinst-0.6.1.dist-info/METADATA,sha256=e_vTLx3JRHOymorB2aVusxdOoQA8KonOaIjQonjIUFg,2227
23
+ dkinst-0.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ dkinst-0.6.1.dist-info/entry_points.txt,sha256=YNgO3GufKMdA_oRqWEGAVh6k00oIuPItqqChoUtU278,43
25
+ dkinst-0.6.1.dist-info/top_level.txt,sha256=_dGNrME6z6Ihv2sxGC4hfAlnVuhoDlKwx-97LZ2xtQ0,7
26
+ dkinst-0.6.1.dist-info/RECORD,,
File without changes