mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-08 13:49:47 +00:00
Executable is not inherently extractable
This commit is contained in:
@@ -19,7 +19,7 @@ namespace BinaryObjectScanner.FileType
|
||||
/// Due to the complexity of executables, all extraction handling
|
||||
/// another class that is used by the scanner
|
||||
/// </remarks>
|
||||
public class Executable : IDetectable, IExtractable
|
||||
public class Executable : IDetectable
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -167,25 +167,6 @@ namespace BinaryObjectScanner.FileType
|
||||
return string.Join(";", protections);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Extract(string file, bool includeDebug)
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
|
||||
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return Extract(fs, file, includeDebug);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <remarks>This implementation should never be invoked</remarks>
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
#region Check Runners
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace BurnOutSharp
|
||||
case SupportedFileType.BZip2: return new BinaryObjectScanner.FileType.BZip2();
|
||||
case SupportedFileType.CFB: return new BinaryObjectScanner.FileType.CFB();
|
||||
//case SupportedFileType.CIA: return new BinaryObjectScanner.FileType.CIA();
|
||||
case SupportedFileType.Executable: return new BinaryObjectScanner.FileType.Executable();
|
||||
case SupportedFileType.GCF: return new BinaryObjectScanner.FileType.GCF();
|
||||
case SupportedFileType.GZIP: return new BinaryObjectScanner.FileType.GZIP();
|
||||
case SupportedFileType.InstallShieldArchiveV3: return new BinaryObjectScanner.FileType.InstallShieldArchiveV3();
|
||||
|
||||
@@ -298,16 +298,9 @@ namespace BurnOutSharp
|
||||
if (detectable != null && ScanContents)
|
||||
{
|
||||
// If we have an executable, it needs to bypass normal handling
|
||||
// TODO: Write custom executable handling
|
||||
if (detectable is Executable executable)
|
||||
{
|
||||
executable.IncludePackers = ScanPackers;
|
||||
|
||||
// TODO: Enable this after IExtractable is properly implemented for Executable
|
||||
//var subProtections = Handler.HandleDetectable(executable, fileName, stream, IncludeDebug);
|
||||
//if (subProtections != null)
|
||||
// AppendToDictionary(protections, fileName, subProtections);
|
||||
|
||||
var subProtections = ProcessExecutable(executable, fileName, stream);
|
||||
if (subProtections != null)
|
||||
AppendToDictionary(protections, subProtections);
|
||||
@@ -347,13 +340,9 @@ namespace BurnOutSharp
|
||||
// If we're scanning archives
|
||||
if (extractable != null && ScanArchives)
|
||||
{
|
||||
// We only want to process non-executables
|
||||
if (!(extractable is Executable))
|
||||
{
|
||||
var subProtections = Handler.HandleExtractable(extractable, fileName, stream, this);
|
||||
if (subProtections != null)
|
||||
AppendToDictionary(protections, subProtections);
|
||||
}
|
||||
var subProtections = Handler.HandleExtractable(extractable, fileName, stream, this);
|
||||
if (subProtections != null)
|
||||
AppendToDictionary(protections, subProtections);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user