From e0150d7bb5b5646a3afd6568a93fdac1112fef64 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 9 Dec 2022 15:18:17 -0800 Subject: [PATCH] Convert NSIS to string finding --- BurnOutSharp/PackerType/NSIS.cs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs index 9c189ffc..c30ca5d6 100644 --- a/BurnOutSharp/PackerType/NSIS.cs +++ b/BurnOutSharp/PackerType/NSIS.cs @@ -1,8 +1,8 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; +using System.Linq; using BurnOutSharp.Interfaces; -using BurnOutSharp.Matching; using BurnOutSharp.Wrappers; namespace BurnOutSharp.PackerType @@ -22,23 +22,12 @@ namespace BurnOutSharp.PackerType if (!string.IsNullOrWhiteSpace(description) && description.StartsWith("Nullsoft Install System")) return $"NSIS {description.Substring("Nullsoft Install System".Length).Trim()}"; - // Get the .data/DATA section, if it exists - var dataSectionRaw = pex.GetFirstSectionData(".data") ?? pex.GetFirstSectionData("DATA"); - if (dataSectionRaw != null) + // Get the .data/DATA section strings, if they exist + List strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA"); + if (strs != null) { - var matchers = new List - { - // NullsoftInst - new ContentMatchSet(new byte?[] - { - 0x4E, 0x75, 0x6C, 0x6C, 0x73, 0x6F, 0x66, 0x74, - 0x49, 0x6E, 0x73, 0x74 - }, "NSIS"), - }; - - string match = MatchUtil.GetFirstMatch(file, dataSectionRaw, matchers, includeDebug); - if (!string.IsNullOrWhiteSpace(match)) - return match; + if (strs.Any(s => s.Contains("NullsoftInst"))) + return "NSIS"; } return null;