mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
Reworking command line
This commit is contained in:
parent
5e221c1550
commit
b534442b9d
4 changed files with 61 additions and 8 deletions
11
.travis.yml
11
.travis.yml
|
@ -1,16 +1,17 @@
|
|||
language: python
|
||||
sudo: required
|
||||
|
||||
before_install:
|
||||
install:
|
||||
- sudo apt install devscripts dh-make -y
|
||||
- debuild -i -us -uc -b
|
||||
|
||||
install: sudo apt install ../*.deb -y
|
||||
|
||||
script:
|
||||
- debuild -i -us -uc -b
|
||||
- sudo apt install ../*.deb -y
|
||||
- sudo howdy help
|
||||
- sudo howdy list
|
||||
- sudo apt purge howdy -y
|
||||
|
||||
notifications:
|
||||
email: true
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: always
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Howdy for Ubuntu [![](https://travis-ci.org/Boltgolt/howdy.svg?branch=dev)](https://travis-ci.org/Boltgolt/howdy) ![](https://img.shields.io/github/release/Boltgolt/howdy.svg?colorB=4c1) [![](https://img.shields.io/github/issues-raw/Boltgolt/howdy/enhancement.svg?label=feature+requests&colorB=4c1)](https://github.com/Boltgolt/howdy/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
|
||||
# Howdy for Ubuntu [![](https://img.shields.io/travis/Boltgolt/howdy/dev.svg)](https://travis-ci.org/Boltgolt/howdy) [![](https://img.shields.io/github/release/Boltgolt/howdy.svg?colorB=4c1)](https://github.com/Boltgolt/howdy/releases) [![](https://img.shields.io/github/issues-raw/Boltgolt/howdy/enhancement.svg?label=feature+requests&colorB=4c1)](https://github.com/Boltgolt/howdy/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
|
||||
|
||||
Windows Hello™ style authentication for Ubuntu. Use your built-in IR emitters and camera in combination with face recognition to prove who you are.
|
||||
|
||||
|
@ -35,7 +35,6 @@ howdy <command> [user] [argument]
|
|||
| `clear` | Remove all face models for the given user | Yes |
|
||||
| `config` | Open the config file in nano | No |
|
||||
| `disable` | Disable or enable howdy | No |
|
||||
| `help` | Show a help page | No |
|
||||
| `list` | List all saved face models for the given user | Yes |
|
||||
| `remove` | Remove a specific model for the given user | Yes |
|
||||
| `test` | Test the camera and recognition methods | No |
|
||||
|
@ -50,6 +49,6 @@ If you encounter an error that hasn't been reported yet, don't be afraid to open
|
|||
|
||||
This script is in no way as secure as a password and will never be. Although it's harder to fool than normal face recognition, a person who looks similar to you or well-printed photo of you could be enough to do it.
|
||||
|
||||
To minimize the chance of this script being compromised, it's recommend to leave this repo in /lib/security and to keep it read only.
|
||||
To minimize the chance of this program being compromised, it's recommend to leave Howdy in /lib/security and to keep it read only.
|
||||
|
||||
DO NOT USE HOWDY AS THE SOLE AUTHENTICATION METHOD FOR YOUR SYSTEM.
|
||||
|
|
1
debian/prerm
vendored
1
debian/prerm
vendored
|
@ -11,6 +11,7 @@ def col(id):
|
|||
|
||||
# Import required modules
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# Only run when we actually want to remove
|
||||
if "remove" not in sys.argv and "purge" not in sys.argv:
|
||||
|
|
52
src/cli.py
52
src/cli.py
|
@ -4,6 +4,58 @@
|
|||
# Import required modules
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import getpass
|
||||
import argparse
|
||||
|
||||
user = subprocess.check_output("echo $(logname 2>/dev/null || echo $SUDO_USER)", shell=True).decode("ascii").strip()
|
||||
|
||||
if user == "root" or user == "":
|
||||
env_user = getpass.getuser().strip()
|
||||
|
||||
if env_user == "root" or env_user == "":
|
||||
print("Could not determine user, please use the --user flag")
|
||||
sys.exit(1)
|
||||
else:
|
||||
user = env_user
|
||||
|
||||
parser = argparse.ArgumentParser(description="Command line interface for Howdy face authentication.",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
add_help=False,
|
||||
prog="howdy",
|
||||
epilog="For support please visit\nhttps://github.com/Boltgolt/howdy")
|
||||
|
||||
|
||||
parser.add_argument("command",
|
||||
help="The command option to execute, can be one of the following: add, clear, config, disable, list, remove or test.",
|
||||
metavar="command",
|
||||
choices=["add", "clear", "config", "disable", "list", "remove", "test"])
|
||||
|
||||
parser.add_argument("argument",
|
||||
help="Either 0 or 1 for the disable command, or the model ID for the remove command.",
|
||||
nargs="?")
|
||||
|
||||
parser.add_argument("-U", "--user",
|
||||
default=user,
|
||||
help="Set the user account to use.")
|
||||
|
||||
parser.add_argument("-y",
|
||||
help="Skip all questions.",
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument("-h", "--help",
|
||||
action="help",
|
||||
default=argparse.SUPPRESS,
|
||||
help="Show this help message and exit.")
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
parser.print_help()
|
||||
sys.exit(0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
print(args)
|
||||
sys.exit(1)
|
||||
|
||||
# Check if if a command has been given and print help otherwise
|
||||
if (len(sys.argv) < 2):
|
||||
|
|
Loading…
Reference in a new issue