Skip to main content

Overview

Miku Miku Beam’s architecture makes it easy to add new attack methods. This guide walks you through creating a custom attack implementation from scratch.

Attack Method Architecture

Each attack method consists of:
  • A worker that implements the AttackWorker interface
  • Registration in the engine’s registry
  • Frontend integration for the web UI (optional)

Implementation Steps

1

Create Attack Worker

Create a new file in the appropriate directory under internal/attacks/:
  • HTTP-based attacks → internal/attacks/http/
  • TCP/UDP attacks → internal/attacks/tcp/
  • Game-specific attacks → internal/attacks/game/
  • New protocol → Create new directory internal/attacks/yourprotocol/

Worker Interface

All attack workers must implement the AttackWorker interface:

Example Implementation

Here’s a complete example from the actual codebase:
internal/attacks/yourprotocol/yourattack.go
2

Define Attack Kind

Add your attack type to the AttackKind enum in internal/engine/engine.go:
internal/engine/engine.go
3

Register the Attack

Register your worker in the engine’s initialization code.For the server (cmd/mmb-server/main.go):
cmd/mmb-server/main.go
For the CLI (cmd/mmb-cli/main.go):
cmd/mmb-cli/main.go
4

Add to Web Client (Optional)

Update the web client to include your new attack method in the dropdown:
web-client/src/...

Real-World Examples

Let’s look at actual implementations from the codebase:

HTTP Flood Worker

From internal/attacks/http/flood.go:
Notice how the worker:
  • Uses the provided context for cancellation support
  • Leverages the proxy parameter for routing
  • Sends verbose logs only when enabled
  • Returns quickly without blocking

TCP Flood Worker

From internal/attacks/tcp/flood.go:

Best Practices

Context Handling

Always respect the context! The engine uses it to cancel attacks.

Proxy Usage

Always use the provided proxy parameter:

Verbose Logging

Only send logs when verbose mode is enabled:

Error Handling

Testing Your Attack

Build and Test

Test Without Proxies

Test in Web Interface

  1. Start the server: make run-server
  2. Open http://localhost:3000
  3. Select your attack method
  4. Configure parameters
  5. Monitor real-time stats

Attack Parameters Reference

Your worker receives these parameters:

Common Patterns

HTTP-Based Attacks

TCP-Based Attacks

UDP-Based Attacks

Troubleshooting

Make sure you’ve:
  1. Defined the AttackKind constant
  2. Registered the worker in cmd/mmb-cli/main.go
  3. Rebuilt the CLI binary: make cli
Check that you’ve:
  1. Added it to the attack methods array in the web client
  2. Registered it in cmd/mmb-server/main.go
  3. Rebuilt both server and web client: make all
  • Verify proxies in data/proxies.txt are valid
  • Test with --no-proxy flag to isolate the issue
  • Use netutil helpers instead of direct connections
  • Ensure you’re calling SendAttackLogIfVerbose
  • Check you’re passing the log channel correctly
  • Verify --verbose flag is set when testing

Next Steps

Project Structure

Understand the full codebase organization

Contributing Guide

Learn how to submit your implementation

Now you’re ready to create powerful new attack methods! Remember to test thoroughly and submit a PR when you’re done.