cgsecurity / testdisk

TestDisk & PhotoRec
https://www.cgsecurity.org/
GNU General Public License v2.0
1.58k stars 195 forks source link

[photorec] Feature: Only create report.xml #17

Open amosonn opened 7 years ago

amosonn commented 7 years ago

When recovering from a large disk, one might want to omit some files which are too big, or known to exist elsewhere, etc. Conversely, one might want to compare recoveries with different parameters, different tools, etc.

Currently, one still needs to have enough free disk space to have all these redundant files, or to have all versions of recovery. I suggest to have an option where photorec performs all the analysis, but doesn't actually write the recovered data to disk. It is simple enough, afterwards, to recover the actual files one wants by reading the xml, and most likely much less time consumptive than the original analysis. (Of course, there can also be a feature for processing a report.xml and recovering by its spec, so one can simply delete the items which are unwanted, but I assume this is a much larger feature.)

amosonn commented 7 years ago

I can probably write this myself, but it might take me a while to get acquainted enough with the code. Could you please give me pointers where to look? Conversely, maybe it's so simple that it's easier for you to do it yourself?

Thanks a lot!

cgsecurity commented 7 years ago

Without writing the file to the disk, it's not possible to do all checks. You can probably delete the recovered file in file_finish_aux(), see src/photorec.c

amosonn commented 7 years ago

Thanks! Yes, I figured up as much, already implemented this as an option. I will send a pull request when I get good internet access. The only thing that I didn't manage was to remove the thumbnails, since they are written separately, without calling the file_finish-es, and I have no access to the high-level params there (to check whether to skip them). But I guess that's still good enough.

amosonn commented 7 years ago

Coming next, I'm planning to write a lib which parses this xml and makes it available via fusermount. I don't think it fits here, but I will update anyway, for future seekers.