コンテンツにスキップ

Meterpreter

Comprehensive meterpreter commands and usage patterns for efficient workflow management.

Overview

Meterpreter is a powerful tool for various operations and system management. This cheat sheet covers essential commands, configuration options, and best practices.

Installation

Linux/Ubuntu

# Package manager installation
sudo apt update
sudo apt install meterpreter

# Alternative installation
wget -O meterpreter https://github.com/example/meterpreter/releases/latest/download/meterpreter-linux
chmod +x meterpreter
sudo mv meterpreter /usr/local/bin/

macOS

# Homebrew installation
brew install meterpreter

# Manual installation
curl -L -o meterpreter https://github.com/example/meterpreter/releases/latest/download/meterpreter-macos
chmod +x meterpreter
sudo mv meterpreter /usr/local/bin/

Windows

# Chocolatey installation
choco install meterpreter

# Scoop installation
scoop install meterpreter

# Manual installation
# Download from official website and add to PATH

Basic Commands

Command Description
meterpreter --help Display help information
meterpreter --version Show version information
meterpreter init Initialize meterpreter in current directory
meterpreter status Check current status
meterpreter list List available options
meterpreter info Display system information
meterpreter config Show configuration
meterpreter update Update to latest version

Essential Operations

Getting Started

# Initialize meterpreter
meterpreter init

# Basic usage
meterpreter run

# With verbose output
meterpreter --verbose run

# With configuration file
meterpreter --config config.yaml run

Configuration

# View configuration
meterpreter config show

# Set configuration option
meterpreter config set key value

# Get configuration value
meterpreter config get key

# Reset configuration
meterpreter config reset

Advanced Operations

# Debug mode
meterpreter --debug run

# Dry run (preview changes)
meterpreter --dry-run run

# Force operation
meterpreter --force run

# Parallel execution
meterpreter --parallel run

File Operations

Command Description
meterpreter create <file> Create new file
meterpreter read <file> Read file contents
meterpreter update <file> Update existing file
meterpreter delete <file> Delete file
meterpreter copy <src> <dst> Copy file
meterpreter move <src> <dst> Move file

Network Operations

# Connect to remote host
meterpreter connect host:port

# Listen on port
meterpreter listen --port 8080

# Send data
meterpreter send --data "message" --target host

# Receive data
meterpreter receive --port 8080

Security Features

Authentication

# Login with credentials
meterpreter login --user username

# Logout
meterpreter logout

# Change password
meterpreter passwd

# Generate API key
meterpreter generate-key

Encryption

# Encrypt file
meterpreter encrypt file.txt

# Decrypt file
meterpreter decrypt file.txt.enc

# Generate certificate
meterpreter cert generate

# Verify signature
meterpreter verify file.sig

Troubleshooting

Common Issues

Issue: Command not found

# Check if installed
which meterpreter

# Reinstall if necessary
sudo apt reinstall meterpreter

Issue: Permission denied

# Run with sudo
sudo meterpreter command

# Fix permissions
chmod +x /usr/local/bin/meterpreter

Issue: Configuration errors

# Reset configuration
meterpreter config reset

# Validate configuration
meterpreter config validate

Debug Commands

Command Description
meterpreter --debug Enable debug output
meterpreter --verbose Verbose logging
meterpreter test Run self-tests
meterpreter doctor Check system health

Best Practices

Security

  • Always verify checksums when downloading
  • Use strong authentication methods
  • Regularly update to latest version
  • Follow principle of least privilege

Performance

  • Use appropriate buffer sizes
  • Monitor resource usage
  • Optimize configuration for your use case
  • Regular maintenance and cleanup

Maintenance

# Update meterpreter
meterpreter update

# Clean temporary files
meterpreter clean

# Backup configuration
meterpreter backup --config

# Restore from backup
meterpreter restore --config backup.yaml

Integration

Scripting

#!/bin/bash
# Example script using meterpreter

if ! command -v meterpreter &> /dev/null; then
    echo "meterpreter is not installed"
    exit 1
fi

if meterpreter run; then
    echo "Success"
else
    echo "Failed"
    exit 1
fi

API Integration

import subprocess
import json

def run_meterpreter(command):
    try:
        result = subprocess.run(['meterpreter'] + command.split(),
                              capture_output=True, text=True)
        return result.stdout
    except Exception as e:
        print(f"Error: \\\\{e\\\\}")
        return None

Environment Variables

Variable Description Default
METERPRETER_CONFIG Configuration file path ~/.meterpreter/config
METERPRETER_HOME Home directory ~/.meterpreter
METERPRETER_LOG_LEVEL Logging level INFO
METERPRETER_TIMEOUT Operation timeout 30s

Configuration File

# ~/.meterpreter/config.yaml
version: "1.0"
settings:
  debug: false
  timeout: 30
  log_level: "INFO"

network:
  host: "localhost"
  port: 8080
  ssl: true

security:
  auth_required: true
  encryption: "AES256"

Examples

Basic Workflow

# 1. Initialize
meterpreter init

# 2. Configure
meterpreter config set host example.com

# 3. Run operation
meterpreter run

# 4. Check results
meterpreter status

# 5. Cleanup
meterpreter clean

Advanced Workflow

# Comprehensive operation
meterpreter run \
  --config production.yaml \
  --parallel \
  --verbose \
  --timeout 300

# Monitoring
meterpreter monitor \
  --interval 60 \
  --alert-threshold 80

Resources

Official Documentation

Community

Tutorials


Last updated: 2025-07-05