changes
This commit is contained in:
parent
203dde10ae
commit
6ee877b437
@ -3,5 +3,5 @@
|
|||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Python 3.12 (CNSA-276-FP)" />
|
<option name="sdkName" value="Python 3.12 (CNSA-276-FP)" />
|
||||||
</component>
|
</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>
|
</project>
|
34
main.py
34
main.py
@ -44,18 +44,25 @@ import sys
|
|||||||
import ctypes
|
import ctypes
|
||||||
from fido2.ctap2 import Ctap2
|
from fido2.ctap2 import Ctap2
|
||||||
|
|
||||||
|
DOOR_ID = 0
|
||||||
|
|
||||||
gotAaguid = None
|
gotAaguid = None
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
|
||||||
greenLed = 14
|
greenLed = 14
|
||||||
redLed = 4
|
redLed = 4
|
||||||
|
|
||||||
|
door = 21
|
||||||
|
|
||||||
|
|
||||||
# badCredentials = False
|
# badCredentials = False
|
||||||
GPIO.setup(greenLed, GPIO.OUT)
|
GPIO.setup(greenLed, GPIO.OUT)
|
||||||
GPIO.output(greenLed, GPIO.LOW)
|
GPIO.output(greenLed, GPIO.LOW)
|
||||||
GPIO.setup(redLed, GPIO.OUT)
|
GPIO.setup(redLed, GPIO.OUT)
|
||||||
GPIO.output(redLed, GPIO.LOW)
|
GPIO.output(redLed, GPIO.LOW)
|
||||||
|
|
||||||
|
GPIO.setup(door, GPIO.OUT)
|
||||||
|
GPIO.output(door, GPIO.LOW)
|
||||||
def badCred():
|
def badCred():
|
||||||
print("Bad credential!")
|
print("Bad credential!")
|
||||||
# badCredentials = True
|
# badCredentials = True
|
||||||
@ -72,6 +79,8 @@ class CliInteraction(UserInteraction):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
GPIO.output(door, GPIO.LOW)
|
||||||
# GPIO.output(14, GPIO.LOW)
|
# GPIO.output(14, GPIO.LOW)
|
||||||
print("Waiting for device...")
|
print("Waiting for device...")
|
||||||
badCredentials = False
|
badCredentials = False
|
||||||
@ -110,7 +119,7 @@ while True:
|
|||||||
|
|
||||||
# Define the SQL query for retrieving data
|
# Define the SQL query for retrieving data
|
||||||
select_query = '''
|
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
|
FROM credential_data
|
||||||
WHERE "AAGUID" = %s;
|
WHERE "AAGUID" = %s;
|
||||||
'''
|
'''
|
||||||
@ -133,14 +142,15 @@ while True:
|
|||||||
if result:
|
if result:
|
||||||
data = {
|
data = {
|
||||||
"AAGUID": result[0],
|
"AAGUID": result[0],
|
||||||
"credential_id": result[1],
|
"user_id": result[1],
|
||||||
"pk_algo": result[2],
|
"credential_id": result[2],
|
||||||
"pk_1": result[3],
|
"pk_algo": result[3],
|
||||||
"pk_3": result[4],
|
"pk_1": result[4],
|
||||||
"pk_neg1": result[5],
|
"pk_3": result[5],
|
||||||
"pk_neg2": result[6],
|
"pk_neg1": result[6],
|
||||||
"pk_neg3": result[7],
|
"pk_neg2": result[7],
|
||||||
"pickled": result[8]
|
"pk_neg3": result[8],
|
||||||
|
"pickled": result[9]
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
else:
|
else:
|
||||||
@ -209,11 +219,17 @@ while True:
|
|||||||
GPIO.output(greenLed, GPIO.LOW)
|
GPIO.output(greenLed, GPIO.LOW)
|
||||||
time.sleep(0.05)
|
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("CLIENT DATA:", result.client_data)
|
||||||
print()
|
print()
|
||||||
print("AUTH DATA:", result.authenticator_data)
|
print("AUTH DATA:", result.authenticator_data)
|
||||||
# GPIO.output(14, GPIO.LOW)
|
# GPIO.output(14, GPIO.LOW)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Authentication Failed!")
|
print("Authentication Failed!")
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
|
Loading…
Reference in New Issue
Block a user