cyber_modules/persistence.py exposes a remove_persistence() function that undoes everything the installation step created. tools/cleanup_tool.py wraps this function with a command-line interface for classroom use.
Artifacts created by the game
Before cleanup, understand exactly what needs to be removed:| Artifact | Location | Platform |
|---|---|---|
| Registry Run key | HKCU\Software\Microsoft\Windows\CurrentVersion\Run\VirusHunterAgent | Windows |
| Crontab entry | Current user’s crontab (@reboot ...main_game.py...) | Linux |
| LaunchAgent plist | ~/Library/LaunchAgents/com.v-hunter.agent.plist | macOS |
| Marker file | cyber_modules/simulated_startup/system_defender_autorun.txt | All |
| Background process | Running main_game.py --bg process | All |
How remove_persistence() works
- Windows
- Linux
- macOS
Step 1: Remove the Registry entryStep 2: Kill running agent processes
/F forces termination without prompting. Note that killing all pythonw.exe processes is a broad sweep — in a real scenario, you would target the specific process ID (PID) instead.All platforms: delete the marker file
Regardless of platform, the final step is always the same:The cleanup_tool.py wrapper
tools/cleanup_tool.py provides a standalone command-line interface that calls remove_persistence() without requiring the full game to be running:
The cleanup tool can be run safely multiple times. Each removal operation checks whether the artifact exists before attempting to delete it, so running it on an already-clean machine produces no errors.
Verifying cleanup was successful
After running cleanup, confirm that every artifact has been removed:Check the autostart entry
- Windows
- Linux
- macOS
VirusHunterAgent does not appear in the output.Check the marker file
Real-world incident response
In real incident response, artifact removal follows the same pattern but at a much larger scale. IR teams use frameworks like MITRE ATT&CK to enumerate all known persistence techniques for the malware family they are dealing with, then systematically check and remove each one.Tools commonly used for this include:
- Autoruns (Windows) — shows every program configured to run at startup, from Registry keys to scheduled tasks to browser extensions.
- osquery — cross-platform SQL-based endpoint visibility.
- Volatility — memory forensics to find in-memory implants that leave no disk artifacts.