Compare commits
5 Commits
d6415712d9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c5e003f08 | ||
| 97ea4abac8 | |||
| edfd2cf043 | |||
|
07b9ba6fdf
|
|||
|
14e69fc406
|
19
CHANGELOG.md
19
CHANGELOG.md
@@ -2,6 +2,25 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.5.0] - 2026-03-08
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- [`d641571`](https://gitea.pufereq.pl/judas/judas_client/commit/d6415712d97c27a1716a836e0cde440b486d9132) **connector.py**: send initial telemetry after HELLO
|
||||||
|
- [`9360fe9`](https://gitea.pufereq.pl/judas/judas_client/commit/9360fe9f3c600cd7c610e8fd6e2d80f91a8c341f) **connector.py**: add `self.client` property
|
||||||
|
- [`5235cef`](https://gitea.pufereq.pl/judas/judas_client/commit/5235cef103a4b12f84fbc9def6bb68660041d8e1) **client.py**: add initial telemetry gathering
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- [`07b9ba6`](https://gitea.pufereq.pl/judas/judas_client/commit/07b9ba6fdf7194a06520357327048a33b309ed5b) **client.py**: improve CPU model retrivement on Windows
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
- [`14e69fc`](https://gitea.pufereq.pl/judas/judas_client/commit/14e69fc40606961d3e3cabbda9119211c81fc972) **uv.lock**: update judas_protocol to 0.9.1
|
||||||
|
- [`869763d`](https://gitea.pufereq.pl/judas/judas_client/commit/869763dde35d18522d4e84bb9436b1d5064364e8) **uv.lock**: add depedency on psutil
|
||||||
|
- [`dd5fccf`](https://gitea.pufereq.pl/judas/judas_client/commit/dd5fccf8ff7ab214cec277ce6f8ccbc39acc85bb) **pyproject.toml**: add depedency on psutil
|
||||||
|
- [`a4a9051`](https://gitea.pufereq.pl/judas/judas_client/commit/a4a9051130a304b6e2d6ed038c62f812dde2c6a4) **uv.lock**: update judas_protocol to 0.9.0
|
||||||
|
|
||||||
## [0.4.4] - 2026-03-05
|
## [0.4.4] - 2026-03-05
|
||||||
|
|
||||||
### Refactor
|
### Refactor
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "judas_client"
|
name = "judas_client"
|
||||||
version = "0.4.4"
|
version = "0.5.0"
|
||||||
description = "A client for judas, a remote PC fleet management system."
|
description = "A client for judas, a remote PC fleet management system."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = []
|
authors = []
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from __future__ import annotations
|
|||||||
import logging as lg
|
import logging as lg
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -53,7 +52,6 @@ class Client:
|
|||||||
on_message=self.handle_message,
|
on_message=self.handle_message,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.logger.debug("Gathering initial telemetry data...")
|
|
||||||
self.initial_telemetry: dict[str, Any] = (
|
self.initial_telemetry: dict[str, Any] = (
|
||||||
self._gather_initial_telemetry()
|
self._gather_initial_telemetry()
|
||||||
)
|
)
|
||||||
@@ -73,22 +71,50 @@ class Client:
|
|||||||
return mac_address
|
return mac_address
|
||||||
|
|
||||||
def _get_cpu_model(self) -> str:
|
def _get_cpu_model(self) -> str:
|
||||||
|
"""Get the CPU model name.
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
Returns:
|
||||||
return platform.processor()
|
str: The CPU model name, or "Unknown" if it cannot be determined.
|
||||||
elif platform.system() == "Darwin":
|
"""
|
||||||
os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin"
|
|
||||||
command = "sysctl -n machdep.cpu.brand_string"
|
system = platform.system()
|
||||||
return str(subprocess.check_output(command).strip())
|
|
||||||
elif platform.system() == "Linux":
|
if system == "Windows":
|
||||||
command = "cat /proc/cpuinfo"
|
try:
|
||||||
all_info = (
|
import winreg
|
||||||
subprocess.check_output(command, shell=True).decode().strip()
|
|
||||||
)
|
key = winreg.OpenKey(
|
||||||
for line in all_info.split("\n"):
|
winreg.HKEY_LOCAL_MACHINE,
|
||||||
if "model name" in line:
|
r"HARDWARE\DESCRIPTION\System\CentralProcessor\0",
|
||||||
return re.sub(".*model name.*:", "", line, 1).strip()
|
)
|
||||||
return "Unknown"
|
model, _ = winreg.QueryValueEx(key, "ProcessorNameString")
|
||||||
|
winreg.CloseKey(key)
|
||||||
|
return model.strip()
|
||||||
|
except Exception:
|
||||||
|
return platform.processor()
|
||||||
|
|
||||||
|
elif system == "Linux":
|
||||||
|
try:
|
||||||
|
with open("/proc/cpuinfo", "r") as f:
|
||||||
|
for line in f:
|
||||||
|
if "model name" in line:
|
||||||
|
return line.split(":")[1].strip()
|
||||||
|
except Exception:
|
||||||
|
return platform.processor()
|
||||||
|
|
||||||
|
elif system == "Darwin":
|
||||||
|
try:
|
||||||
|
return (
|
||||||
|
subprocess.check_output(
|
||||||
|
["sysctl", "-n", "machdep.cpu.brand_string"]
|
||||||
|
)
|
||||||
|
.decode()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
return platform.processor()
|
||||||
|
|
||||||
|
return platform.processor()
|
||||||
|
|
||||||
def _gather_initial_telemetry(self) -> dict[str, Any]:
|
def _gather_initial_telemetry(self) -> dict[str, Any]:
|
||||||
"""Gather initial telemetry data."""
|
"""Gather initial telemetry data."""
|
||||||
@@ -110,10 +136,10 @@ class Client:
|
|||||||
"model": self._get_cpu_model(),
|
"model": self._get_cpu_model(),
|
||||||
"physical_cores": psutil.cpu_count(logical=False),
|
"physical_cores": psutil.cpu_count(logical=False),
|
||||||
"threads": psutil.cpu_count(logical=True),
|
"threads": psutil.cpu_count(logical=True),
|
||||||
"max_frequency_mhz": cpu_frequency.max
|
"max_frequency_mhz": round(cpu_frequency.max, 2)
|
||||||
if cpu_frequency
|
if cpu_frequency
|
||||||
else "Unknown",
|
else "Unknown",
|
||||||
"min_frequency_mhz": cpu_frequency.min
|
"min_frequency_mhz": round(cpu_frequency.min, 2)
|
||||||
if cpu_frequency
|
if cpu_frequency
|
||||||
else "Unknown",
|
else "Unknown",
|
||||||
}
|
}
|
||||||
|
|||||||
6
uv.lock
generated
6
uv.lock
generated
@@ -275,7 +275,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "judas-client"
|
name = "judas-client"
|
||||||
version = "0.4.4"
|
version = "0.5.0"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "judas-protocol" },
|
{ name = "judas-protocol" },
|
||||||
@@ -322,8 +322,8 @@ test = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "judas-protocol"
|
name = "judas-protocol"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#3d5a1e95daa4cd99b51abdcaca9967fa8f921ec1" }
|
source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#085c34f232f95313d66db48a7d17bc25c92a35ae" }
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "markdown-it-py"
|
name = "markdown-it-py"
|
||||||
|
|||||||
Reference in New Issue
Block a user