Надіслав: Admin , дата:

A while ago I have a small pet project for the web. The repository was created, but I didn't deploy anything there, except composer files. Some day i've decided to run an optimization script which should hide sensitive data from the webserver (it was drupal-paranoia). But I forgot to move files from web to app folder!

And once the paranoia settings were added to the composer.json and executed all files in web folder were wiped. Completely. And forever.

I was sitting about a minute and thiking (crying) what to do next.

To my big surprise vscode store files in /home/user/.config/Code/User/History/

The folder and filenames are decoded with 8 symbols, but each folder has entries.json file which has the resource entty and custom file id!

{
"version":1,
"resource":"file:///home/user/web/site/config/sync/core.base_field_override.node.page.sticky.yml",
"entries":[{"id":"wc7g.yml","source":"searchReplace.source","timestamp":1696191979937}]
}

The small python script was generated by the agent.

https://gist.github.com/onesixromcom/ffc21a6d3751a52ab6539230be86256c

Don't forget to change RECOVER_FROM_URI_PREFIX to recover the files only from ONE project (folder) you need. Files will be recovered to the path where they were deleted. One thing this sctipy is not sorting the same files by the date it was changed. So I got recovered deleted files too. Not ALL files will be recovered! Only those you were working in vscode editing them directly.

Теґи