Guest User

NiggerGrinder

a guest
Jul 4th, 2009
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.04 KB | None | 0 0
  1. # TWITTER SPAMMER
  2. # by, well, Anonymous
  3.  
  4. import base64
  5. from urllib import *
  6. from urllib2 import *
  7. from random import randint
  8. from random import choice
  9. from time import sleep
  10. from os.path import isfile
  11. import Tkinter as Tk
  12. import Image
  13. import ImageTk
  14. import string
  15.  
  16. accounts = []
  17.  
  18. class CaptchaEntry(Tk.Frame):
  19.     def __init__(self, master=None):
  20.         Tk.Frame.__init__(self, master)
  21.         self.bind_all(sequence="<KeyPress-Return>",
  22.             func=self.EnterAction)
  23.         self.grid()
  24.         self.aButton = Tk.Canvas ( self, width=300, height=60)
  25.         global cimage
  26.         im = Image.open(StringIO(cimage))
  27.         tkim = ImageTk.PhotoImage(im)
  28.         self.aButton.create_image(150, 30, image=tkim)
  29.         self.aButton.image = tkim #keep the reference
  30.         self.aButton.grid(row=1,columnspan = 3)
  31.         self.str = Tk.StringVar()
  32.         self.text = Tk.Entry(self,textvariable=self.str,
  33.             width=15,font=("Helvetica", "24"))
  34.         self.text.grid(row=2,column=1)
  35.         self.text.focus_set()
  36.         self.label = Tk.Label(self,text='Press enter after typing')
  37.         self.label.grid(row=3,columnspan=3)
  38.     def EnterAction(self,event):
  39.         global textentry
  40.         textentry = self.str.get()
  41.         self.quit()
  42.  
  43. def GenRandom(len=8, lowercase=1, capitalise=False):
  44.     if lowercase == 1:
  45.         chars = string.lowercase + string.digits
  46.     elif lowercase == 2:
  47.         chars = string.letters + string.digits
  48.     else:
  49.         chars = string.lowercase    
  50.     if capitalise:
  51.         firstletter = choice(string.uppercase)
  52.     else:
  53.         firstletter = choice(string.letters)
  54.     newpasswd = firstletter
  55.     for i in range(len-1):
  56.         newpasswd = newpasswd + choice(chars)
  57.     return newpasswd
  58.  
  59. signup = 0
  60.  
  61. while signup < 3:
  62.    
  63.     signup += 1
  64.  
  65.     u = urlopen("https://twitter.com/signup")
  66.     cookie = u.info()['set-cookie']
  67.     content = u.read()
  68.     u.close()
  69.  
  70.     match = '<script type="text/javascript" src="https://api-secure.recaptcha.net(?P<url>.*?)"></script>'
  71.     m = re.search(match, content)
  72.     if m:
  73.         captchaurl = m.group('url')
  74.         print 'Captcha URL:',captchaurl
  75.     else:
  76.         print 'failed to get captch url'
  77.         sys.exit()
  78.  
  79.     if 'value="Create my account"' not in content:
  80.         print 'Something is wrong with this form'
  81.         sys.exit()
  82.  
  83.     #GET CAPTCHA CHALLENGE
  84.     u = urlopen(Request("https://api-secure.recaptcha.net"+ captchaurl,
  85.         headers={ "Referer" : "https://twitter.com/signup" }))
  86.     capcookie = u.info()['set-cookie']
  87.     capcontent = u.read()
  88.     u.close()
  89.  
  90.  
  91.     match = "challenge : '(?P<c>.*?)',"
  92.     m = re.search(match, capcontent)
  93.     if m:
  94.         challenge = m.group('c')
  95.         print 'Challenge:',challenge
  96.     else:
  97.         print 'failed to get captcha challenge'
  98.         sys.exit()
  99.  
  100.     u = urlopen(Request('https://api-secure.recaptcha.net/image?c='+challenge,
  101.         headers={"Cookie" : capcookie, "Referer" : "https://twitter.com/signup" } ))
  102.     cimage = u.read()
  103.     u.close()
  104.  
  105.     textentry = ''
  106.     app = CaptchaEntry()
  107.     app.master.title("DO EEET!!!111oneone1")
  108.     app.mainloop()
  109.     app.quit()
  110.     app.destroy()
  111.  
  112.     #FILL THE FORM, first authenticity_token
  113.     match = "twttr.form_authenticity_token = '(?P<token>.*?)';"
  114.     m = re.search(match, content)
  115.     if m:
  116.         authtoken = m.group('token')
  117.         print 'authenticity_token:',captchaurl
  118.     else:
  119.         print 'failed to get authenticity_token'
  120.         sys.exit()
  121.  
  122.     username = GenRandom(randint(10, 15), 1, False)
  123.     fullname = GenRandom(randint(7, 10), 3, True) + ' ' + GenRandom(randint(7, 10), 3, True)
  124.     password = GenRandom(randint(7, 10), 2, False)
  125.  
  126.     email = GenRandom(randint(7, 10), 2, False) + '@mailinator.com'
  127.  
  128.     postdata = 'authenticity_token=' + authtoken
  129.     postdata += '&follow=&user%5Bname%5D=' + fullname
  130.     postdata += '&user%5Bscreen_name%5D=' + username
  131.     postdata += '&user%5Buser_password%5D=' + password
  132.     postdata += '&user%5Bemail%5D=' + email
  133.     postdata += '&user%5Bsend_email_newsletter%5D=0'
  134.     postdata += '&recaptcha_challenge_field=' + challenge
  135.     postdata += '&recaptcha_response_field=' + textentry
  136.  
  137.     u = urlopen(Request("https://twitter.com/account/create", data = postdata,
  138.         headers={ "Cookie" : cookie, "Referer" : "https://twitter.com/signup" }))
  139.     response = u.read()
  140.     u.close()
  141.  
  142.     print 'username', username
  143.     print 'fullname', fullname
  144.     print 'password', password
  145.     print 'email', email
  146.  
  147.     if 'Please try to match the 2 words shown above, or try the audio version.' in response:
  148.         print "\nCaptcha is not accepted"
  149.         raw_input()
  150.         sys.exit()
  151.  
  152.     if "By clicking on 'Create my account' above, you confirm that you accept" in response:
  153.         print "\nFail. Run the application again."
  154.         raw_input()
  155.         sys.exit()
  156.  
  157.     if "You can't do that right now." in response:
  158.         print "\nTwitter says: You can't do that right now. Probably your IP got banned. Change it or wait a while for it to be unlocked."
  159.         raw_input()
  160.         sys.exit()
  161.  
  162.     print 'Seems ok, account created.'
  163.  
  164.     accounts.append([username, password])
  165.  
  166. # ==============================
  167.  
  168. log = ""
  169.  
  170. for a in accounts:
  171.     log += "Username: " + a[0] + " Password: " + a[1] + "\n"
  172.  
  173. if (isfile('log.txt')):
  174.     file = open('log.txt', 'a')
  175. else:
  176.     file = open('log.txt', 'w')
  177. file.write(log)
  178. file.close()
  179.  
  180. timer = 15
  181. useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20091204 Firefox/3.5.0.1"
  182. url = 'http://www.twitter.com/statuses/update.xml'
  183.  
  184. phrases = ["", "eBaum's World", "", "God bless America", "", "some stay dry and others feel the pain", "", "Has anyone really been far even as decided to use even go want to do look more like?", "", "", "nigger", "aids", "cancer", "gorilla", "faggot", "penis", "vagina", "asshole","butthurt", "koran", "islam", "basement", "retard", "", "", "", "Merkel", "listening to", "movie","happy hour", "love", "hate", "virgin", "lulz", "nazi", "Hitler", "negro", "anime", "manga","pooper", "sex", "anal","Fritzl", "", "", "", ""]
  185.  
  186. cnt = 0;
  187.  
  188. while(1):
  189.  
  190.     status = '#gorillapenis ' + phrases[randint(0,len(phrases)-1)] + ' ' + phrases[randint(0,len(phrases)-1)]
  191.     quote_plus(status)
  192.  
  193.     rand = randint(0, len(accounts)-1)
  194.     username = accounts[rand][0]
  195.     password = accounts[rand][1]
  196.  
  197.     req = Request(url, data = 'status='+status)
  198.     req.add_header('User-Agent', useragent)
  199.  
  200.     auth = HTTPPasswordMgrWithDefaultRealm()
  201.     auth.add_password(None, url, username, password)
  202.  
  203.     handle = HTTPBasicAuthHandler(auth)
  204.  
  205.     opener = build_opener(handle)
  206.     install_opener(opener)
  207.  
  208.     u = urlopen(req)
  209.     try:
  210.         response = u.read()
  211.     except HTTPError, e:
  212.         print "Fucking shit, error", e.code
  213.     else:
  214.         cnt += 1
  215.         print "Tweet sent as", username, ", altogether", str(cnt), "tweets sent"
  216.     if cnt > 140:
  217.         print "Holy shit, your IP might get blocked soon. You'd better change it!"
  218.  
  219.     sleep(timer)
  220.  
Add Comment
Please, Sign In to add comment