using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using BurnOutSharp.Interfaces; using BurnOutSharp.Wrappers; namespace BurnOutSharp.PackerType { // TODO: Add extraction public class NSIS : IPortableExecutableCheck, IScannable { /// public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible var sections = pex?.SectionTable; if (sections == null) return null; string description = pex.AssemblyDescription; if (!string.IsNullOrWhiteSpace(description) && description.StartsWith("Nullsoft Install System")) return $"NSIS {description.Substring("Nullsoft Install System".Length).Trim()}"; // Get the .data/DATA section strings, if they exist List strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA"); if (strs != null) { if (strs.Any(s => s.Contains("NullsoftInst"))) return "NSIS"; } return null; } /// public ConcurrentDictionary> Scan(Scanner scanner, string file) { if (!File.Exists(file)) return null; using (var fs = File.OpenRead(file)) { return Scan(scanner, fs, file); } } /// public ConcurrentDictionary> Scan(Scanner scanner, Stream stream, string file) { return null; } } }