Reworking command line

This commit is contained in:
boltgolt 2018-04-13 14:54:06 +02:00
parent 5e221c1550
commit b534442b9d
4 changed files with 61 additions and 8 deletions

View file

@ -1,16 +1,17 @@
language: python language: python
sudo: required sudo: required
before_install: install:
- sudo apt install devscripts dh-make -y - sudo apt install devscripts dh-make -y
- debuild -i -us -uc -b
install: sudo apt install ../*.deb -y
script: script:
- debuild -i -us -uc -b
- sudo apt install ../*.deb -y
- sudo howdy help - sudo howdy help
- sudo howdy list - sudo howdy list
- sudo apt purge howdy -y - sudo apt purge howdy -y
notifications: notifications:
email: true email:
on_success: never
on_failure: always

View file

@ -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. 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 | | `clear` | Remove all face models for the given user | Yes |
| `config` | Open the config file in nano | No | | `config` | Open the config file in nano | No |
| `disable` | Disable or enable howdy | No | | `disable` | Disable or enable howdy | No |
| `help` | Show a help page | No |
| `list` | List all saved face models for the given user | Yes | | `list` | List all saved face models for the given user | Yes |
| `remove` | Remove a specific model for the given user | Yes | | `remove` | Remove a specific model for the given user | Yes |
| `test` | Test the camera and recognition methods | No | | `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. 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. DO NOT USE HOWDY AS THE SOLE AUTHENTICATION METHOD FOR YOUR SYSTEM.

1
debian/prerm vendored
View file

@ -11,6 +11,7 @@ def col(id):
# Import required modules # Import required modules
import subprocess import subprocess
import sys
# Only run when we actually want to remove # Only run when we actually want to remove
if "remove" not in sys.argv and "purge" not in sys.argv: if "remove" not in sys.argv and "purge" not in sys.argv:

View file

@ -4,6 +4,58 @@
# Import required modules # Import required modules
import sys import sys
import os 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 # Check if if a command has been given and print help otherwise
if (len(sys.argv) < 2): if (len(sys.argv) < 2):