Skip to content

Commit

Permalink
ver2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramhm committed Nov 7, 2018
1 parent 149a796 commit 96667b5
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions DA_change_pass.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/bin/bash
# Ramin
DATE=$(date +%D)
SCRIPT_DIR="/root/scripts/"
DOMAIN_LIST=$(cat /etc/virtual/domainowners | cut -d ":" -f1)
MAIL_LIST_DIR="/etc/virtual/"
MAILFILE="/passwd"
URL_MA_EXIST="/root/scripts/.URL_mail_account_exist"
PASSG_FILE="/root/scripts/passgenerator.php"
CSV_EXPORT="/root/MailServer_NewUsers.csv"
DATE=$(date +%D)


rm "$SCRIPT_DIR.domain_list" "$URL_MA_EXIST" "$CSV_EXPORT"

Expand All @@ -24,25 +23,16 @@ done

FILE_MAILA=" /etc/virtual/DOMAIN.com/passwd
"

for MFILE in $(cat $FILE_MAILA)
do
# echo $MFILE
ANAME=$(echo "$MFILE" | cut -d ":" -f6 | cut -d "/" -f3)
# echo $ANAME
DNAME=$(echo "$MFILE" | cut -d ":" -f6 | cut -d "/" -f5)
# echo $DNAME
PASS_TMP=$(date +%s%N | md5sum | base64 | head -c 10)
# echo $PASS_TMP
sed -i 's/password1234/'$PASS_TMP'/g' $PASSG_FILE
PASSG=$(php $PASSG_FILE)
# echo $PASSG
MUSER=$(echo $MFILE | cut -d ":" -f1)
OCUSER=$(echo $MFILE | cut -d : -f 3,4,5,6,7,8,9)
# echo $MUSER
echo "$MUSER:$PASSG:$OCUSER" >> $MAIL_LIST_DIR$DNAME$MAILFILE'.new'
# sed -i 's/^\("$MUSER":\)[^:]*\(:.*\)$/\1'$PASSG'\2/g' $MAIL_LIST_DIR$DNAME$MAILFILE
sed -i 's/'$PASS_TMP'/password1234/g' $PASSG_FILE
echo "$DNAME;$MUSER;$PASS_TMP;$DATE" >> $CSV_EXPORT
done

0 comments on commit 96667b5

Please sign in to comment.