mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-08 18:06:34 +00:00
Scan even partial extractions, simplify branches
This commit is contained in:
@@ -328,12 +328,21 @@ namespace BinaryObjectScanner
|
||||
// Extract and get the output path
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
Directory.CreateDirectory(tempPath);
|
||||
bool extracted = extractable.Extract(tempPath, _includeDebug);
|
||||
_ = extractable.Extract(tempPath, _includeDebug);
|
||||
|
||||
// Collect and format all found protections
|
||||
ProtectionDictionary? subProtections = null;
|
||||
if (extracted)
|
||||
subProtections = GetProtectionsImpl(tempPath, depth + 1);
|
||||
// Check if any files extracted
|
||||
if (IOExtensions.SafeGetFiles(tempPath).Length > 0)
|
||||
{
|
||||
// Scan the output path
|
||||
var subProtections = GetProtectionsImpl(tempPath, depth + 1);
|
||||
|
||||
// Prepare the returned values
|
||||
subProtections.StripFromKeys(tempPath);
|
||||
subProtections.PrependToKeys(fileName);
|
||||
|
||||
// Append the values
|
||||
protections.Append(subProtections);
|
||||
}
|
||||
|
||||
// If temp directory cleanup fails
|
||||
try
|
||||
@@ -345,14 +354,6 @@ namespace BinaryObjectScanner
|
||||
{
|
||||
if (_includeDebug) Console.Error.WriteLine(ex);
|
||||
}
|
||||
|
||||
// Prepare the returned protections
|
||||
if (subProtections != null)
|
||||
{
|
||||
subProtections.StripFromKeys(tempPath);
|
||||
subProtections.PrependToKeys(fileName);
|
||||
protections.Append(subProtections);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user