irc_spambot.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import socks, requests
  2. import socket
  3. from concurrent.futures import ThreadPoolExecutor
  4. from irc.bot import SingleServerIRCBot
  5. import irc.client
  6. from threading import local, Thread
  7. import secrets, string, time
  8. def randomString(string_length):
  9. input = string.ascii_lowercase + string.digits
  10. return ''.join(secrets.choice(input) for i in range(string_length))
  11. class ProxySocket:
  12. def __init__(self, ip, port, user_, pass_):
  13. socket.setdefaulttimeout(300)
  14. socks.set_default_proxy(socks.SOCKS5, ip, port, username=user_, password=pass_)
  15. socks.wrap_module(irc.client)
  16. class TestBot(SingleServerIRCBot):
  17. def __init__(self, server_list, nickname, realname):
  18. super().__init__(server_list, nickname, realname)
  19. # def on_privmsg(self, connection, event):
  20. # print(event)
  21. def on_welcome(self, connection, event):
  22. print(event.arguments)
  23. print("Connected")
  24. # connection.join("#lmao")
  25. connection.join("#hebits.support")
  26. for x in range(5):
  27. connection.privmsg_many(["HeBoT", "SithLord", "lolol", "RL309AFK", "Mongol"], "מנהל")
  28. # connection.disconnect()
  29. self.die()
  30. class ProxyBot:
  31. def __init__(self, proxy, server_ip, server_port, nickname, realname):
  32. self.proxy = ProxySocket(*proxy)
  33. self.server_ip = server_ip
  34. self.server_port = server_port
  35. self.nickname = nickname
  36. self.realname = realname
  37. # TestBot((self.server_ip, self.server_port), self.nickname, self.realname).start()
  38. bot = TestBot([(self.server_ip, self.server_port)], self.nickname, self.realname)
  39. bot.start()
  40. # bot = TestBot(self.server_ip, self.server_port, self.nickname, self.realname)
  41. # bot.start()
  42. def start(self):
  43. # None
  44. print(self.proxy, self.server_ip, self.server_port, self.nickname, self.realname)
  45. while True:
  46. try:
  47. bot = TestBot(self.proxy, self.server_ip, self.server_port, self.nickname, self.realname)
  48. bot.start()
  49. break
  50. except:
  51. print("Error creating or running the bot. Retrying...")
  52. self.proxy = ProxySocket(*proxy) # Reconnect the proxy
  53. ##WORKS BUT UNUSEDget_proxies = requests.get("http://list.rola.vip:8088/user_get_ip_list?token=****&qty=42&time=5&country=ir&format=txt&protocol=socks5&filter=0").text
  54. # with open("proxies.txt", 'r') as f:
  55. # get_proxies = f.read()
  56. ###proxies = get_proxies.split("\n"); del get_proxies
  57. def do_bot():
  58. irc_server, irc_port = "irc.hebits.net", 6667
  59. # irc_server, irc_port = "irc.freenode.net", 6667
  60. # prox, port = secrets.choice(proxies).split(":")
  61. # proxy = (prox, int(port), None, None)
  62. proxy = (socket.gethostbyname("geo.iproyal.com"), int(32325), "","lo_session-"+randomString(5))
  63. # proxy = (socket.gethostbyname("geo.iproyal.com"), int(32325), "*o","l*o_country-ir_session-"+randomString(5)+"")
  64. nickname, realname = randomString(5)+"", randomString(5)
  65. bot = ProxyBot(
  66. proxy, irc_server, irc_port, nickname, realname)
  67. bot.start()
  68. def do_thread():
  69. while True:
  70. try:
  71. a = do_bot()
  72. # del a
  73. except:
  74. raise
  75. print("hey")
  76. for x in range(3):
  77. Thread(target=do_thread).start()
  78. ##_UnbanTOT900TWO
  79. # with ThreadPoolExecutor(max_workers=20) as e:
  80. # e.map(do_bot, range(100))