diff --git a/.idea/misc.xml b/.idea/misc.xml index 92298c3..0cddb8e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/main.py b/main.py index a423769..e34e216 100644 --- a/main.py +++ b/main.py @@ -44,18 +44,25 @@ import sys import ctypes from fido2.ctap2 import Ctap2 +DOOR_ID = 0 + gotAaguid = None GPIO.setmode(GPIO.BCM) greenLed = 14 redLed = 4 +door = 21 + # badCredentials = False GPIO.setup(greenLed, GPIO.OUT) GPIO.output(greenLed, GPIO.LOW) GPIO.setup(redLed, GPIO.OUT) GPIO.output(redLed, GPIO.LOW) + +GPIO.setup(door, GPIO.OUT) +GPIO.output(door, GPIO.LOW) def badCred(): print("Bad credential!") # badCredentials = True @@ -72,6 +79,8 @@ class CliInteraction(UserInteraction): return True while True: + + GPIO.output(door, GPIO.LOW) # GPIO.output(14, GPIO.LOW) print("Waiting for device...") badCredentials = False @@ -110,7 +119,7 @@ while True: # Define the SQL query for retrieving data select_query = ''' - SELECT "AAGUID", credential_id, pk_algo, pk_1, pk_3, pk_neg1, pk_neg2, pk_neg3, pickled + SELECT "AAGUID", user_id, credential_id, pk_algo, pk_1, pk_3, pk_neg1, pk_neg2, pk_neg3, pickled FROM credential_data WHERE "AAGUID" = %s; ''' @@ -133,14 +142,15 @@ while True: if result: data = { "AAGUID": result[0], - "credential_id": result[1], - "pk_algo": result[2], - "pk_1": result[3], - "pk_3": result[4], - "pk_neg1": result[5], - "pk_neg2": result[6], - "pk_neg3": result[7], - "pickled": result[8] + "user_id": result[1], + "credential_id": result[2], + "pk_algo": result[3], + "pk_1": result[4], + "pk_3": result[5], + "pk_neg1": result[6], + "pk_neg2": result[7], + "pk_neg3": result[8], + "pickled": result[9] } return data else: @@ -209,11 +219,17 @@ while True: GPIO.output(greenLed, GPIO.LOW) time.sleep(0.05) + GPIO.output(greenLed, GPIO.HIGH) + GPIO.output(door, GPIO.HIGH) + time.sleep(5) + GPIO.output(greenLed, GPIO.LOW) + print("CLIENT DATA:", result.client_data) print() print("AUTH DATA:", result.authenticator_data) # GPIO.output(14, GPIO.LOW) time.sleep(1) + except Exception as e: print("Authentication Failed!") for i in range(5):