Closed TheNewJavaman closed 1 month ago
The code is already there: https://github.com/NSX-Threat-Analysis-Unit/CVEX/blob/a3fd8a052fddd671a5e09b50606bb3d5bb34bb22/cvex/vm.py#L326
It reverts the state to the "clean" snapshot if the VM is not running. If it is already running, then it doesn't do it. I made it this way so that we could test our code on VMs that are already running. Normally, after execution the VMs are going to be shut down and we won't see this problem anymore: https://github.com/NSX-Threat-Analysis-Unit/CVEX/blob/a3fd8a052fddd671a5e09b50606bb3d5bb34bb22/cvex/__main__.py#L153
Is that what you are referring to?
That makes sense for development, we should eventually have a CLI flag for this though. It might be counter intuitive for users.
Implemented here: https://github.com/NSX-Threat-Analysis-Unit/CVEX/commit/03fd7697e40b86687395e08c7d7eb694a9cb1b54
Use the --keep/-k flag if you want cvex to use the VMs that are already running. With this flag it won't be also stopping them. This flag is disabled by default.
There were nested snapshots (i.e. running 00 then 01 resulted in 00 files inside 01 snapshot)