ScreenLock from WebAPI and CLI
-
Hey guys, a few days ago I started testing Veyon and its features. I was mainly interested in testing the web API and the veyon-cli, and I've been trying them out.
My goal was to be able to lock a computer screen in the lab from the admin. However, I can't get it to work. The CLI command 'veyon-cli feature start ScreenLock <host address>' tells me that the feature name or UID is incorrect (I also tried the UID from the 'veyon-cli feature show' command). So I decided to try the web API. The problem I have with the API is that the documentation apparently doesn't mention how to specify the host to lock the screen on.Estaba probando la api con el siguiente codigo de python (es solo de prueba):
from flask import Flask, request, jsonify import requests app = Flask(__name__) VEYON_API_URL = "http://localhost:11080/api/v1" ConnectionUID = "" # Autenticación @app.route("/authentication", methods=["GET"]) def authentication(): global ConnectionUID data = { "method": "0c69b301-81b4-42d6-8fae-128cdd113314", "credentials": { "keyname": "admin_key", "keydata": read_private_key() } } response = requests.post(f"{VEYON_API_URL}/authentication/localhost", json=data) ConnectionUID = response.json()["connection-uid"] # print(ConnectionUID) return jsonify(response.json()), response.status_code # Iniciar una función (Ejemplo: ScreenLock) @app.route("/get_features", methods=["GET"]) def get_features(): global ConnectionUID headers = { "Connection-Uid": ConnectionUID } response = requests.get(f"{VEYON_API_URL}/feature", headers=headers) return jsonify(response.json()), response.status_code # Iniciar una función (Ejemplo: ScreenLock) @app.route("/screen_lock", methods=["POST"]) def screen_lock(): global ConnectionUID headers = { "Connection-Uid": ConnectionUID } data = request.json response = requests.put(f"{VEYON_API_URL}/feature/ccb535a2-1d24-4cc1-a709-8b47d2b2ac79", headers=headers, json=data) return jsonify(response.json()), response.status_code # Lectura de la private key def read_private_key(): with open("admin_key_private_key.pem", "r") as file: return file.read() if __name__ == "__main__": app.run(debug=True, port=3000)
Docs:
I'm using veyon 4.9.4 and I'd like to know what I'm doing wrong or if I'm misunderstood that these functions can be performed from the admin. Thank you for your help in advance.