meshctrl
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: meshctrl | ||
| Version: 0.1.8 | ||
| Version: 0.1.9 | ||
| Summary: Python port of MeshCentral's Meshctrl.js program | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/amidaware/meshctrl-py |
+1
-1
@@ -8,3 +8,3 @@ import setuptools | ||
| name='meshctrl', | ||
| version='0.1.8', | ||
| version='0.1.9', | ||
| description='Python port of MeshCentral\'s Meshctrl.js program', | ||
@@ -11,0 +11,0 @@ long_description=long_description, |
| Metadata-Version: 2.1 | ||
| Name: meshctrl | ||
| Version: 0.1.8 | ||
| Version: 0.1.9 | ||
| Summary: Python port of MeshCentral's Meshctrl.js program | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/amidaware/meshctrl-py |
+10
-11
| import json | ||
| import uuid | ||
| import websockets | ||
@@ -17,19 +16,17 @@ import asyncio | ||
| token = utils.get_auth_token(self.user, self.token) | ||
| uri = f"{self.uri}/control.ashx?auth={token}" | ||
| async with websockets.connect(uri) as websocket: | ||
| response_id = str(uuid.uuid4()) | ||
| data["responseid"] = response_id | ||
| await websocket.send(json.dumps(data)) | ||
| await websocket.send( | ||
| json.dumps(data) | ||
| ) | ||
| async for message in websocket: | ||
| response = json.loads(message) | ||
| #print(response) | ||
| if response["responseId"] == response_id: | ||
| return response | ||
| if "responseid" in data: | ||
| if data["responseid"] == response["responseid"]: | ||
| return response | ||
| else: | ||
| if data["action"] == response["action"]: | ||
| return response | ||
@@ -54,2 +51,3 @@ def _send(self, data): | ||
| "meshtype": 2, | ||
| "responseid": utils.gen_response_id() | ||
| } | ||
@@ -67,4 +65,5 @@ | ||
| "type": 1, | ||
| "responseid": utils.gen_response_id() | ||
| } | ||
| return self._send(data) |
| import time | ||
| import uuid | ||
| from base64 import b64encode | ||
@@ -8,3 +9,3 @@ | ||
| def get_auth_token(user, key): | ||
| def get_auth_token(user: str, key: str) -> str: | ||
| key = bytes.fromhex(key) | ||
@@ -22,5 +23,8 @@ key1 = key[0:32] | ||
| def b64_to_hex(hex): | ||
| def b64_to_hex(hex: str) -> str: | ||
| return ( | ||
| b64encode(bytes.fromhex(hex)).decode().replace(r"/", "$").replace(r"+", "@") | ||
| ) | ||
| ) | ||
| def gen_response_id() -> str: | ||
| return str(uuid.uuid4()) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
6634
4.21%94
6.82%