Advertisement
MisterKlio

SMTP BASH COMMAND V1.0

Mar 24th, 2018
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. NC='\033[0m'
  4. GREEN='\e[38;5;82m'
  5. CYAN='\e[38;5;45m'
  6. RED='\e[38;5;196m'
  7. ##
  8. printf  "\e[38;5;82m   ____               _    _      _____   __  __   _______   _____   \n"   
  9. printf  "\e[38;5;82m  |  _ \      /\     | |  | |    / ____| |  \/  | |__   __| |  __ \  \n"   
  10. printf  "\e[38;5;82m  | |_) |    /  \    | |__| |   | (___   | \  / |    | |    | |__) | \n"   
  11. printf  "\e[38;5;82m  |  _ <    / /\ \   |  __  |    \___ \  | |\/| |    | |    |  ___/  \n"   
  12. printf  "\e[38;5;82m  | |_) |  / ____ \  | |  | |    ____) | | |  | |    | |    | |      \n"   
  13. printf  "\e[38;5;82m  |____/  /_/    \_\ |_|  |_|   |_____/  |_|  |_|    |_|    |_| V1.0 \n"       
  14. printf  "\e[38;5;82m                                                                     \n"
  15. printf  "\n"                                                                    
  16. printf  " .  .._. __..___..___.__   .  ..   ._..__.  .__ ._..__ .  ..___.                 \n"
  17. printf  " |\/| | (__   |  [__ [__)  |_/ |    | |  |  [__) | [ __|__|  |                   \n"
  18. printf  " |  |_|_.__)  |  [___|  \  |  \|____|_|__|  |  \_|_[_./|  |  |  MISTER KLIO RIGHT \n"
  19. printf  "                                                                                  \n"
  20. printf "${NC}\n"
  21. printf "${RED}${NC}\n\n"
  22. printf "\n";
  23. # mail.sh
  24. # echo "PUT YOUR MAIL BODY HERE" | mailx -s "We've blocked any access attempts to your account."
  25. #-S smtp=mail.mashami.com
  26. #-S smtp-auth=login
  27. #-S smtp-auth-user=service@mashami.com
  28. #-S smtp-auth-password=???
  29. #-S from="Service <sender@mail.com>" recipient@mail.com
  30.  
  31. if [ $# -ne 7 ]
  32. then
  33. echo "Usage: $0 FromAdress ToAdress Domain MailServer MailTextFile AuthEmail AuthPass"
  34. stop 1
  35. fi
  36.  
  37. #  $authemail "mail smtp"
  38. $authemail=`echo $6|openssl enc -base64|awk 'sub("..$", "login@mail.com")'`
  39. #  $authpass "mail password"
  40. $authpass=`echo $7|openssl enc -base64|awk 'sub("..$", "password")'`
  41.  
  42. if [ ! -f $mailtext ]
  43. then
  44. echo "Cannot find your mail text file. Exiting..."
  45. exit 1
  46. fi
  47.  
  48. exec 9<>/dev/tcp/$mailserver/25
  49. echo "HELO $domain" >&9
  50. read -r temp <&9
  51. echo "$temp"
  52. echo "auth login" >&9
  53. read -r temp <&9
  54. echo "$authemail" >&9
  55. read -r temp <&9
  56. echo "$authpass" >&9
  57. read -r temp <&9
  58. echo "Mail From: $from" >&9
  59. read -r temp <&9
  60. echo "$temp"
  61. echo "Rcpt To: $to" >&9
  62. read -r temp <&9
  63. echo "$temp"
  64. echo "Data" >&9
  65. read -r temp <&9
  66. echo "$temp"
  67. cat $mailtext >&9
  68. echo "." >&9
  69. read -r temp <&9
  70. echo "$temp"
  71. echo "quit" >&9
  72. read -r temp <&9
  73. echo "$temp"
  74. 9>&-
  75. 9<&-
  76. echo "All Done Sending Email. See above for errors"
  77. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement