5 Commits

4 changed files with 68 additions and 23 deletions

View File

@@ -2,6 +2,25 @@
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
### Refactor

View File

@@ -4,7 +4,7 @@ build-backend = "uv_build"
[project]
name = "judas_client"
version = "0.4.4"
version = "0.5.0"
description = "A client for judas, a remote PC fleet management system."
readme = "README.md"
authors = []

View File

@@ -6,7 +6,6 @@ from __future__ import annotations
import logging as lg
import os
import platform
import re
import subprocess
import uuid
from typing import Any
@@ -53,7 +52,6 @@ class Client:
on_message=self.handle_message,
)
self.logger.debug("Gathering initial telemetry data...")
self.initial_telemetry: dict[str, Any] = (
self._gather_initial_telemetry()
)
@@ -73,22 +71,50 @@ class Client:
return mac_address
def _get_cpu_model(self) -> str:
"""Get the CPU model name.
if platform.system() == "Windows":
return platform.processor()
elif platform.system() == "Darwin":
os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin"
command = "sysctl -n machdep.cpu.brand_string"
return str(subprocess.check_output(command).strip())
elif platform.system() == "Linux":
command = "cat /proc/cpuinfo"
all_info = (
subprocess.check_output(command, shell=True).decode().strip()
Returns:
str: The CPU model name, or "Unknown" if it cannot be determined.
"""
system = platform.system()
if system == "Windows":
try:
import winreg
key = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
r"HARDWARE\DESCRIPTION\System\CentralProcessor\0",
)
for line in all_info.split("\n"):
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 re.sub(".*model name.*:", "", line, 1).strip()
return "Unknown"
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]:
"""Gather initial telemetry data."""
@@ -110,10 +136,10 @@ class Client:
"model": self._get_cpu_model(),
"physical_cores": psutil.cpu_count(logical=False),
"threads": psutil.cpu_count(logical=True),
"max_frequency_mhz": cpu_frequency.max
"max_frequency_mhz": round(cpu_frequency.max, 2)
if cpu_frequency
else "Unknown",
"min_frequency_mhz": cpu_frequency.min
"min_frequency_mhz": round(cpu_frequency.min, 2)
if cpu_frequency
else "Unknown",
}

6
uv.lock generated
View File

@@ -275,7 +275,7 @@ wheels = [
[[package]]
name = "judas-client"
version = "0.4.4"
version = "0.5.0"
source = { editable = "." }
dependencies = [
{ name = "judas-protocol" },
@@ -322,8 +322,8 @@ test = [
[[package]]
name = "judas-protocol"
version = "0.9.0"
source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#3d5a1e95daa4cd99b51abdcaca9967fa8f921ec1" }
version = "0.9.1"
source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#085c34f232f95313d66db48a7d17bc25c92a35ae" }
[[package]]
name = "markdown-it-py"