Jump to content
cmiN

[Python] SMTP Spammer [cmiN]

Recommended Posts

Am vazut ca multi dintre voi cautati un script/tool pentru spam, daca aveti niste smtp-uri atunci nu va mai retine nimic.

Python code by cmiN - 99 lines - codepad

2.x

#! /usr/bin/env python
# 21.08.2010 <> 21.08.2010 | cmiN
# SMTP Spammer 4 paxnWo @ rstcenter.com

import sys, threading, smtplib, socket
from email.mime.text import MIMEText

def main(args):
usage = """\t\t SMTP Spammer 1.0

\t Usage: source.ext fradd subject message tolist smlist eno timeout threads

Where fradd is an arbitrary sender address
subject is a string
message is a file containing the email body
tolist is a file with recipient addresses
smlist is a file with SMTPs in this format:
host port user password
eno specifies how many emails every SMTP will send per thread
timeout is a float (seconds)
if None -> no timeout
threads is an integer

\t Example: smam.py 1337@rstcenter.com Hello msg.txt emails.txt hosts.txt 100 None 2"""
try:
if len(args) == 9:
process(args[1], args[2], args[3], args[4], args[5], int(args[6]), args[7], int(args[8]))
else:
print usage
except Exception as message:
print "An error occurred: {}".format(message)
return 1
except:
print "Unexpected error."
return 2
return 0

def process(fradd, subject, message, tolist, smlist, eno, timeout, threads):
if timeout != "None":
socket.setdefaulttimeout(float(timeout))
fobj = open(message, "rt")
source = fobj.read()
fobj.close()
if source.find("<html>") == -1:
etype = "plain"
else:
etype = "html"
eobj = MIMEText(source, etype)
eobj["Subject"] = subject
eobj["From"] = fradd
Send.fradd = fradd
Send.estr = eobj.as_string()
Send.sobj = smtplib.SMTP()
with open(smlist, "rt") as fobj:
smtps = set()
for line in fobj:
smtps.add(line.strip("\n"))
smtps = list(smtps)
with open(tolist, "rt") as fobj:
status = True
xrobj = xrange(eno)
smlen = len(smtps)
i = 0
while status:
emails = list()
for j in xrobj:
line = fobj.readline().strip("\n")
if not line:
status = False
break
else:
emails.append(line)
if i == smlen:
i = 0
while threading.active_count() > 1:
pass
while threading.active_count() > threads:
pass
Send(smtps[i], emails).start()
i += 1
while threading.active_count() > 1:
pass

class Send(threading.Thread):

def __init__(self, smtp, emails):
threading.Thread.__init__(self)
self.smtp = smtp
self.emails = emails

def run(self):
host, port, user, password = self.smtp.split(" ")
self.sobj.connect(host, port)
self.sobj.login(user, password)
self.sobj.sendmail(self.fradd, self.emails, self.estr)
self.sobj.quit()

if __name__ == "__main__":
main(sys.argv)

Care vine la pachet cu un POP3 scanner...

Python code by cmiN - 52 lines - codepad

3.x

#! /usr/bin/env python3.1
# 12.01.2010 <> 12.01.2010 | cmiN
# POP3 checker


import threading, poplib


class MSender(threading.Thread):

ipl = list()
verbose = 1

def __init__(self, ip, usr, pwd):
threading.Thread.__init__(self)
self.ip = ip
self.usr = usr
self.pwd = pwd

def run(self):
try:
psock = poplib.POP3(self.ip)
psock.user(self.usr)
psock.pass_(self.pwd)
psock.getwelcome()
psock.quit()
except Exception as message:
if MSender.verbose:
print(self.ip, self.usr, self.pwd, message)
else:
MSender.ipl.append("{} {} {}\n".format(self.ip, self.usr, self.pwd))


def main():
ofname = "hosts.txt"
olname = "working.txt"
threads = 50
with open(ofname, "rt") as fin:
for line in fin:
line = line.strip("\n").split(" ")
while threading.active_count() > threads:
pass
MSender(line[0], line[1], line[2]).start()
while threading.active_count() > 1:
pass
with open(olname, "wt") as fout:
for x in MSender.ipl:
fout.write(x)
print("Finished.")

if __name__ == "__main__":
main()

De testat nu prea le-am testat dar multi mi-au spus ca functioneaza.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...