Skip to main content
Mole presenting file transfer

File Transfer

Upload and download files and directories to/from remote agents.

Configuration

file_transfer:
enabled: true
max_file_size: 0 # 0 = unlimited
allowed_paths:
- /tmp
- /home/user/uploads
password_hash: "" # bcrypt hash (generate with: muti-metroo hash)
Generate Password Hash

Use the built-in CLI to generate bcrypt hashes: muti-metroo hash --cost 12

See CLI - hash for details.

CLI Usage

Upload File

muti-metroo upload <agent-id> <local-path> <remote-path>

# Example
muti-metroo upload abc123 ./data.bin /tmp/data.bin

Upload Directory

muti-metroo upload abc123 ./mydir /tmp/mydir

Download File

muti-metroo download <agent-id> <remote-path> <local-path>

# Example
muti-metroo download abc123 /etc/config.yaml ./config.yaml

With Authentication

muti-metroo upload -p password abc123 ./file.txt /tmp/file.txt

HTTP API

Upload

POST /agents/{agent-id}/file/upload

Multipart form data:

  • file: File to upload
  • path: Remote destination path
  • password: Auth password (optional)
  • directory: "true" if directory tar

Download

POST /agents/{agent-id}/file/download

Request:

{
"password": "secret",
"path": "/tmp/file.txt"
}

Response: Binary file data

Implementation Details

  • Streaming: Files transferred in 16KB chunks
  • No size limits: Stream directly without memory buffering
  • Directories: Automatically tar/gzip with permission preservation
  • Authentication: bcrypt password hashing
  • Permissions: File mode preserved (Unix)

Security

Access control via:

  1. allowed_paths: Only allow uploads to specific directories
  2. password_hash: Require password for all transfers
  3. enabled flag: Disable completely if not needed