Page 1 of 1

css support

Posted: 29 Jul 2023, 23:47
by qdinar
i looked some recovered txt files and saw they are css files. could you add ability to detect css files? maybe by just some keywords, maybe by whole validity check?

Re: css support

Posted: 30 Jul 2023, 10:29
by recuperation
qdinar wrote: 29 Jul 2023, 23:47 i looked some recovered txt files and saw they are css files. could you add ability to detect css files? maybe by just some keywords, maybe by whole validity check?
There are lots of files types that contain readable text that are classified as txt-files because they are missing distinct fingerprints.
"just some keywords" does not meet any acceptable quality standard.

As for programming a "validity check" you can contribute your code (something the author of Photorec would really appreciate!) or hire a programmer. To give you an idea of the extent of programming this read the CSS documentation, p.e. here:

https://www.w3schools.com/css/css_howto.asp

I guess nobody is interested in CSS files anyway. You just want them to be recognized to simplify your life.

Try to use the search capabilities of your operating system to filter the files you don't want to see.

Re: css support

Posted: 07 Jan 2024, 17:09
by gianfrus
Hi! Just for info in the case of a hypotetical future improving of text/code recognition:
Christian Weiske (cweiske) on GitHub made an extension for the MIME magic file: https://github.com/cweiske/MIME_Type_PlainDetect

Re: css support

Posted: 07 Jan 2024, 17:27
by recuperation
There is no real usable recognition in his example.
I do not understand the php-language but I see that

Code: Select all

   $type = $mt->autoDetect($file)
his code relies on the autoDetect-function of a new mime-type.

There is no mime-type "class" in C and no autoDetect-function.
To make this example usable the source coude of the autoDetect-function needs to be translated to C.

Re: css support

Posted: 07 Jan 2024, 18:33
by gianfrus
Ok, just to tak about it.
I made the assumption that Photorec works similar to the GNU/Linux 'file' command in recognize file's content, but it's probably wrong.
Indeed, the "MIME magic file extension" from C.Weiske can be used with the 'file' command, other than only PHP:

Code: Select all

file -m programming.magic /path/to/file.css
and the 'file' command is written in C (https://darwinsys.com/file).
The problem I see is that 'file' command recognize file content but it doesn't care about uniquely associating a file name extension.

Re: css support

Posted: 07 Jan 2024, 22:05
by recuperation
TestDisk is working on different platforms:

https://www.cgsecurity.org/wiki/TestDisk_Download

Issuing a shell command that only works on a linux system will not help on the other platforms.
What's needed is C code or a C-library that can be used without license problems.