Add byte array checks for IIF

This commit is contained in:
Matt Nadareski
2021-08-24 09:26:27 -07:00
parent 6049eda580
commit 8a07c9cf4e

View File

@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using BurnOutSharp.Matching;
namespace BurnOutSharp.PackerType
{
@@ -8,7 +10,6 @@ namespace BurnOutSharp.PackerType
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// TODO: Add byte-based checks for these as well for when we're working on stream alone
var fvinfo = Utilities.GetFileVersionInfo(file);
string name = fvinfo?.FileDescription.Trim();
@@ -27,7 +28,35 @@ namespace BurnOutSharp.PackerType
return $"Intel Installation Framework {Utilities.GetFileVersion(file)}";
}
return null;
var matchers = new List<ContentMatchSet>
{
// I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + l + (char)0x00 + ( + (char)0x00 + R + (char)0x00 + ) + (char)0x00 + + (char)0x00 + I + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + F + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + w + (char)0x00 + o + (char)0x00 + r + (char)0x00 + k + (char)0x00
new ContentMatchSet(new byte?[]
{
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00,
0x6C, 0x00, 0x28, 0x00, 0x52, 0x00, 0x29, 0x00,
0x20, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x73, 0x00,
0x74, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00,
0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00,
0x6E, 0x00, 0x20, 0x00, 0x46, 0x00, 0x72, 0x00,
0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x77, 0x00,
0x6F, 0x00, 0x72, 0x00, 0x6B, 0x00,
}, Utilities.GetFileVersion, "Intel Installation Framework"),
// I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + l + (char)0x00 + + (char)0x00 + I + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + F + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + w + (char)0x00 + o + (char)0x00 + r + (char)0x00 + k + (char)0x00
new ContentMatchSet(new byte?[]
{
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00,
0x6C, 0x00, 0x20, 0x00, 0x49, 0x00, 0x6E, 0x00,
0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x6C, 0x00,
0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00,
0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x46, 0x00,
0x72, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00,
0x77, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6B, 0x00,
}, Utilities.GetFileVersion, "Intel Installation Framework"),
};
return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition);
}
}
}