daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest May 31st, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. function check_input {
  4.   message=$1
  5.   validate=$2
  6.   default=$3
  7.  
  8.   while [ $? -ne 1 ]; do
  9.     echo -n "$message "
  10.     read INPUTTEXT < /dev/tty
  11.     if [ "$INPUTTEXT" == "" -a "$default" != "" ]; then
  12.       INPUTTEXT=$default
  13.       return 1
  14.     fi
  15.     echo $INPUTTEXT | egrep -q "$validate" && return 1
  16.     echo "Invalid input"
  17.   done
  18.  
  19. }
  20.  
  21. echo
  22. echo "SMTP GateWay Setup"
  23. echo
  24. echo
  25.  
  26. echo "Would you like to update Mailwatch admin password?"
  27. check_input "Update Admin password? (y/n) [Default: n]:" "y|n" "n"
  28. chpass=$INPUTTEXT
  29. echo
  30.  
  31. if [ "$chpass" == "y" ]; then
  32.         echo
  33.         echo "Please enter the new password"
  34.         check_input "Password:"
  35.         PASS=$INPUTTEXT
  36.         echo
  37.         echo "Updating to new password...."
  38.         echo
  39.         PASS2=`echo $PASS | md5sum | cut -d " " -f 1 `
  40.         PASS2=`/usr/bin/php -r "echo md5('$PASS');"`
  41.         query="UPDATE users SET  password='$PASS2' WHERE username='Admin' "
  42.         mysql="mysql -psmtpgateway -Dmailscanner"
  43.         echo "$query" | $mysql
  44. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top