mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
Fixed old references to first config system, fixed typo
This commit is contained in:
parent
799bab81a6
commit
8c3039b0d0
4 changed files with 16 additions and 9 deletions
|
@ -4,7 +4,7 @@ Windows Hello™ style authentication for Ubuntu. Use your build in IR emitters
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
Fist we need to install pam-python, fswebcam and OpenCV from the Ubuntu repositories:
|
First we need to install pam-python, fswebcam and OpenCV from the Ubuntu repositories:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt install libpam-python fswebcam libopencv-dev python-opencv
|
sudo apt install libpam-python fswebcam libopencv-dev python-opencv
|
||||||
|
@ -43,4 +43,4 @@ This script is in no way as secure as a password and will never be. Although it'
|
||||||
|
|
||||||
To minimize the chance of this script being compromised, it's recommend to store this repo in `/etc/pam.d` and to make it read only.
|
To minimize the chance of this script being compromised, it's recommend to store this repo in `/etc/pam.d` and to make it read only.
|
||||||
|
|
||||||
DO NOT USE THIS SCRIPT AS THE SOLE AUTHENTICATION METHOD FOR YOUR SYSTEM.
|
DO NOT USE THIS SCRIPT AS THE SOLE AUTHENTICATION METHOD FOR YOUR SYSTEM.
|
||||||
|
|
|
@ -9,9 +9,9 @@ import os
|
||||||
import json
|
import json
|
||||||
import configparser
|
import configparser
|
||||||
|
|
||||||
# Read config from disk
|
# Read config from disk
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(os.path.dirname(__file__) + "/config.ini")
|
config.read(os.path.dirname(os.path.abspath(__file__)) + "/config.ini")
|
||||||
|
|
||||||
def stop(status):
|
def stop(status):
|
||||||
"""Stop the execution and close video stream"""
|
"""Stop the execution and close video stream"""
|
||||||
|
@ -34,7 +34,7 @@ tries = 0
|
||||||
|
|
||||||
# Try to load the face model from the models folder
|
# Try to load the face model from the models folder
|
||||||
try:
|
try:
|
||||||
encodings = json.load(open(os.path.dirname(__file__) + "/models/" + user + ".dat"))
|
encodings = json.load(open(os.path.dirname(os.path.abspath(__file__)) + "/models/" + user + ".dat"))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
sys.exit(10)
|
sys.exit(10)
|
||||||
|
|
||||||
|
|
11
learn.py
11
learn.py
|
@ -9,14 +9,19 @@ import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# Import config and extra functions
|
# Import config and extra functions
|
||||||
import config
|
import configparser
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
|
# Read config from disk
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(os.path.dirname(os.path.abspath(__file__)) + "/config.ini")
|
||||||
|
|
||||||
def captureFrame(delay):
|
def captureFrame(delay):
|
||||||
"""Capture and encode 1 frame of video"""
|
"""Capture and encode 1 frame of video"""
|
||||||
|
global encodings
|
||||||
|
|
||||||
# Call fswebcam to save a frame to /tmp with a set delay
|
# Call fswebcam to save a frame to /tmp with a set delay
|
||||||
subprocess.call(["fswebcam", "-S", str(delay), "--no-banner", "-d", "/dev/video" + str(config.device_id), tmp_file], stderr=open(os.devnull, "wb"))
|
subprocess.call(["fswebcam", "-S", str(delay), "--no-banner", "-d", "/dev/video" + str(config.get("video", "device_id")), tmp_file], stderr=open(os.devnull, "wb"))
|
||||||
|
|
||||||
# Get the faces in htat image
|
# Get the faces in htat image
|
||||||
ref = face_recognition.load_image_file(tmp_file)
|
ref = face_recognition.load_image_file(tmp_file)
|
||||||
|
@ -62,6 +67,8 @@ except FileNotFoundError:
|
||||||
# If a file does exist, ask the user what needs to be done
|
# If a file does exist, ask the user what needs to be done
|
||||||
if encodings != False:
|
if encodings != False:
|
||||||
encodings = utils.print_menu(encodings)
|
encodings = utils.print_menu(encodings)
|
||||||
|
else:
|
||||||
|
encodings = []
|
||||||
|
|
||||||
print("\nLearning face for the user account " + user)
|
print("\nLearning face for the user account " + user)
|
||||||
print("Please look straight into the camera for 5 seconds")
|
print("Please look straight into the camera for 5 seconds")
|
||||||
|
|
4
pam.py
4
pam.py
|
@ -10,13 +10,13 @@ import ConfigParser
|
||||||
|
|
||||||
# Read config from disk
|
# Read config from disk
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
config.read(os.path.dirname(__file__) + "/config.ini")
|
config.read(os.path.dirname(os.path.abspath(__file__)) + "/config.ini")
|
||||||
|
|
||||||
def doAuth(pamh):
|
def doAuth(pamh):
|
||||||
"""Start authentication in a seperate process"""
|
"""Start authentication in a seperate process"""
|
||||||
|
|
||||||
# Run compair as python3 subprocess to circumvent python version and import issues
|
# Run compair as python3 subprocess to circumvent python version and import issues
|
||||||
status = subprocess.call(["python3", os.path.dirname(__file__) + "/compair.py", pamh.get_user()])
|
status = subprocess.call(["python3", os.path.dirname(os.path.abspath(__file__)) + "/compair.py", pamh.get_user()])
|
||||||
|
|
||||||
# Status 10 means we couldn't find any face models
|
# Status 10 means we couldn't find any face models
|
||||||
if status == 10:
|
if status == 10:
|
||||||
|
|
Loading…
Reference in a new issue