From 4ebcd5202ed92a7c8df5f2e477e621f22bcda838 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 30 Sep 2011 17:08:06 -0300 Subject: Misc fixes and TODO update --- lib/hydra/misc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/hydra/misc b/lib/hydra/misc index 98d16ac..77d610d 100644 --- a/lib/hydra/misc +++ b/lib/hydra/misc @@ -17,12 +17,17 @@ function hydra_user_input { param="$1" default="$2" shift 2 - read -rep "$* (defaults to $default): " input + + if echo $param | grep -q 'passwd'; then + read -s -rep "$* (defaults to $default): " input + else + read -rep "$* (defaults to $default): " input + fi if [ -z "$input" ]; then - export $param=$default + export $param="$default" else - export $param=$input + export $param="$input" fi } @@ -57,3 +62,12 @@ function hydra_check_command { exit 1 fi } + +# Check for an user +function hydra_check_user { + if [ -z "$1" ]; then + return 1 + fi + + grep -qe "^$1:" /etc/passwd +} -- cgit v1.2.3