Simulates ransomware behavior for security training and testing. Creates reversible file encryption without causing actual harm.
- Automatic Backups: Creates safety backups before any simulation
- Safe Mode: Prevents simulation on system-critical files and directories
- Emergency Stop: Immediate halt and restoration functionality
- Reversible Operations: All simulated encryption can be fully reversed
- File Encryption: Real encryption (reversible) on target files
- Ransom Note Generation: Creates ransom notes
- Desktop Changes: Visual changes (Windows)
- Configurable Targets: Customizable file types and directories
- Detailed Logging: Complete audit trail of all simulation activities
- Simulation State Tracking: Maintains state for restoration
- Performance Metrics: Track simulation timing and file counts
- GUI Mode: User-friendly graphical interface
- CLI Mode: Command-line interface for automation
- Configuration Panel: Easy setup and customization
- Clone or download this repository
- Install dependencies:
pip install -r requirements.txt
python ransomware_simulator.py --gui# Start simulation on a directory
python ransomware_simulator.py --target "C:\Users\YourName\Documents\TestFolder"
# Restore files from last simulation
python ransomware_simulator.py --restoreThe simulator uses a simulator_config.json file for configuration:
{
"target_extensions": [".txt", ".doc", ".docx", ".pdf", ".jpg", ".png"],
"excluded_paths": ["C:\\Windows", "C:\\Program Files", "/System", "/usr"],
"max_files": 100,
"simulation_duration": 300,
"backup_enabled": true,
"safe_mode": true,
"ransom_note_template": "Your files have been encrypted! This is a SIMULATION."
}The simulator automatically excludes:
- System directories (Windows, Program Files, /usr, /bin, etc.)
- Critical system files
- User-defined excluded paths
- Creates timestamped backups before simulation
- Stores backups in
simulation_backups/directory - Maintains backup integrity for restoration
- Emergency Stop: Click the "Emergency Stop" button or press Ctrl+C
- Manual Restoration: Run with
--restoreflag - Backup Recovery: Access backups in
simulation_backups/directory
- Demonstrate ransomware behavior to employees
- Show the impact of file encryption
- Educate on prevention strategies
- Test backup and recovery procedures
- Evaluate detection capabilities
- Practice incident response workflows
- Validate endpoint protection
- Test network monitoring
- Assess user behavior
Ransomware Simulator/
βββ ransomware_simulator.py # Main simulator application
βββ requirements.txt # Python dependencies
βββ README.md # This documentation
βββ simulator_config.json # Configuration file (auto-generated)
βββ simulation_log.txt # Activity logs
βββ simulation_state.json # Current simulation state
βββ simulation_backups/ # Safety backups directory
βββ backup_YYYYMMDD_HHMMSS/
- Uses
cryptography.fernetfor symmetric encryption - Generates unique keys per simulation session
- Stores encrypted files with
.SIMULATEDextension
- Path validation against system directories
- File type filtering
- Maximum file count limits
- Automatic backup creation
- Loads simulation state from
simulation_state.json - Decrypts all affected files using stored key
- Restores original file names and locations
- Removes simulation artifacts
- Run in virtual machines when possible
- Maintain backups of important data
- Test restoration procedures regularly
- Windows desktop changes require administrator privileges
- Some antivirus software may flag the simulator
- Network simulation features are limited
- Does not simulate actual malware communication
"Permission Denied" Errors
- Run as administrator (Windows) or with sudo (Linux/Mac)
- Check file permissions on target directories
"No Files Found" Warning
- Verify target directory exists and contains supported file types
- Check excluded paths configuration
- Ensure safe mode isn't blocking all targets
Restoration Failures
- Check if
simulation_state.jsonexists - Verify backup directory integrity
- Run emergency stop procedure
For issues or questions:
- Check the simulation log (
simulation_log.txt) - Review configuration settings
- Verify file permissions and paths
- v1.0.0: Initial release with core simulation features
- GUI and CLI interfaces
- Safety mechanisms and backup system
- Comprehensive logging and state management
Provided as-is for security training and testing. Users are responsible for compliance with applicable laws.