This commit is contained in:
EggMan 2024-05-06 09:45:03 -04:00
parent 203dde10ae
commit 6ee877b437
2 changed files with 26 additions and 10 deletions

View File

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.12 (CNSA-276-FP)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (CNSA-276-FP)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (CNSA-276-FP) (2)" project-jdk-type="Python SDK" />
</project>

34
main.py
View File

@ -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):