Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Environment Configuration
NODE_ENV=development

# Server Configuration
PORT=3000
HOSTNAME=0.0.0.0

# Security
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
CORS_ORIGIN=http://localhost:5173

# Redis Configuration (for production)
REDIS_URL=redis://localhost:6379
REDIS_PASSWORD=

# Logging
LOG_LEVEL=info
LOG_FORMAT=json

# Attack Configuration
MAX_ATTACK_DURATION=3600
MAX_PACKET_SIZE=65535
MIN_PACKET_DELAY=100

# Worker Configuration
WORKER_TIMEOUT=30000
MAX_WORKERS=10

# SSL Configuration (for production)
SSL_CERT_PATH=./ssl/cert.pem
SSL_KEY_PATH=./ssl/key.pem
SSL_ENABLED=false
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,65 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Dependencies
node_modules
dist
dist-ssr
*.local

# Environment variables
.env
.env.local
.env.production
.env.staging

# Testing
coverage
.nyc_output
test-results
playwright-report
playwright/.cache

# Build outputs
build
out
.next
.nuxt
.vuepress/dist

# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# OS generated files
Thumbs.db
ehthumbs.db
Desktop.ini

# SSL certificates
ssl/
*.pem
*.key
*.crt

# Data files (keep structure but ignore content)
data/*.txt
!data/.gitkeep

# Docker
.dockerignore

# Temporary files
*.tmp
*.temp
.cache
60 changes: 48 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,59 @@
# Use the official Node.js v20 image as a base
FROM node:20
# Multi-stage build for production
FROM node:20-alpine AS base

# Set the working directory
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Copy package.json
COPY package*.json ./
# Install dependencies based on the preferred package manager
COPY package.json package-lock.json* ./
RUN npm ci --only=production && npm cache clean --force

# Install dependencies using bun
RUN npm install

# Copy the rest of the source code
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Build the project and output to the ./dist directory
# Build the application
RUN npm run build

# Expose the port the app runs on (adjust if necessary)
# Production image, copy all the files and run the app
FROM base AS runner
WORKDIR /app

ENV NODE_ENV=production
ENV PORT=3000

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Copy the public folder
COPY --from=builder /app/dist/public ./dist/public

# Copy the server build
COPY --from=builder /app/dist/server ./dist/server

# Copy package.json for start script
COPY package.json ./

# Copy only production dependencies
COPY --from=deps /app/node_modules ./node_modules

# Create data directory and set permissions
RUN mkdir -p data && chown -R nextjs:nodejs data

USER nextjs

EXPOSE 3000

# Run the application
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"

CMD ["npm", "run", "start"]
145 changes: 132 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,58 @@ A fun and visually appealing stress testing server with a **Miku-themed** fronte

![Screenshot](docs/screenshot.png)

## ✨ What's New in v1.0.0

- 🔒 **Enhanced Security**: Added Helmet.js, CORS protection, and rate limiting
- 🚀 **Performance Improvements**: Multi-stage Docker builds, compression, and caching
- 🧪 **Testing Framework**: Integrated Vitest with comprehensive test setup
- 📊 **Better Monitoring**: Health checks, structured logging, and error handling
- 🐳 **Production Ready**: Optimized Docker setup with Nginx reverse proxy
- 🔧 **Developer Experience**: Improved TypeScript config, ESLint rules, and build process

## Features 🎉

- 🐳 **Docker Ready**: MMB is ready to be built and run in a Docker container.
- 🌐 **Real-time Attack Visualization**: View your attacks progress and statistics in real-time as it runs. 🔥
- 🎶 **Miku-themed UI**: A cute and vibrant design with Mikus vibe to make the process more fun. Includes a banger song to keep you pumped! 🎧
- 🐳 **Docker Ready**: MMB is ready to be built and run in a Docker container with production-grade setup.
- 🌐 **Real-time Attack Visualization**: View your attack's progress and statistics in real-time as it runs. 🔥
- 🎶 **Miku-themed UI**: A cute and vibrant design with Miku's vibe to make the process more fun. Includes a banger song to keep you pumped! 🎧
- 🧑‍💻 **Configurable Attack Parameters**: Easily set the attack method, packet size, duration, and packet delay via the frontend interface.
- 🛠️ **Worker-Based Attack Handling**: The server processes attacks in separate workers for optimal performance and scalability.
- 📊 **Live Stats**: Track the success and failure of each attack in real-time. See how many packets are sent and whether they succeed or fail.
- 🖼️ **Aesthetic Design**: A visually cute interface to make your experience enjoyable. 🌸
- 📡 **Attack Methods:**:
- 🔒 **Security Features**: Rate limiting, CORS protection, security headers, and input validation.
- 📡 **Attack Methods**:
- `HTTP Flood` - Send random HTTP requests
- `HTTP Bypass` - Send HTTP requests that mimics real requests (Redirects, cookies, headers, resources...)
- `HTTP Slowloris` - Send HTTP requests and keep the connection open
- `Minecraft Ping` - Send Minecraft ping/motd requests
- `TCP Flood` - Send random TCP packets

## Setup 🛠️
## 🚀 Quick Start

### Using Docker (Recommended)

```bash
# Clone the repository
git clone https://github.com/sammwyy/mikumikubeam.git
cd mikumikubeam

# Start with Docker Compose
docker-compose up -d

### Prerequisites 📦
# Access the application
# Frontend: http://localhost
# API: http://localhost/api
```

### Manual Setup

Make sure you have the following installed:
#### Prerequisites 📦

- Node.js (v14 or above) 🌱
- Node.js (v18 or above) 🌱
- npm (Node Package Manager) 📦
- Redis (for production)

### Development Mode 🔧
#### Development Mode 🔧

1. Clone this repository:

Expand Down Expand Up @@ -57,9 +83,16 @@ Make sure you have the following installed:
- The **frontend** runs on `http://localhost:5173`.
- The **backend** runs on `http://localhost:3000`.

5. Run tests:

```bash
npm run test
npm run test:ui
```

---

### Production Mode 💥
#### Production Mode 💥

1. Clone the repository and navigate to the project directory:

Expand Down Expand Up @@ -90,6 +123,76 @@ Make sure you have the following installed:

> Don't forget to add the necessary files `data/proxies.txt` and `data/uas.txt`.

## 🧪 Testing

The project includes a comprehensive testing setup with Vitest:

```bash
# Run tests
npm run test

# Run tests with UI
npm run test:ui

# Type checking
npm run type-check

# Linting
npm run lint
npm run lint:fix
```

## 🔧 Development Scripts

```bash
npm run dev # Start development server (client + server)
npm run dev:client # Start only client development server
npm run dev:server # Start only server development server
npm run build # Build for production
npm run preview # Preview production build
npm run clean # Clean build artifacts
npm run start # Start production server
```

## 🐳 Docker Deployment

### Production Deployment

```bash
# Build and start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down
```

### Custom Configuration

The Docker setup includes:
- **Multi-stage builds** for optimized image size
- **Nginx reverse proxy** with SSL support
- **Redis** for caching and session storage
- **Health checks** and automatic restarts
- **Volume persistence** for data and logs

## 📊 Monitoring & Health

- **Health Check**: `GET /health`
- **Real-time Logs**: Structured logging with timestamps
- **Performance Metrics**: Built-in monitoring endpoints
- **Error Tracking**: Comprehensive error handling and reporting

## 🔒 Security Features

- **Rate Limiting**: Configurable request limits per IP
- **CORS Protection**: Cross-origin request validation
- **Security Headers**: Helmet.js integration
- **Input Validation**: Request parameter sanitization
- **Worker Isolation**: Attack processes run in isolated threads

## Usage ⚙️

Once the server is up and running, you can interact with it via the frontend:
Expand All @@ -115,14 +218,22 @@ Once the server is up and running, you can interact with it via the frontend:

## Adding Proxies and User-Agents

Access to the ``data/proxies.txt`` and ``data/uas.txt`` can now be done fully in the frontend. Click the text button to the right of the beam button to open up the editor.
Access to the `data/proxies.txt` and `data/uas.txt` can now be done fully in the frontend. Click the text button to the right of the beam button to open up the editor.

![AnnotatedImage](docs/annotated-button.png)

## Worker-Based Attack Handling 🔧💡

Each attack type is handled in a separate worker thread, ensuring that the main server remains responsive. The attack workers are dynamically loaded based on the selected attack method (HTTP, etc...).

## 🚀 Performance Optimizations

- **Multi-stage Docker builds** for smaller production images
- **Gzip compression** for static assets
- **Browser caching** with appropriate cache headers
- **Worker thread isolation** for attack processing
- **Connection pooling** and keep-alive optimization

## To-Do 📝

- Add more attack methods:
Expand All @@ -132,6 +243,10 @@ Each attack type is handled in a separate worker thread, ensuring that the main

- Enhance attack statistics and reporting for better real-time monitoring. 📊

- Add authentication and user management system
- Implement attack scheduling and automation
- Add more visualization options and charts

## Contributing 💖

Feel free to fork the repo and open pull requests with new attack protocols, bug fixes, or improvements. If you have an idea for a new feature, please share it! 😄
Expand Down Expand Up @@ -170,9 +285,9 @@ const attackHandlers = {

> Try running two terminals instead of one, in the first one use "npm run dev:client", and in the other one "npm run dev:server". (This happened to several people with Windows 11)

**3. I go to "<http://localhost:3000>" and nothing appears.**
**3. I go to "http://localhost:3000" and nothing appears.**

> Port `3000` is the server port, to see the UI you must use port `5173` (<http://localhost:5173>)
> Port `3000` is the server port, to see the UI you must use port `5173` (http://localhost:5173)

**4. Requests fail to be sent to the target server (Read timeout and variations)**

Expand All @@ -183,6 +298,10 @@ const attackHandlers = {
> - `host:port` (Uses http as default protocol)
> - `host` (Uses 8080 as default port)

**5. How do I enable HTTPS in production?**

> The Docker setup includes Nginx with SSL support. Place your SSL certificates in the `ssl/` directory and update the `nginx.conf` file with your domain.

---

## License 📝
Expand Down
Loading