-1
So... as you can see, the variable target
sets the email that will be sent the message.
However, I cannot add the value of the first line of the list.txt inside the variable target
.
The idea of a broader view is that the script sends the emails, line by line, or else it adds the value of the first line, and at the end of the loop it removes this value from the list.txt and the variable so that a new value can be added.
To add the value of the first line of a text.txt file within a variable ?
(and then remove first line from the txt file to continue the upload cycle.. until the list is finished. for i in xrange(texto):
)
# -*- coding: UTF-8 -*-
import smtplib
import datetime
import random
import getpass
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class spammer():
def __init__(self):
self.banner()
self.spam()
def banner(self):
print """
By Mandrake Venom 2018
"""
arq = open('./lista.txt', 'r')
texto = len(arq.readlines()) -1
valor = ""
print "[+] Total de Emails [+] "
print "========================="
print texto
print "========================="
print valor
arq.close()
def spam(self):
# Credentials
username = raw_input("Login [gmail]: ")
password = raw_input("Senha: ")
target = raw_input("Enviar email para: ")
assunto = raw_input("Assunto: ")
men = input("Body: ")
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
try: server.login(username, password)
except: print "[-] Authentication Error" ; exit()
print "[!] Preparando para Enviar "
try:
for i in xrange(texto):
subj = assunto, random.randrange(0,9999999999999)
content = MIMEText(men, 'html')
name = "fulano"
date = datetime.datetime.now().strftime( "%d/%m/%Y %H:%M" )
msg = "From: %s\nTo: %s\nSubject: %s\nDate: %s\n\n%s" % (name, target, subj, date, content)
server.sendmail(username, target, msg)
except smtplib.SMTPException:
print "[-] An Error Occured During Process | "
print "[!] The target email might be wrong [Error] ===> ",target
exit()
server.quit()
print "[+]", target, " [Enviado] Continue ===>"
try:
spammer()
except KeyboardInterrupt:
print "\n[!] Tchau! byeee byeeeeee.... "
exit()
File "mail-spammer.py", line 22 print primeira_line Indentationerror: Unexpected indent
– Mandrake Venom
This error is how you indentified the code, has nothing to do with the code I posted Indentationerror, Python requires a "good" indentation.
– Guilherme Nascimento
I put it at the beginning of the code, and sent a
print primeira_linha
, I’ve tried it this way and even the other wayfor i in lines arquivo
error... most google answers I’ve already been around– Mandrake Venom
so, python I am gourd
– Mandrake Venom