-
Notifications
You must be signed in to change notification settings - Fork 8
Description
I am looking for an alternative to FCIV which is more robust and capable of recording errors to an output file (akin go the fciv.err file produced by FCIV), for the purposes of identifying corrupted files which are not yet part of a hashed integrity database.
FCIV was useful in this respect in that when it encounters a file that produces a Cyclic Redundancy Check error, that a record of this gets added to the fciv.err file output. However, it was limited in that it would fail and halt if a file name had unexpected characters or a directory path was too long.
When running PsFCIV on a directory for the first time with known bad files, the generated XML file will add a <FILE_ENTRY> element detailing the <name>, <Size>, and <Timestamp>, and hashes such as <MD5> if successful.
For corrupted files, it instead produces these errors within the PowerShell window which fail to identify which file produced the error:
Exception calling "HashFile" with "2" argument(s): "Data error (cyclic redundancy check).
"
At C:\Program Files\WindowsPowerShell\Modules\PsFCIV\1.1\PsFCIV.psm1:62 char:17
+ ... $hashBytes = [PsFCIV.Support.CryptUtils]::HashFile($file, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IOException
Exception calling "FormatBytes" with "2" argument(s): "Value cannot be null.
Parameter name: inArray"
At C:\Program Files\WindowsPowerShell\Modules\PsFCIV\1.1\PsFCIV.psm1:67 char:21
+ ... $object.$hash = [PsFCIV.Support.CryptUtils]::FormatBytes( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullExceptionThe result is that a <FILE_ENTRY> will be added to the XML DB as a new entry without any hashes.
This is difficult to parse for identifying bad files.
The tool in its current state is suitable for identifying changes in data compared to a previously built database, but not as well suited to discovering corrupted files.
Would it be possible to modify the functionality so that when it encounters a hashing failure, that it records an explicit failure to the XML DB instead of omitting the hash object? Or alternatively, writing its own fciv.err file.