import { Bot, ScrollText, Wand2, Wifi, Zap } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import { io } from "socket.io-client"; function isHostLocal(host: string) { return ( host === "localhost" || host === "127.0.0.1" || host.startsWith("::1") || host.startsWith("192.168") || host.startsWith("10.") || host.startsWith("172.") ); } function getSocketURL() { const host = window.location.host.split(":")[0]; const isLocal = isHostLocal(host); const socketURL = isLocal ? `http://${host}:3000` : "/"; return socketURL; } const socket = io(getSocketURL()); function ConfigureProxiesAndAgentsView() { const [loadingConfiguration, setLoadingConfiguration] = useState(false); const [configuration, setConfiguration] = useState([]); async function retrieveConfiguration(): Promise { const response = await fetch(`http://localhost:3000/configuration`); const information = (await response.json()) as { proxies: string; uas: string; }; const proxies = atob(information.proxies); const uas = atob(information.uas); return [proxies, uas]; } useEffect(() => { if (!loadingConfiguration) { setLoadingConfiguration(true); retrieveConfiguration().then((config) => { setLoadingConfiguration(false); setConfiguration(config); }); } }, []); function saveConfiguration() { const obj = { proxies: btoa(configuration[0]), uas: btoa(configuration[1]), }; // console.log(obj) const response = fetch(`http://localhost:3000/configuration`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(obj), }); response.then(() => { alert("Saved"); window.location.reload(); }); } return (
{loadingConfiguration ? (

Loading proxies.txt and uas.txt...

) : (

proxies.txt

uas.txt

)}
); } function App() { const [isAttacking, setIsAttacking] = useState(false); const [actuallyAttacking, setActuallyAttacking] = useState(false); const [animState, setAnimState] = useState(0); const [logs, setLogs] = useState([]); const [progress, setProgress] = useState(0); const [target, setTarget] = useState(""); const [attackMethod, setAttackMethod] = useState("http_flood"); const [packetSize, setPacketSize] = useState(64); const [duration, setDuration] = useState(60); const [packetDelay, setPacketDelay] = useState(100); const [stats, setStats] = useState({ pps: 0, bots: 0, totalPackets: 0, }); const [lastUpdatedPPS, setLastUpdatedPPS] = useState(Date.now()); const [lastTotalPackets, setLastTotalPackets] = useState(0); const [currentTask, setCurrentTask] = useState(null); const [audioVol, setAudioVol] = useState(100); const [openedConfig, setOpenedConfig] = useState(false); const audioRef = useRef(null); useEffect(() => { if (audioRef.current) { const audio = audioRef.current; const handler = () => { if (audio.paused) return; if ( animState !== 2 && audio.currentTime > 5.24 && audio.currentTime < 9.4 ) { setAnimState(2); } if (audio.currentTime > 17.53) { audio.currentTime = 15.86; } }; audio.addEventListener("timeupdate", handler); return () => { audio.removeEventListener("timeupdate", handler); }; } }, [audioRef]); useEffect(() => { if (!isAttacking) { setActuallyAttacking(false); setAnimState(0); const audio = audioRef.current; if (audio) { audio.pause(); audio.currentTime = 0; } if (currentTask) { clearTimeout(currentTask); } } }, [isAttacking, currentTask]); useEffect(() => { const now = Date.now(); if (now - lastUpdatedPPS >= 500) { setLastUpdatedPPS(now); setStats((old) => ({ pps: (old.totalPackets - lastTotalPackets) / (now - lastUpdatedPPS), bots: old.bots, totalPackets: old.totalPackets, })); setLastTotalPackets(stats.totalPackets); } }, [lastUpdatedPPS, lastTotalPackets, stats.totalPackets]); useEffect(() => { socket.on("stats", (data) => { setStats((old) => ({ pps: data.pps || old.pps, bots: data.bots || old.bots, totalPackets: data.totalPackets || old.totalPackets, })); if (data.log) addLog(data.log); setProgress((prev) => (prev + 10) % 100); }); socket.on("attackEnd", () => { setIsAttacking(false); }); return () => { socket.off("stats"); socket.off("attackEnd"); }; }, []); useEffect(() => { if (audioRef.current) { audioRef.current.volume = audioVol / 100; } }, [audioVol]); const addLog = (message: string) => { setLogs((prev) => [message, ...prev].slice(0, 12)); }; const startAttack = (isQuick?: boolean) => { if (!target.trim()) { alert("Please enter a target!"); return; } setIsAttacking(true); setStats((old) => ({ pps: 0, bots: old.bots, totalPackets: 0, })); addLog("🍮 Preparing attack..."); // Play audio if (audioRef.current) { audioRef.current.currentTime = isQuick ? 9.5 : 0; audioRef.current.volume = audioVol / 100; audioRef.current.play(); } if (!isQuick) setAnimState(1); // Start attack after audio intro const timeout = setTimeout( () => { setActuallyAttacking(true); setAnimState(3); socket.emit("startAttack", { target, packetSize, duration, packetDelay, attackMethod, }); }, isQuick ? 700 : 10250 ); setCurrentTask(timeout); }; const stopAttack = () => { socket.emit("stopAttack"); setIsAttacking(false); }; return (