2024-12-02 01:50:40 -05:00
|
|
|
|
using System.IO;
|
2024-12-02 10:38:36 -05:00
|
|
|
|
using BinaryObjectScanner.Protection;
|
2024-12-02 01:50:40 -05:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
2024-12-02 10:38:36 -05:00
|
|
|
|
namespace BinaryObjectScanner.Test.Protection
|
2024-12-02 01:50:40 -05:00
|
|
|
|
{
|
2024-12-02 10:38:36 -05:00
|
|
|
|
public class ArmadilloTests
|
2024-12-02 01:50:40 -05:00
|
|
|
|
{
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
public void CheckPortableExecutableTest()
|
|
|
|
|
|
{
|
|
|
|
|
|
string file = "filename";
|
|
|
|
|
|
SabreTools.Models.PortableExecutable.Executable model = new();
|
|
|
|
|
|
Stream source = new MemoryStream();
|
|
|
|
|
|
SabreTools.Serialization.Wrappers.PortableExecutable pex = new(model, source);
|
|
|
|
|
|
|
2024-12-02 10:38:36 -05:00
|
|
|
|
var checker = new Armadillo();
|
2024-12-02 01:50:40 -05:00
|
|
|
|
string? actual = checker.CheckExecutable(file, pex, includeDebug: false);
|
|
|
|
|
|
Assert.Null(actual);
|
|
|
|
|
|
}
|
2024-12-02 10:38:36 -05:00
|
|
|
|
|
2024-12-02 01:50:40 -05:00
|
|
|
|
[Fact]
|
|
|
|
|
|
public void ExtractPortableExecutableTest()
|
|
|
|
|
|
{
|
|
|
|
|
|
string file = "filename";
|
|
|
|
|
|
SabreTools.Models.PortableExecutable.Executable model = new();
|
|
|
|
|
|
Stream source = new MemoryStream();
|
|
|
|
|
|
SabreTools.Serialization.Wrappers.PortableExecutable pex = new(model, source);
|
|
|
|
|
|
string outputDir = string.Empty;
|
|
|
|
|
|
|
2024-12-02 10:38:36 -05:00
|
|
|
|
var checker = new Armadillo();
|
2024-12-02 01:50:40 -05:00
|
|
|
|
bool actual = checker.Extract(file, pex, outputDir, includeDebug: false);
|
|
|
|
|
|
Assert.False(actual);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|