meshctrl
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: meshctrl | ||
| Version: 0.1.13 | ||
| Version: 0.1.14 | ||
| 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.13", | ||
| version="0.1.14", | ||
| 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.13 | ||
| Version: 0.1.14 | ||
| Summary: Python port of MeshCentral's Meshctrl.js program | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/amidaware/meshctrl-py |
| import time | ||
| import uuid | ||
| import base64 | ||
| from base64 import b64encode | ||
@@ -10,3 +11,5 @@ import random | ||
| from Crypto.Cipher import AES | ||
| from Crypto.Hash import SHA3_384 | ||
| from Crypto.Random import get_random_bytes | ||
| from Crypto.Util.Padding import pad | ||
@@ -33,2 +36,26 @@ | ||
| def get_login_token(self, key, user, action=3): | ||
| try: | ||
| key = bytes.fromhex(key) | ||
| key1 = key[0:48] | ||
| key2 = key[48:] | ||
| msg = '{{"a":{}, "u":"{}","time":{}}}'.format( | ||
| action, user.lower(), int(time.time()) | ||
| ) | ||
| iv = get_random_bytes(16) | ||
| # sha | ||
| h = SHA3_384.new() | ||
| h.update(key1) | ||
| hashed_msg = h.digest() + msg.encode() | ||
| # aes | ||
| cipher = AES.new(key2, AES.MODE_CBC, iv) | ||
| msg = cipher.encrypt(pad(hashed_msg, 16)) | ||
| return base64.b64encode(iv + msg, altchars=b"@$").decode("utf-8") | ||
| except Exception: | ||
| return "err" | ||
| def b64_to_hex(hex: str) -> str: | ||
@@ -35,0 +62,0 @@ return b64encode(bytes.fromhex(hex)).decode().replace(r"/", "$").replace(r"+", "@") |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
54022
1.35%1295
1.73%