This commit is contained in:
EggMan20339 2024-05-09 21:47:06 -04:00
parent 88e02f1fee
commit 386cbc2c0a
3 changed files with 12 additions and 11 deletions

View File

@ -7,7 +7,7 @@ sudo apt-get install python3-psycopg2 -y
sudo apt-get install python3-fido2 -y sudo apt-get install python3-fido2 -y
sudo apt-get install python3-nfcpy -y sudo apt-get install python3-nfcpy -y
sudo apt-get install screen -y sudo apt-get install screen -y
#test
sudo apt-get update sudo apt-get update
sudo apt-get upgrade -y sudo apt-get upgrade -y

16
main.py
View File

@ -105,26 +105,28 @@ class CliInteraction(UserInteraction):
print("User Verification required.") print("User Verification required.")
return True return True
def read_nfc_tag():
try: try:
clf = nfc.ContactlessFrontend('usb') # Ensure this matches your connection clf = nfc.ContactlessFrontend('usb')
print("NFC reader initialized.") tag = clf.connect(rdwr={'on-connect': lambda tag: False})
clf.close()
return tag.identifier if tag else None
except Exception as e: except Exception as e:
print("Failed to initialize NFC reader:", e) print("NFC read error:", e)
return None
while True: while True:
if gpie: if gpie:
GPIO.output(door, GPIO.LOW) GPIO.output(door, GPIO.LOW)
# GPIO.output(14, GPIO.LOW)
print("Waiting for device...") print("Waiting for device...")
badCredentials = False badCredentials = False
if gpie: if gpie:
GPIO.output(redLed, GPIO.HIGH) GPIO.output(redLed, GPIO.HIGH)
while True: while True:
try: try:
# GPIO.output(14, GPIO.LOW) nfc_tag = read_nfc_tag()
dev = next(CtapHidDevice.list_devices(), None) dev = next(CtapHidDevice.list_devices(), None)
if dev: if dev:

View File

@ -2,7 +2,6 @@
sudo cp /user/CNSA/CNSA-276-FP/config.ini /config.bak sudo cp /user/CNSA/CNSA-276-FP/config.ini /config.bak
sudo rm -R /user/CNSA/CNSA-276-FP sudo rm -R /user/CNSA/CNSA-276-FP
#test2
# Function to check internet connectivity # Function to check internet connectivity
check_internet_connection() { check_internet_connection() {