Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@yud [~]# cd ~jesse
- root@yud [/home/jesse]# list_email () { if [ "$1" == "-all" ]; then for domain in $(awk -F"=" '/^DNS/{print $2}' /var/cpanel/users/$(pwd|cut -d"/" -f3)); do if [ -s "$(pwd|cut -d"/" -f1-3)/etc/$domain/passwd" ]; then printf "%b\n" "\n$domain" "-----" "$(awk -F"[/:]" 'BEGIN{OFS="@"} {print $11,$10}' $(pwd|cut -d"/" -f1-3)/etc/$domain/passwd 2>/dev/null)\n";fi; done; elif [ "$1" == "-help" ]; then printf "%b\n" "\n-all flag will pull all email accounts for the cPanel User you are in the directory for" "\tExample: list_email -all\n" "-single flag will pull email accounts for a specific domain (if it exists) as a domain on the account for the cPanel user you are in the directory for" "\tExample: list_email -single cookingclass.com\n"; elif [ "$1" == "-single" ]; then if [ ! -z $(awk -F"=" "/$2/{print \$1}" /var/cpanel/users/$(pwd|cut -d"/" -f3)|head -1) -a -s "$(pwd|cut -d"/" -f1-3)/etc/$2/passwd" 2>/dev/null ]; then printf "%b\n" "\n$2" "----" "$(awk -F"[/:]" 'BEGIN{OFS="@"} {print $11,$10}' $(pwd|cut -d"/" -f1-3)/etc/$2/passwd 2>/dev/null)\n"; else echo -e "\n$2 is not a valid domain on $(pwd|cut -d"/" -f3)'s cPanel account\n"; fi; else echo "no valid input";fi ;}; list_email -help
- -all flag will pull all email accounts for the cPanel User you are in the directory for
- Example: list_email -all
- -single flag will pull email accounts for a specific domain (if it exists) as a domain on the account for the cPanel user you are in the directory for
- Example: list_email -single cookingclass.com
- root@yud [/home/jesse]# list_email () { if [ "$1" == "-all" ]; then for domain in $(awk -F"=" '/^DNS/{print $2}' /var/cpanel/users/$(pwd|cut -d"/" -f3)); do if [ -s "$(pwd|cut -d"/" -f1-3)/etc/$domain/passwd" ]; then printf "%b\n" "\n$domain" "-----" "$(awk -F"[/:]" 'BEGIN{OFS="@"} {print $11,$10}' $(pwd|cut -d"/" -f1-3)/etc/$domain/passwd 2>/dev/null)\n";fi; done; elif [ "$1" == "-help" ]; then printf "%b\n" "\n-all flag will pull all email accounts for the cPanel User you are in the directory for" "\tExample: list_email -all\n" "-single flag will pull email accounts for a specific domain (if it exists) as a domain on the account for the cPanel user you are in the directory for" "\tExample: list_email -single cookingclass.com\n"; elif [ "$1" == "-single" ]; then if [ ! -z $(awk -F"=" "/$2/{print \$1}" /var/cpanel/users/$(pwd|cut -d"/" -f3)|head -1) -a -s "$(pwd|cut -d"/" -f1-3)/etc/$2/passwd" 2>/dev/null ]; then printf "%b\n" "\n$2" "----" "$(awk -F"[/:]" 'BEGIN{OFS="@"} {print $11,$10}' $(pwd|cut -d"/" -f1-3)/etc/$2/passwd 2>/dev/null)\n"; else echo -e "\n$2 is not a valid domain on $(pwd|cut -d"/" -f3)'s cPanel account\n"; fi; else echo "no valid input";fi ;}; list_email -all
- cookingclass.com
- -----
- obviouslynot@cookingclass.com
- suspended@cookingclass.com
- fulldisk@cookingclass.com
- root@yud [/home/jesse]# list_email () { if [ "$1" == "-all" ]; then for domain in $(awk -F"=" '/^DNS/{print $2}' /var/cpanel/users/$(pwd|cut -d"/" -f3)); do if [ -s "$(pwd|cut -d"/" -f1-3)/etc/$domain/passwd" ]; then printf "%b\n" "\n$domain" "-----" "$(awk -F"[/:]" 'BEGIN{OFS="@"} {print $11,$10}' $(pwd|cut -d"/" -f1-3)/etc/$domain/passwd 2>/dev/null)\n";fi; done; elif [ "$1" == "-help" ]; then printf "%b\n" "\n-all flag will pull all email accounts for the cPanel User you are in the directory for" "\tExample: list_email -all\n" "-single flag will pull email accounts for a specific domain (if it exists) as a domain on the account for the cPanel user you are in the directory for" "\tExample: list_email -single cookingclass.com\n"; elif [ "$1" == "-single" ]; then if [ ! -z $(awk -F"=" "/$2/{print \$1}" /var/cpanel/users/$(pwd|cut -d"/" -f3)|head -1) -a -s "$(pwd|cut -d"/" -f1-3)/etc/$2/passwd" 2>/dev/null ]; then printf "%b\n" "\n$2" "----" "$(awk -F"[/:]" 'BEGIN{OFS="@"} {print $11,$10}' $(pwd|cut -d"/" -f1-3)/etc/$2/passwd 2>/dev/null)\n"; else echo -e "\n$2 is not a valid domain on $(pwd|cut -d"/" -f3)'s cPanel account\n"; fi; else echo "no valid input";fi ;}; list_email -single cookingclass.com
- cookingclass.com
- ----
- obviouslynot@cookingclass.com
- suspended@cookingclass.com
- fulldisk@cookingclass.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement