Advertisement
Guest User

Untitled

a guest
Jan 5th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. root@yud [~]# cd ~jesse
  2. 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
  3. -all flag will pull all email accounts for the cPanel User you are in the directory for
  4. Example: list_email -all
  5. -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
  6. Example: list_email -single cookingclass.com
  7.  
  8.  
  9. 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
  10. cookingclass.com
  11. -----
  12. obviouslynot@cookingclass.com
  13. suspended@cookingclass.com
  14. fulldisk@cookingclass.com
  15.  
  16.  
  17. 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
  18. cookingclass.com
  19. ----
  20. obviouslynot@cookingclass.com
  21. suspended@cookingclass.com
  22. fulldisk@cookingclass.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement