Skip to main content
AutoPentestX includes comprehensive safety controls to prevent accidental damage during penetration testing. Safe mode is enabled by default and implements multiple layers of protection during the exploitation phase.

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.
Safe mode is enabled by default and should only be disabled in isolated lab environments with explicit authorization.

Implementation

Default Configuration

Safe mode is initialized in exploit_engine.py:15:
The AutoPentestX main class also defaults to safe mode (main.py:30):

Enabling/Disabling

No exploitation is executed. All attacks are simulated.

Safe Mode Behavior

Exploitation Simulation

When safe mode is enabled, the simulate_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:
Only execute RC scripts in isolated lab environments with proper authorization. Never run these against production systems.

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:
System Damage
  • Crashed services or kernel panics
  • Corrupted file systems
  • Lost or modified data
  • Bricked systems requiring reinstallation
Legal Issues
  • Unauthorized access charges
  • Computer fraud violations
  • Civil liability for damages
  • Criminal prosecution
Operational Impact
  • Production service outages
  • Business disruption
  • Data loss or corruption
  • Customer impact

Unsafe Mode Behavior

When disabled (--no-safe-mode), the tool:
  1. Attempts real exploitation using Metasploit
  2. Delivers payloads to target systems
  3. Establishes shells if successful
  4. May crash services or cause instability
  5. 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:
  1. Startup banner - Shows Safe Mode: [βœ“] ENABLED
  2. Phase 6 header - Shows [SAFE MODE] tag
  3. Exploitation output - Shows β€œRunning in SAFE MODE” message
  4. Report metadata - Includes safe mode status
  5. Database records - safe_mode field in exploits table

Log Verification

Check logs for confirmation:

Database Recording

Safe mode status is recorded in the database for audit trails:
This ensures you can always verify whether exploitation was simulated or executed.

Troubleshooting

Check your command line arguments. Ensure you’re not using --no-safe-mode:
This is intentional. Exploits marked as safe: False are blocked even in safe mode:
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.