> ## 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.

# Configuration

> Configure Miku Miku Beam settings, proxies, and user agents

## Overview

Miku Miku Beam uses TOML configuration files to manage settings, proxy lists, and user agent strings. Configuration can be specified via the `--config` flag or by using default values.

## Configuration File

Create a TOML file with your preferred settings:

```toml config.toml theme={null}
proxies_file = "data/proxies.txt"
user_agents_file = "data/uas.txt"
server_port = 3000
allowed_origin = "http://localhost:5173"
```

### Configuration Options

<ParamField path="proxies_file" type="string" default="data/proxies.txt">
  Path to the file containing proxy server addresses. Can be absolute or relative to the working directory.
</ParamField>

<ParamField path="user_agents_file" type="string" default="data/uas.txt">
  Path to the file containing user agent strings for HTTP attacks. One user agent per line.
</ParamField>

<ParamField path="server_port" type="int" default="3000">
  Port number for the web server to listen on. Only used by `mmb-server`.
</ParamField>

<ParamField path="allowed_origin" type="string" default="http://localhost:5173">
  CORS allowed origin for the web API. Set to your frontend URL for development or production deployment.
</ParamField>

## Using Configuration Files

### CLI Usage

Specify a configuration file when running attacks:

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

### Server Usage

The server automatically looks for a configuration file. You can specify a custom path programmatically, but the binary currently uses default config loading.

<Info>
  If no configuration file is specified or the file is not found, Miku Miku Beam uses default values.
</Info>

## Proxy Configuration

Proxies are essential for distributed attacks and IP protection. Configure them in a text file specified by `proxies_file`.

### Proxy File Format

The proxy file (`data/proxies.txt` by default) contains one proxy per line:

```txt data/proxies.txt theme={null}
# HTTP/HTTPS proxies
http://1.2.3.4:8080
https://5.6.7.8:8443

# SOCKS proxies
socks4://10.20.30.40:1080
socks5://50.60.70.80:1080

# Authenticated proxies
http://username:password@1.2.3.4:8080
socks5://user:pass@5.6.7.8:1080

# Without protocol (defaults to http)
192.168.1.100:8080
```

### Proxy Format Rules

<Steps>
  <Step title="Protocol">
    Supported protocols: `http`, `https`, `socks4`, `socks5`

    If no protocol is specified, `http` is assumed.
  </Step>

  <Step title="Authentication">
    Format: `protocol://username:password@host:port`

    Username and password are optional.
  </Step>

  <Step title="Host and Port">
    Format: `host:port`

    If port is omitted, defaults to `8080`.
  </Step>

  <Step title="Comments">
    Lines starting with `#` are ignored.

    Empty lines are also ignored.
  </Step>
</Steps>

### Proxy Filtering by Attack Method

Different attack methods support different proxy protocols:

<AccordionGroup>
  <Accordion title="http_flood">
    **Supported protocols:** HTTP, HTTPS, SOCKS4, SOCKS5

    All proxy types work with standard HTTP flood attacks.
  </Accordion>

  <Accordion title="http_bypass">
    **Supported protocols:** HTTP, HTTPS, SOCKS4, SOCKS5

    All proxy types work with HTTP bypass attacks.
  </Accordion>

  <Accordion title="http_slowloris">
    **Supported protocols:** SOCKS4, SOCKS5 only

    Slowloris requires SOCKS proxies for persistent connections.
  </Accordion>

  <Accordion title="tcp_flood">
    **Supported protocols:** SOCKS4, SOCKS5 only

    TCP-level attacks require SOCKS proxies.
  </Accordion>

  <Accordion title="minecraft_ping">
    **Supported protocols:** SOCKS4, SOCKS5 only

    Minecraft attacks require SOCKS proxies.
  </Accordion>
</AccordionGroup>

<Info>
  Miku Miku Beam automatically filters proxies based on the selected attack method. Incompatible proxies are silently ignored.
</Info>

### Example Proxy Configurations

<CodeGroup>
  ```txt Free Public Proxies theme={null}
  # Warning: Public proxies are often slow and unreliable
  http://51.158.68.68:8811
  http://103.81.85.129:3128
  socks4://103.127.1.130:80
  socks5://192.111.130.5:17002
  ```

  ```txt Private Proxies theme={null}
  # Authenticated datacenter proxies
  http://user123:pass456@proxy1.example.com:8080
  http://user123:pass456@proxy2.example.com:8080
  socks5://user123:pass456@proxy3.example.com:1080
  ```

  ```txt Mixed Configuration theme={null}
  # HTTP proxies for web attacks
  http://1.2.3.4:8080
  http://5.6.7.8:3128

  # SOCKS proxies for all attack types
  socks4://10.20.30.40:1080
  socks5://50.60.70.80:1080
  socks5://admin:secret@60.70.80.90:1080
  ```
</CodeGroup>

## User Agent Configuration

User agent strings randomize HTTP requests to avoid detection. Configure them in the file specified by `user_agents_file`.

### User Agent File Format

The user agent file (`data/uas.txt` by default) contains one user agent per line:

