dkinst 0.5.0__py3-none-any.whl → 0.6.2__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 +1 -1
- dkinst/installers/fibratus.py +117 -0
- dkinst/installers/helpers/infra/msis.py +5 -3
- dkinst/installers/helpers/modules/nodejs_installer.py +3 -3
- {dkinst-0.5.0.dist-info → dkinst-0.6.2.dist-info}/METADATA +11 -1
- {dkinst-0.5.0.dist-info → dkinst-0.6.2.dist-info}/RECORD +10 -9
- {dkinst-0.5.0.dist-info → dkinst-0.6.2.dist-info}/WHEEL +0 -0
- {dkinst-0.5.0.dist-info → dkinst-0.6.2.dist-info}/entry_points.txt +0 -0
- {dkinst-0.5.0.dist-info → dkinst-0.6.2.dist-info}/licenses/LICENSE +0 -0
- {dkinst-0.5.0.dist-info → dkinst-0.6.2.dist-info}/top_level.txt +0 -0
dkinst/__init__.py
CHANGED
@@ -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
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import subprocess
|
2
|
+
import platform
|
2
3
|
|
3
4
|
from rich.console import Console
|
4
5
|
|
5
|
-
|
6
|
-
from
|
7
|
-
from atomicshop
|
6
|
+
if platform.system().lower() == 'windows':
|
7
|
+
from . import permissions
|
8
|
+
from atomicshop import get_process_list
|
9
|
+
from atomicshop.wrappers.psutilw import processes
|
8
10
|
|
9
11
|
|
10
12
|
console = Console()
|
@@ -7,13 +7,14 @@ from rich.console import Console
|
|
7
7
|
|
8
8
|
from atomicshop.wrappers import githubw
|
9
9
|
|
10
|
-
from ..infra import system
|
10
|
+
from ..infra import permissions, msis, system
|
11
11
|
|
12
12
|
|
13
13
|
console = Console()
|
14
14
|
|
15
15
|
|
16
16
|
VERSION: str = "1.0.0"
|
17
|
+
"""Initial"""
|
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,7 @@ 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
174
|
if not permissions.is_admin():
|
175
175
|
console.print("This script requires administrative privileges to install Node.js.", style="red")
|
176
176
|
return 1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dkinst
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.6.2
|
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,8 +1,9 @@
|
|
1
|
-
dkinst/__init__.py,sha256=
|
1
|
+
dkinst/__init__.py,sha256=afvjmZLc_8jjchllv0CdTBVA4-kADdoTLc-CzdpRPsA,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
|
8
9
|
dkinst/installers/pywintrace.py,sha256=UM4kAhU8lyfNPRYQrVDETa9kfEL_6Cyl1XcRNo_xebs,1384
|
@@ -10,16 +11,16 @@ dkinst/installers/robocorp.py,sha256=yDBnA6sFjMSiOhwtyMRd59K-k6VC-42e5zVjeYZbmR4
|
|
10
11
|
dkinst/installers/tesseract_ocr.py,sha256=iEW6S9CxzGRrhzYW0A0FMwgb6SxKXOOfCdiI1EAG5W0,2532
|
11
12
|
dkinst/installers/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
13
|
dkinst/installers/helpers/infra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
dkinst/installers/helpers/infra/msis.py,sha256=
|
14
|
+
dkinst/installers/helpers/infra/msis.py,sha256=Ek7Ps-JyET638B2BJzkoP2ujKnl2LChRxOZMsDM4PqA,6109
|
14
15
|
dkinst/installers/helpers/infra/permissions.py,sha256=CYTDVOI0jh9ks0ZLnnOuPzppgCszFEc9-92DTkVTYi4,522
|
15
16
|
dkinst/installers/helpers/infra/system.py,sha256=CovoRRRz3TFEHKzHjuoSEJ2vrJGSbUETm3j5m-fjC2I,676
|
16
17
|
dkinst/installers/helpers/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
dkinst/installers/helpers/modules/nodejs_installer.py,sha256=
|
18
|
+
dkinst/installers/helpers/modules/nodejs_installer.py,sha256=iEWo-ftth6aVmEU9eclIv3swfNYqyd7OKGaW_ffOo6w,14961
|
18
19
|
dkinst/installers/helpers/modules/pycharm_installer.py,sha256=sRuRCvqFBoCxc9XDqb3E05x-M2LmFGV8c47FsXai8Xg,4914
|
19
20
|
dkinst/installers/helpers/modules/tesseract_ocr_manager.py,sha256=lJYVJDp5OTto4GHY1xkvJUkXCR1sgcOwj3UEUvfbPps,17369
|
20
|
-
dkinst-0.
|
21
|
-
dkinst-0.
|
22
|
-
dkinst-0.
|
23
|
-
dkinst-0.
|
24
|
-
dkinst-0.
|
25
|
-
dkinst-0.
|
21
|
+
dkinst-0.6.2.dist-info/licenses/LICENSE,sha256=ohlj1rmsTHdctr-wyqmP6kbFC6Sff8pJd29v3pruZ18,1088
|
22
|
+
dkinst-0.6.2.dist-info/METADATA,sha256=_0KStMij2htVf8fCwWZm56Ksubx13DFahme4d0SqJh4,2227
|
23
|
+
dkinst-0.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
24
|
+
dkinst-0.6.2.dist-info/entry_points.txt,sha256=YNgO3GufKMdA_oRqWEGAVh6k00oIuPItqqChoUtU278,43
|
25
|
+
dkinst-0.6.2.dist-info/top_level.txt,sha256=_dGNrME6z6Ihv2sxGC4hfAlnVuhoDlKwx-97LZ2xtQ0,7
|
26
|
+
dkinst-0.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|