0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-19 09:51:19 +02:00

Merge pull request #432 from boltgolt/dev

Version 2.6.1
This commit is contained in:
boltgolt 2020-09-02 17:26:22 +02:00 committed by GitHub
commit 69d87288d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 21 deletions

View file

@ -4,7 +4,8 @@ about: Report something that's not working
---
_Please describe the issue in as much detail as possible, including any errors and traces_
_Please describe the issue in as much detail as possible, including any errors and traces._
_If your issue is a camera issue, be sure to also post the image generated by running `sudo howdy snapshot`._
@ -15,4 +16,4 @@ I've searched for similar issues already, and my issue has not been reported yet
Linux distribution (if applicable):
Howdy version:
Howdy version (`sudo howdy version`):

View file

@ -14,7 +14,7 @@ _howdy() {
case "${prev}" in
# After the main command, show the commands
"howdy")
opts="add clear config disable list remove clear test"
opts="add clear config disable list remove clear snapshot test version"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;

2
debian/postinst vendored
View file

@ -110,7 +110,7 @@ log("Upgrading pip to the latest version")
handleStatus(sc(["pip3", "install", "--upgrade", "pip"]))
log("Upgrading numpy to the lateset version")
log("Upgrading numpy to the latest version")
# Update numpy
handleStatus(subprocess.call(["pip3", "install", "--upgrade", "numpy"]))

4
debian/preinst vendored
View file

@ -135,11 +135,11 @@ print("\nYou can always change this setting in the config.")
prof = input("What profile would you like to use? [f/b/s]: ")
if prof.lower().strip() == "f" or prof.lower().strip() == "fast":
cert = 1.5
cert = 4.2
elif prof.lower().strip() == "b" or prof.lower().strip() == "balanced":
cert = 2.8
elif prof.lower().strip() == "s" or prof.lower().strip() == "secure":
cert = 4
cert = 2
# Write the result to disk so postinst can have a look at it
with open("/tmp/howdy_picked_device", "w") as out_file:

View file

@ -108,4 +108,4 @@ elif args.command == "snapshot":
elif args.command == "test":
import cli.test
else:
print("Howdy 2.6.0")
print("Howdy 2.6.1")

View file

@ -7,7 +7,6 @@ import sys
import json
import configparser
import builtins
import cv2
import numpy as np
from recorders.video_capture import VideoCapture
@ -22,6 +21,9 @@ except ImportError as err:
print("pip3 show dlib")
sys.exit(1)
# OpenCV needs to be imported after dlib
import cv2
# Get the absolute path to the current directory
path = os.path.abspath(__file__ + "/..")

View file

@ -5,8 +5,8 @@ import configparser
import os
import sys
import time
import cv2
import dlib
import cv2
from recorders.video_capture import VideoCapture
# Get the absolute path to the current file
@ -183,7 +183,7 @@ try:
# Delay the frame if slowmode is on
if slow_mode:
time.sleep(.5 - frame_time)
time.sleep(max([.5 - frame_time, 0.0]))
if exposure != -1:
# For a strange reason on some cameras (e.g. Lenoxo X1E)

View file

@ -14,8 +14,8 @@ import sys
import os
import json
import configparser
import cv2
import dlib
import cv2
import datetime
import snapshot
import numpy as np
@ -176,7 +176,7 @@ while True:
if dark_tries == valid_frames:
print("All frames were too dark, please check dark_threshold in config")
print("Average darkness: " + str(dark_running_total / valid_frames) + ", Threshold: " + str(dark_threshold))
print("Average darkness: " + str(dark_running_total / max(1, valid_frames)) + ", Threshold: " + str(dark_threshold))
sys.exit(13)
else:
sys.exit(11)
@ -291,5 +291,5 @@ while True:
# are captured and even after a delay it does not
# always work. Setting exposure at every frame is
# reliable though.
video_capture.intenal.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1.0) # 1 = Manual
video_capture.intenal.set(cv2.CAP_PROP_EXPOSURE, float(exposure))
video_capture.internal.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1.0) # 1 = Manual
video_capture.internal.set(cv2.CAP_PROP_EXPOSURE, float(exposure))

View file

@ -31,11 +31,14 @@ def doAuth(pamh):
if any("closed" in open(f).read() for f in glob.glob("/proc/acpi/button/lid/*/state")):
return pamh.PAM_AUTHINFO_UNAVAIL
# Set up syslog
syslog.openlog("[HOWDY]", 0, syslog.LOG_AUTH)
# Alert the user that we are doing face detection
if config.getboolean("core", "detection_notice"):
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Attempting face detection"))
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Attempting facial authentication for user " + pamh.get_user())
syslog.syslog(syslog.LOG_INFO, "Attempting facial authentication for user " + pamh.get_user())
# Run compare as python3 subprocess to circumvent python version and import issues
status = subprocess.call(["/usr/bin/python3", os.path.dirname(os.path.abspath(__file__)) + "/compare.py", pamh.get_user()])
@ -45,23 +48,27 @@ def doAuth(pamh):
if not config.getboolean("core", "suppress_unknown"):
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "No face model known"))
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, no face model known")
syslog.syslog(syslog.LOG_NOTICE, "Failure, no face model known")
syslog.closelog()
return pamh.PAM_USER_UNKNOWN
# Status 11 means we exceded the maximum retry count
elif status == 11:
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Face detection timeout reached"))
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, timeout reached")
syslog.syslog(syslog.LOG_INFO, "Failure, timeout reached")
syslog.closelog()
return pamh.PAM_AUTH_ERR
# Status 12 means we aborted
elif status == 12:
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, general abort")
syslog.syslog(syslog.LOG_INFO, "Failure, general abort")
syslog.closelog()
return pamh.PAM_AUTH_ERR
# Status 13 means the image was too dark
elif status == 13:
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, image too dark")
syslog.syslog(syslog.LOG_INFO, "Failure, image too dark")
syslog.closelog()
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Face detection image too dark"))
return pamh.PAM_AUTH_ERR
# Status 0 is a successful exit
@ -70,12 +77,14 @@ def doAuth(pamh):
if not config.getboolean("core", "no_confirmation"):
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Identified face as " + pamh.get_user()))
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Login approved")
syslog.syslog(syslog.LOG_INFO, "Login approved")
syslog.closelog()
return pamh.PAM_SUCCESS
# Otherwise, we can't discribe what happend but it wasn't successful
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Unknown error: " + str(status)))
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, unknown error" + str(status))
syslog.syslog(syslog.LOG_INFO, "Failure, unknown error" + str(status))
syslog.closelog()
return pamh.PAM_SYSTEM_ERR