Files
BinaryObjectScanner/BurnOutSharp/PackerType/Armadillo.cs

62 lines
2.0 KiB
C#
Raw Normal View History

2022-05-01 21:02:59 -07:00
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
2021-08-26 20:38:01 -07:00
using System.Linq;
2022-05-01 17:41:50 -07:00
using BurnOutSharp.Interfaces;
using BurnOutSharp.Wrappers;
2021-03-21 14:30:37 -07:00
namespace BurnOutSharp.PackerType
{
2022-05-01 21:02:59 -07:00
// TODO: Add extraction
2021-08-26 21:47:44 -07:00
// TODO: Add version checking, if possible
2022-07-13 12:48:16 -07:00
// https://raw.githubusercontent.com/wolfram77web/app-peid/master/userdb.txt
2022-05-01 21:02:59 -07:00
public class Armadillo : IPortableExecutableCheck, IScannable
{
/// <inheritdoc/>
2022-05-01 17:17:15 -07:00
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
2021-08-26 20:38:01 -07:00
{
// Get the sections from the executable, if possible
var sections = pex?.SectionTable;
2021-08-26 20:38:01 -07:00
if (sections == null)
return null;
2021-09-11 00:32:48 -07:00
// Get the .nicode section, if it exists
bool nicodeSection = pex.ContainsSection(".nicode", exact: true);
if (nicodeSection)
2021-08-26 20:38:01 -07:00
return "Armadillo";
// Loop through all "extension" sections -- usually .data1 or .text1
foreach (var sectionName in pex.SectionNames.Where(s => s != null && s.EndsWith("1")))
2021-08-26 20:38:01 -07:00
{
2022-12-09 12:53:19 -08:00
// Get the section strings, if they exist
List<string> strs = pex.GetFirstSectionStrings(sectionName);
if (strs != null)
2021-08-26 20:38:01 -07:00
{
2022-12-09 12:53:19 -08:00
if (strs.Any(s => s.Contains("ARMDEBUG")))
return "Armadillo";
2022-03-14 23:28:31 -07:00
}
2021-08-26 20:38:01 -07:00
}
return null;
}
2022-05-01 21:02:59 -07:00
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
2022-12-22 22:03:32 -08:00
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
2022-05-01 21:02:59 -07:00
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
return null;
}
}
}