mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-16 22:05:13 +00:00
Use content matching helper, part 6
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using BurnOutSharp.Matching;
|
||||
|
||||
namespace BurnOutSharp.PackerType
|
||||
{
|
||||
@@ -9,12 +9,20 @@ namespace BurnOutSharp.PackerType
|
||||
/// <inheritdoc/>
|
||||
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
||||
{
|
||||
// Software\Caphyon\Advanced Installer
|
||||
byte?[] check = new byte?[] { 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x5C, 0x43, 0x61, 0x70, 0x68, 0x79, 0x6F, 0x6E, 0x5C, 0x41, 0x64, 0x76, 0x61, 0x6E, 0x63, 0x65, 0x64, 0x20, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x65, 0x72 };
|
||||
if (fileContent.FirstPosition(check, out int position))
|
||||
return "Caphyon Advanced Installer" + (includePosition ? $" (Index {position})" : string.Empty);
|
||||
var matchers = new List<Matcher>
|
||||
{
|
||||
// Software\Caphyon\Advanced Installer
|
||||
new Matcher(new byte?[]
|
||||
{
|
||||
0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
|
||||
0x5C, 0x43, 0x61, 0x70, 0x68, 0x79, 0x6F, 0x6E,
|
||||
0x5C, 0x41, 0x64, 0x76, 0x61, 0x6E, 0x63, 0x65,
|
||||
0x64, 0x20, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C,
|
||||
0x6C, 0x65, 0x72
|
||||
}, "Caphyon Advanced Installer"),
|
||||
};
|
||||
|
||||
return null;
|
||||
return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BurnOutSharp.Matching;
|
||||
|
||||
namespace BurnOutSharp.PackerType
|
||||
{
|
||||
// The official website for CExe also includes the source code (which does have to be retrieved by the Wayback Machine). http://www.scottlu.com/Content/CExe.html
|
||||
// The official website for CExe also includes the source code (which does have to be retrieved by the Wayback Machine)
|
||||
// http://www.scottlu.com/Content/CExe.html
|
||||
public class CExe : IContentCheck, IScannable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
@@ -12,14 +14,22 @@ namespace BurnOutSharp.PackerType
|
||||
/// <inheritdoc/>
|
||||
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
||||
{
|
||||
// "%WoÁa6.’a6.’a6.’a6.’{6.’.).’f6.’‰).’`6.’Ù0.’`6.’"
|
||||
byte?[] check = new byte?[] { 0x25, 0x57, 0x6F, 0xC1, 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x00, 0x92, 0x7B, 0x36, 0x01, 0x92, 0x03, 0x29, 0x12, 0x92, 0x66, 0x36, 0x01, 0x92, 0x89, 0x29, 0x0A, 0x92, 0x60, 0x36, 0x01, 0x92, 0xD9, 0x30, 0x07, 0x92, 0x60, 0x36, 0x01, 0x92 };
|
||||
if (fileContent.FirstPosition(check, out int position, end: 200))
|
||||
var matchers = new List<Matcher>
|
||||
{
|
||||
return "CExe";
|
||||
}
|
||||
// %Wo<57>a6.<2E>a6.<2E>a6.<2E>a6.<2E>{6.<2E>.).<2E>f6.<2E><>).<2E>`6.<2E><>0.<2E>`6.<2E>
|
||||
new Matcher(
|
||||
new ContentMatch(new byte?[]
|
||||
{
|
||||
0x25, 0x57, 0x6F, 0xC1, 0x61, 0x36, 0x01, 0x92,
|
||||
0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x01, 0x92,
|
||||
0x61, 0x36, 0x00, 0x92, 0x7B, 0x36, 0x01, 0x92,
|
||||
0x03, 0x29, 0x12, 0x92, 0x66, 0x36, 0x01, 0x92,
|
||||
0x89, 0x29, 0x0A, 0x92, 0x60, 0x36, 0x01, 0x92,
|
||||
0xD9, 0x30, 0x07, 0x92, 0x60, 0x36, 0x01, 0x92
|
||||
}, end: 200), "CExe"),
|
||||
};
|
||||
|
||||
return null;
|
||||
return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -12,10 +12,6 @@ namespace BurnOutSharp.PackerType
|
||||
/// <inheritdoc/>
|
||||
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
||||
{
|
||||
// Longer version of the check that can be used if false positves become an issue:
|
||||
// S.e.t.u.p. .F.a.c.t.o.r.y. .i.s. .a. .t.r.a.d.e.m.a.r.k. .o.f. .I.n.d.i.g.o. .R.o.s.e. .C.o.r.p.o.r.a.t.i.o.n
|
||||
// byte?[] check = new byte?[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x79, 0x00, 0x20, 0x00, 0x69, 0x00, 0x73, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x20, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x69, 0x00, 0x67, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E };
|
||||
|
||||
var matchers = new List<Matcher>
|
||||
{
|
||||
// S.e.t.u.p. .F.a.c.t.o.r.y.
|
||||
@@ -26,6 +22,26 @@ namespace BurnOutSharp.PackerType
|
||||
0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00,
|
||||
0x79, 0x00
|
||||
}, GetVersion, "Setup Factory"),
|
||||
|
||||
// Longer version of the check that can be used if false positves become an issue:
|
||||
// S.e.t.u.p. .F.a.c.t.o.r.y. .i.s. .a. .t.r.a.d.e.m.a.r.k. .o.f. .I.n.d.i.g.o. .R.o.s.e. .C.o.r.p.o.r.a.t.i.o.n.
|
||||
// new Matcher(new byte?[]
|
||||
// {
|
||||
// 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00,
|
||||
// 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00,
|
||||
// 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00,
|
||||
// 0x79, 0x00, 0x20, 0x00, 0x69, 0x00, 0x73, 0x00,
|
||||
// 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x74, 0x00,
|
||||
// 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00,
|
||||
// 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00,
|
||||
// 0x20, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x20, 0x00,
|
||||
// 0x49, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x69, 0x00,
|
||||
// 0x67, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x52, 0x00,
|
||||
// 0x6F, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00,
|
||||
// 0x43, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x70, 0x00,
|
||||
// 0x6F, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00,
|
||||
// 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00
|
||||
// }, GetVersion, "Setup Factory"),
|
||||
};
|
||||
|
||||
return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
|
||||
@@ -44,7 +60,8 @@ namespace BurnOutSharp.PackerType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
// Add extraction, which is possible but the only tools available that can do this seem to be Universal Extractor 2 and InstallExplorer (https://totalcmd.net/plugring/InstallExplorer.html)
|
||||
// TODO: Add extraction, which is possible but the only tools available that can
|
||||
// do this seem to be Universal Extractor 2 and InstallExplorer (https://totalcmd.net/plugring/InstallExplorer.html)
|
||||
public Dictionary<string, List<string>> Scan(Scanner scanner, Stream stream, string file)
|
||||
{
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user