```txt data/uas.txt theme={null}
# Modern browsers
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0

# Mobile browsers
Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1
Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.144 Mobile Safari/537.36

# Other clients
curl/8.1.2
Python-urllib/3.11
```

### User Agent Best Practices

<CardGroup cols={2}>
  <Card title="Use Recent Versions" icon="clock">
    Keep user agents up-to-date with current browser versions
  </Card>

  <Card title="Mix Desktop & Mobile" icon="mobile">
    Include both desktop and mobile user agents for variety
  </Card>

  <Card title="Avoid Rare Strings" icon="eye-slash">
    Stick to common browsers to blend in with normal traffic
  </Card>

  <Card title="Add Custom Agents" icon="code">
    Include API clients or tools relevant to your testing
  </Card>
</CardGroup>

## Path Resolution

Paths in the configuration file can be absolute or relative:

<Tabs>
  <Tab title="Relative Paths">
    Relative to the current working directory:

    ```toml theme={null}
    proxies_file = "data/proxies.txt"
    user_agents_file = "data/uas.txt"
    ```

    If you run `mmb` from `/home/user/mmb`, it will look for `/home/user/mmb/data/proxies.txt`.
  </Tab>

  <Tab title="Absolute Paths">
    Specify full paths for flexibility:

    ```toml theme={null}
    proxies_file = "/etc/mmb/proxies.txt"
    user_agents_file = "/etc/mmb/uas.txt"
    ```

    Works regardless of working directory.
  </Tab>
</Tabs>

## Server Configuration

### Port Configuration

Change the web server port:

```toml theme={null}
server_port = 8080
```

Then access the web interface at `http://localhost:8080`.

### Allowed Origin

Configure CORS for frontend development:

```toml theme={null}
allowed_origin = "http://localhost:5173"
```

For production, set this to your deployed frontend URL:

```toml theme={null}
allowed_origin = "https://mmb.example.com"
```

<Warning>
  Never use `allowed_origin = "*"` in production. This allows any website to make requests to your attack server.
</Warning>

## Complete Configuration Example

```toml config.toml theme={null}
# Miku Miku Beam Configuration

# Proxy configuration
proxies_file = "data/proxies.txt"

# User agent configuration
user_agents_file = "data/uas.txt"

# Web server settings
server_port = 3000
allowed_origin = "http://localhost:5173"
```

With corresponding data files:

<CodeGroup>
  ```txt data/proxies.txt theme={null}
  # HTTP proxies
  http://1.2.3.4:8080
  http://5.6.7.8:3128

  # SOCKS proxies
  socks4://10.20.30.40:1080
  socks5://user:pass@50.60.70.80:1080
  ```

  ```txt data/uas.txt theme={null}
  # Desktop browsers
  Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
  Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0

  # Mobile browsers
  Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1
  Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.144 Mobile Safari/537.36
  ```
</CodeGroup>

## Environment Variables

Some settings can be controlled via environment variables:

<ParamField path="LOG_FORMAT" type="string" default="console">
  Server log format. Set to `json` for structured logs.

  ```bash theme={null}
  LOG_FORMAT=json ./bin/mmb-server
  ```
</ParamField>

<ParamField path="ALLOW_NO_PROXY" type="boolean" default="false">
  Allow server to run attacks without proxies.

  ```bash theme={null}
  ALLOW_NO_PROXY=true ./bin/mmb-server
  ```
</ParamField>

## Default Values

If no configuration file is provided, Miku Miku Beam uses these defaults:

```toml theme={null}
proxies_file = "data/proxies.txt"
user_agents_file = "data/uas.txt"
server_port = 3000
allowed_origin = "http://localhost:5173"
```

## Troubleshooting

### Configuration File Not Found

If you specify `--config` but the file doesn't exist, Miku Miku Beam falls back to default values. No error is raised.

### Proxy File Missing

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

**Solution:** Create the proxy file or use `--no-proxy` flag.

### Invalid Proxy Format

Badly formatted proxies are silently skipped. Check your proxy file if you see fewer proxies than expected:

```bash theme={null}
# Check loaded proxy count
mmb attack http_flood http://example.com
# Output: Starting http_flood against http://example.com with 150 proxies
```

### User Agent File Missing

If the user agent file doesn't exist, attacks may proceed with empty or default user agents. This is not fatal but reduces effectiveness.

## Best Practices

<Steps>
  <Step title="Organize Data Files">
    Keep proxy and user agent files in a dedicated `data/` directory:

    ```
    mmb/
    ├── bin/
    │   ├── mmb
    │   └── mmb-server
    ├── data/
    │   ├── proxies.txt
    │   └── uas.txt
    └── config.toml
    ```
  </Step>

  <Step title="Version Control">
    Add data files to `.gitignore` to avoid committing sensitive proxy credentials:

    ```gitignore theme={null}
    data/proxies.txt
    data/uas.txt
    ```
  </Step>

  <Step title="Regular Updates">
    Regularly update your proxy and user agent lists:

    * Remove dead proxies
    * Add new working proxies
    * Update user agents to match current browser versions
  </Step>

  <Step title="Test Configuration">
    Always test with a short attack first:

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