Advertisement
Guest User

AA

a guest
May 1st, 2018
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. #!/usr/bin/python
  2. import os
  3. import smtplib
  4. import getpass
  5. import sys
  6. def banner(text, ch='=', length=78):
  7. """
  8. _____ _ __ ___
  9. / ___/____ ____ _____ ___ ____ _(_) / _ __ < /
  10. \__ \/ __ \/ __ `/ __ `__ \/ __ `/ / / | | / / / /
  11. ___/ / /_/ / /_/ / / / / / / /_/ / / / | |/ / / /
  12. /____/ .___/\__,_/_/ /_/ /_/\__,_/_/_/ |___(_)_/
  13. __ /_/ _____ __ __
  14. / /_ __ ___ / ___/___ ____ ___ ____ ____ _/ /_/ /____
  15. / __ \/ / / (_) \__ \/ _ \/ __ `__ \/ __ \/ __ `/ __/ __/ _ \
  16. / /_/ / /_/ / ___/ / __/ / / / / / /_/ / /_/ / /_/ /_/ __/
  17. /_.___/\__, (_) /____/\___/_/ /_/ /_/ .___/\__,_/\__/\__/\___/
  18. /____/ /_/
  19. """
  20. server = input("Mail server: Gmail, HotmailOutlook o Yahoo: ")
  21. server = server.lower()
  22.  
  23. user = input('Tu correo: ')
  24. password = getpass.getpass('Tu contraseña: ')
  25.  
  26. to = input('\nPara: ')
  27. body = input('Mensaje a mostrar: ')
  28. numero = int(input('Numero de veces a enviar: '))
  29.  
  30. if server == 'gmail':
  31. smtp_server = 'smtp.gmail.com'
  32. port = 587
  33. elif server == 'yahoo':
  34. smtp_server = 'smtp.mail.yahoo.com'
  35. port = 465
  36. elif server == 'hotmail':
  37. smtp_server = 'smtp.live.com'
  38. port = 25
  39. else:
  40. print('Mail server erroneo, intentalo de nuevo.')
  41. sys.exit()
  42.  
  43. try:
  44. server = smtplib.SMTP(smtp_server,port)
  45. server.ehlo()
  46. if smtp_server == 'smtp.gmail.com':
  47. server.starttls()
  48. server.login(user,password)
  49. for i in range(1, numero+1):
  50. subject = os.urandom(9)
  51. msg = (body)
  52. server.sendmail(user,to,msg)
  53. sends = "\rE-mails enviados: %i" % i
  54. print(sends)
  55. sys.stdout.flush()
  56. server.quit()
  57. print("Hecho con exito!")
  58. except KeyboardInterrupt:
  59. print("[Ctrl+C]Cancelado por el usuario")
  60. sys.exit()
  61. except smtplib.SMTPAuthenticationError:
  62. print('\n[!] El usuario o contraseña introducidos son erroneos.')
  63. sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement