sysmaint 0.1.0__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.
- sysmaint/__init__.py +17 -0
- sysmaint/__main__.py +6 -0
- sysmaint/cli.py +637 -0
- sysmaint/config.py +229 -0
- sysmaint/gui/__init__.py +5 -0
- sysmaint/gui/app.py +193 -0
- sysmaint/gui/components/__init__.py +13 -0
- sysmaint/gui/components/cards.py +239 -0
- sysmaint/gui/components/console.py +61 -0
- sysmaint/gui/components/dialogs.py +79 -0
- sysmaint/gui/theme.py +52 -0
- sysmaint/gui/views/__init__.py +25 -0
- sysmaint/gui/views/backup.py +167 -0
- sysmaint/gui/views/cleaner.py +227 -0
- sysmaint/gui/views/dashboard.py +252 -0
- sysmaint/gui/views/diagnostics.py +243 -0
- sysmaint/gui/views/integrity.py +158 -0
- sysmaint/gui/views/malware.py +293 -0
- sysmaint/gui/views/network.py +171 -0
- sysmaint/gui/views/security.py +118 -0
- sysmaint/gui/views/settings.py +211 -0
- sysmaint/gui/views/startup.py +133 -0
- sysmaint/logging_setup.py +62 -0
- sysmaint/modules/__init__.py +41 -0
- sysmaint/modules/backup.py +106 -0
- sysmaint/modules/cleaner.py +249 -0
- sysmaint/modules/disk.py +160 -0
- sysmaint/modules/drivers.py +89 -0
- sysmaint/modules/integrity.py +148 -0
- sysmaint/modules/malware.py +412 -0
- sysmaint/modules/memory.py +105 -0
- sysmaint/modules/network.py +167 -0
- sysmaint/modules/optimizer.py +186 -0
- sysmaint/modules/recovery.py +353 -0
- sysmaint/modules/report.py +232 -0
- sysmaint/modules/restore.py +123 -0
- sysmaint/modules/scheduler.py +137 -0
- sysmaint/modules/security.py +88 -0
- sysmaint/modules/services.py +171 -0
- sysmaint/modules/startup.py +95 -0
- sysmaint/modules/sysinfo.py +112 -0
- sysmaint/service/__init__.py +5 -0
- sysmaint/service/server.py +210 -0
- sysmaint/tui/__init__.py +5 -0
- sysmaint/tui/app.py +830 -0
- sysmaint/tui/modals.py +201 -0
- sysmaint/tui/themes.py +97 -0
- sysmaint/utils/__init__.py +39 -0
- sysmaint/utils/common.py +255 -0
- sysmaint/utils/escalate.py +93 -0
- sysmaint/utils/linux.py +240 -0
- sysmaint/utils/parsers.py +171 -0
- sysmaint/utils/windows.py +308 -0
- sysmaint-0.1.0.dist-info/METADATA +307 -0
- sysmaint-0.1.0.dist-info/RECORD +57 -0
- sysmaint-0.1.0.dist-info/WHEEL +4 -0
- sysmaint-0.1.0.dist-info/entry_points.txt +5 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# sysmaint/utils/windows.py
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import ctypes
|
|
6
|
+
import json
|
|
7
|
+
import logging
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from .common import run_command
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger("sysmaint.windows")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def run_powershell(script: str, as_json: bool = False) -> Any:
|
|
18
|
+
"""
|
|
19
|
+
Execute a PowerShell snippet and optionally parse JSON output.
|
|
20
|
+
"""
|
|
21
|
+
cmd = [
|
|
22
|
+
"powershell",
|
|
23
|
+
"-NoProfile",
|
|
24
|
+
"-NonInteractive",
|
|
25
|
+
"-ExecutionPolicy",
|
|
26
|
+
"Bypass",
|
|
27
|
+
"-Command",
|
|
28
|
+
script,
|
|
29
|
+
]
|
|
30
|
+
result = run_command(cmd, check=False)
|
|
31
|
+
if result.returncode != 0:
|
|
32
|
+
logger.debug("PowerShell command error: %s", result.stderr.strip())
|
|
33
|
+
return None if as_json else result.stdout
|
|
34
|
+
|
|
35
|
+
if as_json:
|
|
36
|
+
raw = result.stdout.strip()
|
|
37
|
+
if not raw:
|
|
38
|
+
return []
|
|
39
|
+
try:
|
|
40
|
+
data = json.loads(raw)
|
|
41
|
+
return data if isinstance(data, list) else [data]
|
|
42
|
+
except json.JSONDecodeError:
|
|
43
|
+
logger.debug("Failed to decode JSON from PowerShell: %s", raw[:100])
|
|
44
|
+
return []
|
|
45
|
+
return result.stdout
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def create_restore_point(description: str = "SysMaint Backup") -> bool:
|
|
49
|
+
"""
|
|
50
|
+
Create a Windows System Restore point using PowerShell.
|
|
51
|
+
Requires administrator privileges.
|
|
52
|
+
"""
|
|
53
|
+
ps_script = (
|
|
54
|
+
f'Checkpoint-Computer -Description "{description}" '
|
|
55
|
+
'-RestorePointType "MODIFY_SETTINGS" -ErrorAction Stop'
|
|
56
|
+
)
|
|
57
|
+
result = run_command(
|
|
58
|
+
["powershell", "-NoProfile", "-Command", ps_script],
|
|
59
|
+
check=False,
|
|
60
|
+
)
|
|
61
|
+
if result.returncode != 0:
|
|
62
|
+
logger.warning("Restore point creation failed: %s", result.stderr.strip())
|
|
63
|
+
raise RuntimeError(f"Failed to create restore point: {result.stderr.strip()}")
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def list_restore_points() -> list[dict[str, Any]]:
|
|
68
|
+
"""
|
|
69
|
+
List all available Windows System Restore Points.
|
|
70
|
+
"""
|
|
71
|
+
script = (
|
|
72
|
+
"Get-ComputerRestorePoint -ErrorAction SilentlyContinue | "
|
|
73
|
+
"Select-Object SequenceNumber, Description, CreationTime, EventType, RestorePointType | "
|
|
74
|
+
"ConvertTo-Json"
|
|
75
|
+
)
|
|
76
|
+
data = run_powershell(script, as_json=True)
|
|
77
|
+
points = []
|
|
78
|
+
if isinstance(data, list):
|
|
79
|
+
for item in data:
|
|
80
|
+
if isinstance(item, dict):
|
|
81
|
+
points.append({
|
|
82
|
+
"sequence_number": item.get("SequenceNumber"),
|
|
83
|
+
"description": item.get("Description", "Restore Point"),
|
|
84
|
+
"time": item.get("CreationTime"),
|
|
85
|
+
"type": item.get("RestorePointType"),
|
|
86
|
+
})
|
|
87
|
+
return points
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def get_windows_services() -> list[dict[str, Any]]:
|
|
91
|
+
"""Return a list of all Windows services using PowerShell."""
|
|
92
|
+
script = (
|
|
93
|
+
"Get-Service | "
|
|
94
|
+
"Select-Object Name, DisplayName, Status, StartType | "
|
|
95
|
+
"ConvertTo-Json -Compress"
|
|
96
|
+
)
|
|
97
|
+
data = run_powershell(script, as_json=True)
|
|
98
|
+
services = []
|
|
99
|
+
if isinstance(data, list):
|
|
100
|
+
for item in data:
|
|
101
|
+
if isinstance(item, dict):
|
|
102
|
+
services.append({
|
|
103
|
+
"name": item.get("Name", ""),
|
|
104
|
+
"display_name": item.get("DisplayName", item.get("Name", "")),
|
|
105
|
+
"status": str(item.get("Status", "Unknown")),
|
|
106
|
+
"start_type": str(item.get("StartType", "Unknown")),
|
|
107
|
+
})
|
|
108
|
+
return services
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def get_pnp_device_errors() -> list[dict[str, Any]]:
|
|
112
|
+
"""
|
|
113
|
+
Scan for hardware devices reporting errors or degraded states in Windows Device Manager.
|
|
114
|
+
"""
|
|
115
|
+
script = (
|
|
116
|
+
"Get-PnpDevice -Status 'Error','Degraded','Unknown' -ErrorAction SilentlyContinue | "
|
|
117
|
+
"Select-Object FriendlyName, InstanceId, Class, Status, Problem, ProblemDescription | "
|
|
118
|
+
"ConvertTo-Json"
|
|
119
|
+
)
|
|
120
|
+
data = run_powershell(script, as_json=True)
|
|
121
|
+
devices = []
|
|
122
|
+
if isinstance(data, list):
|
|
123
|
+
for item in data:
|
|
124
|
+
if isinstance(item, dict) and item.get("FriendlyName"):
|
|
125
|
+
devices.append({
|
|
126
|
+
"name": item.get("FriendlyName"),
|
|
127
|
+
"class": item.get("Class"),
|
|
128
|
+
"status": item.get("Status"),
|
|
129
|
+
"problem_code": item.get("Problem"),
|
|
130
|
+
"problem_description": item.get("ProblemDescription", "Device has a problem"),
|
|
131
|
+
})
|
|
132
|
+
return devices
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def get_windows_startup_items() -> list[dict[str, Any]]:
|
|
136
|
+
"""
|
|
137
|
+
Enumerate startup programs from Windows Registry (HKCU and HKLM Run keys).
|
|
138
|
+
"""
|
|
139
|
+
items = []
|
|
140
|
+
try:
|
|
141
|
+
import winreg
|
|
142
|
+
|
|
143
|
+
reg_locations = [
|
|
144
|
+
(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Run", "User Registry"),
|
|
145
|
+
(winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\Windows\CurrentVersion\Run", "System Registry"),
|
|
146
|
+
(winreg.HKEY_LOCAL_MACHINE, r"Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run", "System (32-bit)"),
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
for hkey, subkey, location in reg_locations:
|
|
150
|
+
try:
|
|
151
|
+
with winreg.OpenKey(hkey, subkey, 0, winreg.KEY_READ) as key:
|
|
152
|
+
i = 0
|
|
153
|
+
while True:
|
|
154
|
+
try:
|
|
155
|
+
name, value, _ = winreg.EnumValue(key, i)
|
|
156
|
+
items.append({
|
|
157
|
+
"name": name,
|
|
158
|
+
"command": value,
|
|
159
|
+
"location": location,
|
|
160
|
+
"registry_key": subkey,
|
|
161
|
+
"is_system": hkey == winreg.HKEY_LOCAL_MACHINE,
|
|
162
|
+
"enabled": True,
|
|
163
|
+
})
|
|
164
|
+
i += 1
|
|
165
|
+
except OSError:
|
|
166
|
+
break
|
|
167
|
+
except OSError:
|
|
168
|
+
pass
|
|
169
|
+
except ImportError:
|
|
170
|
+
pass
|
|
171
|
+
|
|
172
|
+
# Check Startup Folder
|
|
173
|
+
appdata = os.environ.get("APPDATA")
|
|
174
|
+
if appdata:
|
|
175
|
+
startup_dir = Path(appdata) / r"Microsoft\Windows\Start Menu\Programs\Startup"
|
|
176
|
+
if startup_dir.is_dir():
|
|
177
|
+
for entry in startup_dir.iterdir():
|
|
178
|
+
if entry.is_file() and entry.name.lower() != "desktop.ini":
|
|
179
|
+
items.append({
|
|
180
|
+
"name": entry.stem,
|
|
181
|
+
"command": str(entry),
|
|
182
|
+
"location": "Startup Folder",
|
|
183
|
+
"registry_key": None,
|
|
184
|
+
"is_system": False,
|
|
185
|
+
"enabled": True,
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
return items
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def flush_windows_dns() -> bool:
|
|
192
|
+
"""
|
|
193
|
+
Flush the Windows DNS resolver cache.
|
|
194
|
+
"""
|
|
195
|
+
result = run_command(["ipconfig", "/flushdns"], check=False)
|
|
196
|
+
return result.returncode == 0
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def get_windows_security_status() -> dict[str, Any]:
|
|
200
|
+
"""
|
|
201
|
+
Query Windows Defender, Windows Firewall, and UAC security settings.
|
|
202
|
+
"""
|
|
203
|
+
script = (
|
|
204
|
+
"@{ "
|
|
205
|
+
"Defender = (Get-MpComputerStatus -ErrorAction SilentlyContinue | Select-Object AMServiceEnabled, AntispywareEnabled, RealTimeProtectionEnabled); "
|
|
206
|
+
"Firewall = (Get-NetFirewallProfile -ErrorAction SilentlyContinue | Select-Object Name, Enabled); "
|
|
207
|
+
"} | ConvertTo-Json -Depth 3"
|
|
208
|
+
)
|
|
209
|
+
res = run_powershell(script, as_json=False)
|
|
210
|
+
security_info = {
|
|
211
|
+
"antivirus": "Windows Defender",
|
|
212
|
+
"realtime_protection": True,
|
|
213
|
+
"firewall_enabled": True,
|
|
214
|
+
"firewall_profiles": [],
|
|
215
|
+
"uac_active": True,
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if res:
|
|
219
|
+
try:
|
|
220
|
+
parsed = json.loads(res)
|
|
221
|
+
defender = parsed.get("Defender", {})
|
|
222
|
+
if defender:
|
|
223
|
+
security_info["realtime_protection"] = bool(defender.get("RealTimeProtectionEnabled", True))
|
|
224
|
+
security_info["antivirus_active"] = bool(defender.get("AMServiceEnabled", True))
|
|
225
|
+
|
|
226
|
+
firewalls = parsed.get("Firewall", [])
|
|
227
|
+
if isinstance(firewalls, dict):
|
|
228
|
+
firewalls = [firewalls]
|
|
229
|
+
if isinstance(firewalls, list):
|
|
230
|
+
all_enabled = all(bool(f.get("Enabled")) for f in firewalls if isinstance(f, dict))
|
|
231
|
+
security_info["firewall_enabled"] = all_enabled
|
|
232
|
+
security_info["firewall_profiles"] = [
|
|
233
|
+
{"name": f.get("Name"), "enabled": bool(f.get("Enabled"))}
|
|
234
|
+
for f in firewalls if isinstance(f, dict)
|
|
235
|
+
]
|
|
236
|
+
except Exception:
|
|
237
|
+
pass
|
|
238
|
+
|
|
239
|
+
return security_info
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def get_windows_temp_paths() -> dict[str, Path]:
|
|
243
|
+
"""
|
|
244
|
+
Return standard Windows junk and cache directories.
|
|
245
|
+
"""
|
|
246
|
+
paths: dict[str, Path] = {}
|
|
247
|
+
|
|
248
|
+
# User Temp
|
|
249
|
+
user_temp = os.environ.get("TEMP") or os.environ.get("TMP")
|
|
250
|
+
if user_temp:
|
|
251
|
+
paths["User Temp Files"] = Path(user_temp)
|
|
252
|
+
|
|
253
|
+
# System Temp
|
|
254
|
+
sys_temp = Path(r"C:\Windows\Temp")
|
|
255
|
+
if sys_temp.is_dir():
|
|
256
|
+
paths["System Temp Files"] = sys_temp
|
|
257
|
+
|
|
258
|
+
# Prefetch
|
|
259
|
+
prefetch = Path(r"C:\Windows\Prefetch")
|
|
260
|
+
if prefetch.is_dir():
|
|
261
|
+
paths["Windows Prefetch"] = prefetch
|
|
262
|
+
|
|
263
|
+
# Windows Update Download Cache
|
|
264
|
+
software_dist = Path(r"C:\Windows\SoftwareDistribution\Download")
|
|
265
|
+
if software_dist.is_dir():
|
|
266
|
+
paths["Windows Update Cache"] = software_dist
|
|
267
|
+
|
|
268
|
+
# Crash Dumps
|
|
269
|
+
local_app_data = os.environ.get("LOCALAPPDATA")
|
|
270
|
+
if local_app_data:
|
|
271
|
+
crash_dumps = Path(local_app_data) / "CrashDumps"
|
|
272
|
+
if crash_dumps.is_dir():
|
|
273
|
+
paths["Application Crash Dumps"] = crash_dumps
|
|
274
|
+
|
|
275
|
+
return paths
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def trim_process_working_sets() -> int:
|
|
279
|
+
"""
|
|
280
|
+
Trigger Windows working set cleanup (EmptyWorkingSet) on accessible processes to free inactive RAM.
|
|
281
|
+
Returns number of processes trimmed.
|
|
282
|
+
"""
|
|
283
|
+
if os.name != "nt":
|
|
284
|
+
return 0
|
|
285
|
+
|
|
286
|
+
count = 0
|
|
287
|
+
try:
|
|
288
|
+
import psutil
|
|
289
|
+
kernel32 = ctypes.windll.kernel32
|
|
290
|
+
psapi = ctypes.windll.psapi
|
|
291
|
+
PROCESS_SET_QUOTA = 0x0100
|
|
292
|
+
PROCESS_QUERY_INFORMATION = 0x0400
|
|
293
|
+
|
|
294
|
+
for proc in psutil.process_iter(["pid", "name"]):
|
|
295
|
+
pid = proc.info["pid"]
|
|
296
|
+
if pid <= 4:
|
|
297
|
+
continue
|
|
298
|
+
h_proc = kernel32.OpenProcess(PROCESS_SET_QUOTA | PROCESS_QUERY_INFORMATION, False, pid)
|
|
299
|
+
if h_proc:
|
|
300
|
+
try:
|
|
301
|
+
if psapi.EmptyWorkingSet(h_proc):
|
|
302
|
+
count += 1
|
|
303
|
+
finally:
|
|
304
|
+
kernel32.CloseHandle(h_proc)
|
|
305
|
+
except Exception as exc:
|
|
306
|
+
logger.debug("Memory trim encountered exception: %s", exc)
|
|
307
|
+
|
|
308
|
+
return count
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sysmaint
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cross-Platform System Maintenance, Security & Data Recovery Microservice by Kennny7 Microservices
|
|
5
|
+
Project-URL: Homepage, https://github.com/Kennny7/sysmaint
|
|
6
|
+
Project-URL: Repository, https://github.com/Kennny7/sysmaint
|
|
7
|
+
Project-URL: Documentation, https://github.com/Kennny7/sysmaint/blob/main/USER_GUIDE.md
|
|
8
|
+
Project-URL: Issues, https://github.com/Kennny7/sysmaint/issues
|
|
9
|
+
Author-email: Kennny7 <kennny7@users.noreply.github.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: data-recovery,diagnostics,kennny7-microservices,malware-scanner,microservice,sysmaint,system-maintenance,tui
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
15
|
+
Classifier: Environment :: X11 Applications
|
|
16
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: System :: Recovery Tools
|
|
27
|
+
Classifier: Topic :: System :: Systems Administration
|
|
28
|
+
Classifier: Topic :: Utilities
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: fastapi>=0.111.0
|
|
31
|
+
Requires-Dist: httpx>=0.27.0
|
|
32
|
+
Requires-Dist: psutil>=5.9.0
|
|
33
|
+
Requires-Dist: pydantic>=2.7.0
|
|
34
|
+
Requires-Dist: pyyaml>=6.0
|
|
35
|
+
Requires-Dist: requests>=2.28.0
|
|
36
|
+
Requires-Dist: rich>=13.7.0
|
|
37
|
+
Requires-Dist: textual>=0.60.0
|
|
38
|
+
Requires-Dist: uvicorn[standard]>=0.30.0
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: customtkinter>=5.2.0; extra == 'all'
|
|
41
|
+
Requires-Dist: darkdetect>=0.8.0; extra == 'all'
|
|
42
|
+
Requires-Dist: yara-python>=4.2.0; extra == 'all'
|
|
43
|
+
Provides-Extra: gui
|
|
44
|
+
Requires-Dist: customtkinter>=5.2.0; extra == 'gui'
|
|
45
|
+
Requires-Dist: darkdetect>=0.8.0; extra == 'gui'
|
|
46
|
+
Provides-Extra: yara
|
|
47
|
+
Requires-Dist: yara-python>=4.2.0; extra == 'yara'
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
<div align="center">
|
|
51
|
+
|
|
52
|
+
<img src="assets/sysmaint-icon.png" alt="SysMaint Icon" width="140" />
|
|
53
|
+
|
|
54
|
+
# SysMaint
|
|
55
|
+
|
|
56
|
+
**Cross-Platform System Maintenance, Security & Data Recovery Microservice**
|
|
57
|
+
|
|
58
|
+
*Version 0.1.0 — Sentinel Microservice | Built by Kennny7 Microservices*
|
|
59
|
+
|
|
60
|
+
<br />
|
|
61
|
+
|
|
62
|
+
<a href="USER_GUIDE.md"><img src="https://img.shields.io/badge/Read_the-User_Guide-06b6d4?style=for-the-badge" alt="Read the User Guide" /></a>
|
|
63
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/Release-v0.1.0_Sentinel-0f172a?style=for-the-badge" alt="Release v0.1.0" /></a>
|
|
64
|
+
|
|
65
|
+
<br /><br />
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+

|
|
69
|
+

|
|
70
|
+

|
|
71
|
+

|
|
72
|
+

|
|
73
|
+
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
> [!NOTE]
|
|
79
|
+
> **New to command-line tools?** Open the step-by-step **[User Guide](USER_GUIDE.md)** for plain-English instructions, microservice health checks, and ready-to-paste examples.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Architecture Overview
|
|
84
|
+
|
|
85
|
+
SysMaint v0.1.0 (`Sentinel Microservice`) evolves the original maintenance toolkit into a modular **microservice + terminal client UI** architecture that works both **offline** and **online**.
|
|
86
|
+
|
|
87
|
+
```mermaid
|
|
88
|
+
flowchart LR
|
|
89
|
+
subgraph Clients["Client Interfaces"]
|
|
90
|
+
TUI["Textual + Rich TUI (sysmaint tui)"]
|
|
91
|
+
CLI["Rich CLI (sysmaint ...)"]
|
|
92
|
+
GUI["Desktop GUI (sysmaint gui)"]
|
|
93
|
+
EXT["Scripts / Dashboards (HTTP/JSON)"]
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
subgraph Service["Kennny7 Microservice Layer"]
|
|
97
|
+
API["FastAPI + Uvicorn (sysmaint serve :8765)"]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
subgraph Core["Core Engines (Online & Offline)"]
|
|
101
|
+
DIAG["Diagnostics (Disk, RAM, Drivers, Services)"]
|
|
102
|
+
REP["Repair (DISM, SFC, chkdsk, fsck, Net Reset)"]
|
|
103
|
+
SEC["Security & Malware (YARA, ClamAV, VirusTotal)"]
|
|
104
|
+
REC["Data Recovery (Trash, VSS, Temp, Carving)"]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
TUI --> API
|
|
108
|
+
TUI -. Direct Mode .-> Core
|
|
109
|
+
CLI --> Core
|
|
110
|
+
GUI --> Core
|
|
111
|
+
EXT --> API
|
|
112
|
+
API --> Core
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Execution Workflow
|
|
116
|
+
|
|
117
|
+
```mermaid
|
|
118
|
+
flowchart TD
|
|
119
|
+
Start[Start sysmaint] --> Mode{Selected Mode?}
|
|
120
|
+
Mode -->|tui| LaunchTUI[Launch Textual Terminal Client UI]
|
|
121
|
+
Mode -->|serve| LaunchAPI[Start FastAPI Microservice on :8765]
|
|
122
|
+
Mode -->|diagnose / scan / repair / recovery| PrivCheck{Need Elevation?}
|
|
123
|
+
PrivCheck -->|No| RunMod[Execute Module]
|
|
124
|
+
PrivCheck -->|Yes| Elevate[UAC / sudo Elevation]
|
|
125
|
+
Elevate --> RunMod
|
|
126
|
+
RunMod --> Output[Rich Terminal / JSON / HTML Report]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Key Capabilities
|
|
132
|
+
|
|
133
|
+
| Domain | Windows Tools & Features | Linux Tools & Features | Offline Capable |
|
|
134
|
+
| :--- | :--- | :--- | :--- |
|
|
135
|
+
| **Microservice** | FastAPI REST API + OpenAPI (`/docs`) | FastAPI REST API + OpenAPI (`/docs`) | Yes |
|
|
136
|
+
| **Terminal Client UI** | Textual + Rich 5-tab dashboard | Textual + Rich 5-tab dashboard | Yes |
|
|
137
|
+
| **System Repair** | `DISM /RestoreHealth` (online/WIM), `sfc /scannow`, `chkdsk` | `dpkg --verify`, `rpm -Va`, `pacman -Qk`, `fsck`, `journalctl` | Yes |
|
|
138
|
+
| **Network Repair** | `netsh winsock reset`, `netsh int ip reset`, DNS flush | `NetworkManager` restart, `resolvectl` DNS flush | Yes |
|
|
139
|
+
| **Malware & Security** | Built-in YARA heuristics, ClamAV, VirusTotal, Defender audit | Built-in YARA heuristics, ClamAV, VirusTotal, firewall audit | Yes (YARA/ClamAV) |
|
|
140
|
+
| **Data Recovery** | Recycle Bin restore, `vssadmin` VSS shadows, Office temp drafts, file carving | FreeDesktop Trash restore, Btrfs/Timeshift, temp drafts, file carving | Yes |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Quick Start
|
|
145
|
+
|
|
146
|
+
### Clickable Installers & Package Managers (No Manual PATH Setup)
|
|
147
|
+
|
|
148
|
+
- **Windows**: Run `SysMaint-Setup-v0.1.0.exe` (creates Desktop/Start Menu shortcuts and configures `PATH` automatically) or install via `winget install Kennny7.SysMaint`.
|
|
149
|
+
- **Linux**: Run `./packaging/linux/install.sh` to install `sysmaint`, update `PATH`, and register the clickable **SysMaint** Application Menu launcher (`sysmaint.desktop`).
|
|
150
|
+
|
|
151
|
+
### From Source (with `uv`)
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://github.com/Kennny7/sysmaint.git
|
|
155
|
+
cd sysmaint
|
|
156
|
+
uv sync
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Launch the interactive **Terminal Client UI**:
|
|
160
|
+
```bash
|
|
161
|
+
uv run sysmaint tui
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Start the **Microservice**:
|
|
165
|
+
```bash
|
|
166
|
+
uv run sysmaint serve --host 127.0.0.1 --port 8765
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> [!TIP]
|
|
170
|
+
> You can connect the Terminal Client UI directly to a running microservice instance:
|
|
171
|
+
> `uv run sysmaint tui --server http://127.0.0.1:8765`
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Command Reference & Expandable Guides
|
|
176
|
+
|
|
177
|
+
<details>
|
|
178
|
+
<summary><strong>1. Diagnostics, Integrity & System Repair</strong></summary>
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# 1-Click read-only health overview
|
|
182
|
+
sysmaint smart-scan
|
|
183
|
+
|
|
184
|
+
# Run specific diagnostics
|
|
185
|
+
sysmaint diagnose --disk --memory --drivers
|
|
186
|
+
|
|
187
|
+
# Check Windows DISM/SFC or Linux package integrity (read-only)
|
|
188
|
+
sysmaint scan --integrity
|
|
189
|
+
|
|
190
|
+
# Repair system files (preview first with --dry-run)
|
|
191
|
+
sysmaint repair --files --dry-run
|
|
192
|
+
sysmaint repair --files
|
|
193
|
+
|
|
194
|
+
# Offline DISM repair using a local WIM/ESD image
|
|
195
|
+
sysmaint repair --files --offline-source D:\sources\install.wim
|
|
196
|
+
|
|
197
|
+
# Reset corrupted network stack (Winsock/TCP-IP or NetworkManager)
|
|
198
|
+
sysmaint network reset --dry-run
|
|
199
|
+
sysmaint network reset
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
</details>
|
|
203
|
+
|
|
204
|
+
<details>
|
|
205
|
+
<summary><strong>2. Malware Scanning & Security Audit</strong></summary>
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Audit firewall, antivirus, and privilege posture
|
|
209
|
+
sysmaint security
|
|
210
|
+
|
|
211
|
+
# Offline malware scan using built-in YARA rules and ClamAV
|
|
212
|
+
sysmaint scan --yara --clamav --offline
|
|
213
|
+
|
|
214
|
+
# Scan a specific folder
|
|
215
|
+
sysmaint scan --yara --target "C:\Users\Admin\Downloads"
|
|
216
|
+
|
|
217
|
+
# Update ClamAV signatures (online)
|
|
218
|
+
sysmaint update-db
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
</details>
|
|
222
|
+
|
|
223
|
+
<details>
|
|
224
|
+
<summary><strong>3. Data Recovery (Trash, Shadow Copies, Temp Drafts, File Carving)</strong></summary>
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# List deleted items in Recycle Bin (Windows) or Trash (Linux)
|
|
228
|
+
sysmaint recovery trash
|
|
229
|
+
|
|
230
|
+
# Restore a deleted item to a safe destination
|
|
231
|
+
sysmaint recovery restore --name "invoice.pdf" --dest "./recovered"
|
|
232
|
+
|
|
233
|
+
# List Volume Shadow Copies (Windows) or Btrfs/Timeshift snapshots (Linux)
|
|
234
|
+
sysmaint recovery shadows
|
|
235
|
+
|
|
236
|
+
# Scan for unsaved Office / LibreOffice / temp drafts
|
|
237
|
+
sysmaint recovery temp
|
|
238
|
+
|
|
239
|
+
# Carve lost files (pdf, png, jpg, zip, sqlite) from a raw disk image
|
|
240
|
+
sysmaint recovery carve --source "./disk.img" --dest "./carved_out" --types pdf png jpg
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
</details>
|
|
244
|
+
|
|
245
|
+
<details>
|
|
246
|
+
<summary><strong>4. Project Structure</strong></summary>
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
sysmaint/
|
|
250
|
+
├── assets/
|
|
251
|
+
│ └── sysmaint-icon.png
|
|
252
|
+
├── src/sysmaint/
|
|
253
|
+
│ ├── __init__.py # Version (0.1.0), Codename, Kennny7 Microservices brand
|
|
254
|
+
│ ├── __main__.py
|
|
255
|
+
│ ├── cli.py # Unified CLI entrypoint
|
|
256
|
+
│ ├── config.py # YAML/JSON configuration dataclasses
|
|
257
|
+
│ ├── logging_setup.py
|
|
258
|
+
│ ├── modules/
|
|
259
|
+
│ │ ├── backup.py # Restore points & snapshots
|
|
260
|
+
│ │ ├── cleaner.py # Temp, browser, package & log cleanup
|
|
261
|
+
│ │ ├── disk.py # Partition usage, SMART, chkdsk/fsck
|
|
262
|
+
│ │ ├── drivers.py
|
|
263
|
+
│ │ ├── integrity.py # DISM/SFC (online & offline WIM) & Linux pkg verify
|
|
264
|
+
│ │ ├── malware.py # YARA, ClamAV, VirusTotal
|
|
265
|
+
│ │ ├── memory.py
|
|
266
|
+
│ │ ├── network.py # Ping, DNS flush, ports, network stack reset
|
|
267
|
+
│ │ ├── optimizer.py # 1-Click smart scan & auto-fix
|
|
268
|
+
│ │ ├── recovery.py # Trash/Recycle Bin, VSS, temp drafts, file carving
|
|
269
|
+
│ │ ├── report.py # JSON, Rich & HTML reporting
|
|
270
|
+
│ │ ├── restore.py
|
|
271
|
+
│ │ ├── scheduler.py
|
|
272
|
+
│ │ ├── security.py
|
|
273
|
+
│ │ ├── services.py
|
|
274
|
+
│ │ ├── startup.py
|
|
275
|
+
│ │ └── sysinfo.py
|
|
276
|
+
│ ├── service/
|
|
277
|
+
│ │ └── server.py # FastAPI + Uvicorn microservice
|
|
278
|
+
│ ├── tui/
|
|
279
|
+
│ │ └── app.py # Textual + Rich Terminal Client UI
|
|
280
|
+
│ ├── gui/ # Optional CustomTkinter Desktop GUI
|
|
281
|
+
│ └── utils/
|
|
282
|
+
├── tests/
|
|
283
|
+
├── pyproject.toml # uv & hatchling configuration
|
|
284
|
+
├── USER_GUIDE.md # Non-technical & CLI user guide
|
|
285
|
+
└── CHANGELOG.md
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
</details>
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Testing & Quality Checks
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
uv run pytest -v
|
|
296
|
+
uv run ruff check src tests
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
<div align="center">
|
|
302
|
+
|
|
303
|
+
**SysMaint v0.1.0 (Sentinel Microservice)** — **Kennny7 Microservices**
|
|
304
|
+
|
|
305
|
+
[User Guide](USER_GUIDE.md) | [Changelog](CHANGELOG.md) | [Issues](https://github.com/Kennny7/sysmaint/issues)
|
|
306
|
+
|
|
307
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
sysmaint/__init__.py,sha256=2hbCQF6ifsFLzRTQB0y7AhAvVx77FLvSc3EJKf_YTsM,400
|
|
2
|
+
sysmaint/__main__.py,sha256=ep0SdQ24TVWPDw9D1V62B0y4JRwohYavv08mNEzoTkg,110
|
|
3
|
+
sysmaint/cli.py,sha256=HYD8nJRMdLXh8-wMzWy5vsttf9aHJHc28SkKjx_WxpU,25067
|
|
4
|
+
sysmaint/config.py,sha256=fyrDZniLUNdBhXQyuokFI5H8Hm7HeQ9TKiRASOQ59bg,8036
|
|
5
|
+
sysmaint/logging_setup.py,sha256=CKv8wbfxGYpOe1zcNIfdluijCQXIpfCpaxegyEET6FE,1978
|
|
6
|
+
sysmaint/gui/__init__.py,sha256=p7fz2s65U5Ga3HTcMAZPbWthTgP06THfmXKJu1WO_bY,115
|
|
7
|
+
sysmaint/gui/app.py,sha256=hS_eR29nfZ5so77LAmlfAIDGx5eS_t5Bd3-qnfVJR84,7733
|
|
8
|
+
sysmaint/gui/theme.py,sha256=9xYRrCJfcJxGUl_R4PIBdpas1VnPGX_4_1WHvNrhDZc,1570
|
|
9
|
+
sysmaint/gui/components/__init__.py,sha256=vLfQlTWaleDYq8oOwFfDvVybAK_dF537z-xLFIlRVL0,325
|
|
10
|
+
sysmaint/gui/components/cards.py,sha256=W-kvzuwrCi6ontjKVZb4aw5_8apFTdmqmVFqB8XNPL4,7354
|
|
11
|
+
sysmaint/gui/components/console.py,sha256=3Mn7impW1h8oecqqsfFx8MsW7qoq0KdlcLgQsHvOpEs,2061
|
|
12
|
+
sysmaint/gui/components/dialogs.py,sha256=Q42RHVC6ZvApwBFV60A3DE-HMxSLusl8WfJPUQVOfcY,2007
|
|
13
|
+
sysmaint/gui/views/__init__.py,sha256=-cGL2e25Xv1iRX78labYkq2CTJyTbhS-7m0VIcPiFyE,621
|
|
14
|
+
sysmaint/gui/views/backup.py,sha256=uuaIZHlJHYWKir7Zr9QBmRmF81yT3qdsv-1u7hdSUiI,6661
|
|
15
|
+
sysmaint/gui/views/cleaner.py,sha256=y1oJ0Tt6NWcG9Rms-g8ueKaJ40mQjdTqazGFwU7sfpE,9104
|
|
16
|
+
sysmaint/gui/views/dashboard.py,sha256=135MDmrgAeP2HQIF3b2xZe06DN53TBKfa_XZ2sAUMHI,11018
|
|
17
|
+
sysmaint/gui/views/diagnostics.py,sha256=tqno17ZR7Q7gHhTHS86X8Ygatzv5IOtTCJPvyUa1mYQ,11603
|
|
18
|
+
sysmaint/gui/views/integrity.py,sha256=3mSBgH6O_r9AXHzSm3C97ZNXnKMFcTvPWnsRFLBYNX4,6276
|
|
19
|
+
sysmaint/gui/views/malware.py,sha256=xAsENquFGCdLQjnvtTqeDqPMcNdIshRuq_KFO9MahwU,11935
|
|
20
|
+
sysmaint/gui/views/network.py,sha256=0B5sk8EZZiFZHU09cMcpZrnAzK7NagzwaijDOA51gLQ,6950
|
|
21
|
+
sysmaint/gui/views/security.py,sha256=dlkQyUBmhJYVwaOJ6YoSaSLj4hlRsLSVMYTPepMXi1A,4884
|
|
22
|
+
sysmaint/gui/views/settings.py,sha256=bvDuabYFLK8yL1svcH8nd-n5PReg1mV0ljS-KXxBj9c,8573
|
|
23
|
+
sysmaint/gui/views/startup.py,sha256=46qIKI1UVyA8RIQYb06XQt-StwfsxRdAD5GfqK2a2qE,5293
|
|
24
|
+
sysmaint/modules/__init__.py,sha256=9Qb8gPLEj1jd2irRnbqqY95Obf1BNiwJa3-6OBXaV5A,586
|
|
25
|
+
sysmaint/modules/backup.py,sha256=mSCRuNkNVlnc96f2nzQK_-FSgAzmJRbZR7C3CUpfLho,3798
|
|
26
|
+
sysmaint/modules/cleaner.py,sha256=qMCylZPaCzpfOSOYbKLTjXlhsAKQWSovEtcly8Tc4bk,8285
|
|
27
|
+
sysmaint/modules/disk.py,sha256=zt6cHI5Z9mumfv7CyD-zgFypMDpLwoRtm1L3CIBwq50,5535
|
|
28
|
+
sysmaint/modules/drivers.py,sha256=IxAl4X5GN9Dwxvuk4qreTal6-TvluLTEr2s6uGdvKi0,2979
|
|
29
|
+
sysmaint/modules/integrity.py,sha256=plAmCi-jHS__JBqHNMkXLozbS7oXxrpqHEcQAQkalro,5406
|
|
30
|
+
sysmaint/modules/malware.py,sha256=_iRUmB3dD6ZuPuzefpDgiYt4fQc7nK64MsfF9edPdKg,14646
|
|
31
|
+
sysmaint/modules/memory.py,sha256=xFWjIVfLlQOlGMcbhs0gFXg4sJW6acv8oFdXuJIC4kA,3734
|
|
32
|
+
sysmaint/modules/network.py,sha256=0zNmSCLNG2ZUMsyz-txvhfd-Wo7QY-EeESP0LERmGrs,6007
|
|
33
|
+
sysmaint/modules/optimizer.py,sha256=gHM-TSoQRS49Qpd0zLLlcgj-ojLsGUzofSIGCNFQvU4,6463
|
|
34
|
+
sysmaint/modules/recovery.py,sha256=Lz-aa-n3m4Adn9Ym_Tr7CKjRqBj2ejHFX8QNMM03H_s,12630
|
|
35
|
+
sysmaint/modules/report.py,sha256=9yJeU0QMmkZaqfg3hAmOs88X-AUIIYCtv9x4_6_U9Lw,10520
|
|
36
|
+
sysmaint/modules/restore.py,sha256=jzdSRbNr4AVBG1HZ1MlDYcknMZjfvSXP8_MpaWoJraw,4184
|
|
37
|
+
sysmaint/modules/scheduler.py,sha256=0264rx-iZ7LFymFv-u9IAK6XeAQndH7tpQPriNCCTwI,4635
|
|
38
|
+
sysmaint/modules/security.py,sha256=aZ5gQY-ZKfQoRiqUKXi5XNRtQB8VCBAR2qsOapCXgEw,2938
|
|
39
|
+
sysmaint/modules/services.py,sha256=zh85GiDpbeEr1PM7gDRttefl6felrYyRPHJx10AVUDI,6184
|
|
40
|
+
sysmaint/modules/startup.py,sha256=qTnjz7revmOyOC95E1d5IhaERpl_AXGwSuuj8_vTrC0,3468
|
|
41
|
+
sysmaint/modules/sysinfo.py,sha256=TMI2YxVvUksbC33-TZsZjimc28ajdQ8tZxwo4ClNl9c,3682
|
|
42
|
+
sysmaint/service/__init__.py,sha256=GC3KN-unHa7k0T-Jp1-cfCa0193OyZ9p_7P8ba9_pOg,121
|
|
43
|
+
sysmaint/service/server.py,sha256=coV8B9wc0DwYqqS5A7t3vTZbXEcdQ4rUrq8wDxBu4Zc,6290
|
|
44
|
+
sysmaint/tui/__init__.py,sha256=YISdTDDnGRd0Q_mEMgTR2vyY1LggwsIns895Oj6b1P4,124
|
|
45
|
+
sysmaint/tui/app.py,sha256=I3JiYpdPsJcWhXcmWWVkGzE1UTVuMYaPlHNzWtAkWjA,31467
|
|
46
|
+
sysmaint/tui/modals.py,sha256=__QkgYkzjQURqBARDTg1xNlrI_j7_6tLYEm0To8746s,6103
|
|
47
|
+
sysmaint/tui/themes.py,sha256=zeZJDGRWBwhfLV6iPGXkz0-hD_CtB1VJtVHYVPyhjf8,2053
|
|
48
|
+
sysmaint/utils/__init__.py,sha256=eh3MlQSHjXJMWAvNuv6MrysM0ko-M6j1G90gOWk3b4c,904
|
|
49
|
+
sysmaint/utils/common.py,sha256=APF3EFyceN2dz-wJGMeTIBJdIj5ebyCGARFqtfynUDE,7978
|
|
50
|
+
sysmaint/utils/escalate.py,sha256=_NCH2SqDwkclRi-PSgQTrJtAX9jRQmP8lkVi7Z6NiNw,2772
|
|
51
|
+
sysmaint/utils/linux.py,sha256=MXMUgybk_tsRrwBGX5gL83IsaEABDazrdSXj5rzq_Jg,7908
|
|
52
|
+
sysmaint/utils/parsers.py,sha256=_XK7NhXwhoKr6I26U1ytTCd2YpAFFGx7mjPsiBN3AEg,5551
|
|
53
|
+
sysmaint/utils/windows.py,sha256=q5QnFdhyPLLwxicJFR7btNKDj3YpJ9vVQpjEapUvbCA,10782
|
|
54
|
+
sysmaint-0.1.0.dist-info/METADATA,sha256=5jDPCmOMng9XCpix5VCVjBrNd-_vP7aHUBaZDwzsCLI,10807
|
|
55
|
+
sysmaint-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
56
|
+
sysmaint-0.1.0.dist-info/entry_points.txt,sha256=-el1_OWVlxbBSZrHxaUVuygXT9K2kOjnMPjCsmDYBlM,185
|
|
57
|
+
sysmaint-0.1.0.dist-info/RECORD,,
|