From e65f6024d3ed10a52c7a667dc419db6c5ed3ed06 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Fri, 4 Oct 2024 16:38:57 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=87=E3=83=90=E3=82=A4=E3=82=B9=E3=83=AA?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=8C=E7=A9=BA=E3=81=AE=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dislocker_auth.py | 49 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/dislocker_auth.py b/dislocker_auth.py index 0c08fcd..0f1472e 100644 --- a/dislocker_auth.py +++ b/dislocker_auth.py @@ -66,34 +66,41 @@ class Auth(): pc_uuid = str(kwargs["pc_uuid"]) pc_token = str(kwargs["pc_token"]) if "device_list" in kwargs: - device_list = kwargs["device_list"] + if kwargs["device_list"] == []: + device_list = None + else: + device_list = kwargs["device_list"] else: - pass - keyboard_number = "own" - mouse_number = "own" + device_list = None + + keyboard_number = 0 + mouse_number = 0 if "password_hash" in kwargs: password_hash = str(kwargs["password_hash"]) cursor.execute("SELECT * FROM pc_list WHERE pc_number = %s AND password_hash = %s AND pc_uuid = %s AND pc_token = %s", (pc_number, password_hash, pc_uuid, pc_token)) pc_info = cursor.fetchall() if pc_info: - for device in device_list: - cursor.execute("SELECT * FROM keyboard_list WHERE device_instance_path = %s", (device["device_instance_path"],)) - keyboard_record = cursor.fetchall() - if keyboard_record: - keyboard_number = int(keyboard_record[0][0]) - break - else: - pass - - for device in device_list: - cursor.execute("SELECT * FROM mouse_list WHERE device_instance_path = %s", (device["device_instance_path"],)) - mouse_record = cursor.fetchall() - if mouse_record: - mouse_number = int(mouse_record[0][0]) - break - else: - pass + if device_list == None: + pass + else: + for device in device_list: + cursor.execute("SELECT * FROM keyboard_list WHERE device_instance_path = %s", (device["device_instance_path"],)) + keyboard_record = cursor.fetchall() + if keyboard_record: + keyboard_number = int(keyboard_record[0][0]) + break + else: + pass + + for device in device_list: + cursor.execute("SELECT * FROM mouse_list WHERE device_instance_path = %s", (device["device_instance_path"],)) + mouse_record = cursor.fetchall() + if mouse_record: + mouse_number = int(mouse_record[0][0]) + break + else: + pass return {"result": 0, "about": "ok", "output_dict": {"keyboard_number": keyboard_number, "mouse_number": mouse_number}} else: