What is Safe Mode?
Safe mode is a protective mechanism in the Exploit Engine that prevents destructive actions during vulnerability exploitation. When enabled, the tool simulates exploitation attempts rather than executing them, providing security insights without risk.Implementation
Default Configuration
Safe mode is initialized inexploit_engine.py:15:
AutoPentestX main class also defaults to safe mode (main.py:30):
Enabling/Disabling
- Safe Mode (Default)
- Unsafe Mode
Safe Mode Behavior
Exploitation Simulation
When safe mode is enabled, thesimulate_exploitation() method prevents actual attacks (exploit_engine.py:187-250):
1
Exploit Identification
Matches vulnerabilities to available Metasploit modules without execution
2
Feasibility Analysis
Determines which exploits would likely succeed based on service versions
3
Resource Script Generation
Creates Metasploit RC scripts for manual validation testing
4
Results Logging
Records what would have happened without executing exploits
What Gets Blocked
In safe mode, these actions are simulated but not executed:- π« Metasploit exploit module execution
- π« Payload delivery to target systems
- π« Shell/session establishment
- π« Post-exploitation activities
- π« File system modifications
- π« Service manipulation or crashes
What Still Happens
Safe mode allows these non-destructive activities:- β Port scanning and enumeration
- β Service banner grabbing
- β Vulnerability detection
- β CVE database queries
- β Risk assessment calculations
- β Report generation
Exploit Execution Logic
Safe Mode Check
Before any exploitation, the engine verifies safe mode status (exploit_engine.py:119-154):
Dangerous Exploit Detection
The exploit database flags potentially destructive exploits (exploit_engine.py:22-53):
Dangerous Exploit Handling
Even in safe mode, extra caution is applied to dangerous exploits (exploit_engine.py:210-219):
Exploits marked as
safe: False are always skipped in safe mode, even if Metasploit is available.Resource Script Generation
Metasploit RC Scripts
For manual validation, safe mode generates Metasploit resource scripts (exploit_engine.py:156-185):
Using RC Scripts
Generated scripts can be used for manual testing in authorized environments:Output Indicators
Console Output
Safe mode status is clearly displayed during execution:Initialization Banner
The startup banner shows safe mode status (main.py:64-68):
Unsafe Mode Risks
When to Consider Disabling
Only disable safe mode when ALL of these conditions are met:1
Written Authorization
You have explicit, written permission from the system owner
2
Isolated Environment
Target is in an isolated lab environment, not connected to production
3
Backup Available
Complete system backups exist and have been tested
4
Downtime Acceptable
Service disruption or system crashes are acceptable
5
Expert Supervision
Experienced security professional is supervising
Potential Consequences
Disabling safe mode can result in:Unsafe Mode Behavior
When disabled (--no-safe-mode), the tool:
- Attempts real exploitation using Metasploit
- Delivers payloads to target systems
- Establishes shells if successful
- May crash services or cause instability
- Can modify files or system state
Best Practices
Always Use Safe Mode For
Learning
Educational environments and training labs
Reconnaissance
Initial assessment and information gathering
Client Scanning
External vulnerability assessments
Reporting
Generating risk reports without exploitation
Only Disable Safe Mode For
Lab Testing
Isolated VM environments for testing
Red Team Ops
Authorized red team engagements with proper scope
Validation
Proving exploitability in controlled conditions
Research
Security research in isolated environments
Configuration Management
Track safe mode settings in your workflow:Verification
Checking Safe Mode Status
Verify safe mode is active by reviewing:- Startup banner - Shows
Safe Mode: [β] ENABLED - Phase 6 header - Shows
[SAFE MODE]tag - Exploitation output - Shows βRunning in SAFE MODEβ message
- Report metadata - Includes safe mode status
- Database records -
safe_modefield in exploits table
Log Verification
Check logs for confirmation:Database Recording
Safe mode status is recorded in the database for audit trails:Troubleshooting
Safe mode is disabled by default
Safe mode is disabled by default
Check your command line arguments. Ensure youβre not using
--no-safe-mode:Exploits showing as BLOCKED instead of SIMULATED
Exploits showing as BLOCKED instead of SIMULATED
This is intentional. Exploits marked as
safe: False are blocked even in safe mode:Want to test exploits manually
Want to test exploits manually
Use the generated RC scripts in an isolated lab:
Comparison Table
Whatβs Next?
Legal & Ethical Guidelines
Understand authorization and legal requirements
Run Your First Scan
Execute a safe penetration test
Understanding Reports
Interpret exploitation simulation results
Advanced Options
Explore all CLI configuration options
Safe mode provides comprehensive security insights without the risks of active exploitation. Itβs suitable for 99% of penetration testing scenarios.