Skip to content

Commit

Permalink
Merge 09016d3 into 5d8e2b9
Browse files Browse the repository at this point in the history
  • Loading branch information
KvanTTT authored Jul 16, 2021
2 parents 5d8e2b9 + 09016d3 commit 3da142a
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions Tests/MessageDeobfuscation.Test/MessageDeobfuscationTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Confuser.Core;
Expand All @@ -17,20 +18,16 @@ public class MessageDeobfuscationTest : TestBase {

public MessageDeobfuscationTest(ITestOutputHelper outputHelper) : base(outputHelper) { }

[Fact]
[Theory]
[MemberData(nameof(RenameModeAndExpectedObfuscatedOutput))]
[Trait("Category", "Protection")]
[Trait("Protection", "rename")]
public async Task MessageDeobfuscationWithSymbolsMap() {
var expectedObfuscatedOutput = new[] {
"Exception",
" at _OokpKOmal5JNZMPvSAFgHLHjBke._tc5CFDIJ2J9Fx3ehd3sgjTMAxCaA._8Tq88jpv7mEXkEMavg6AaMFsXJt(String )",
" at _ykdLsBmsKGrd6fxeEseqJs8XlpP._tfvbqapfg44suL8taZVvOKM4AoG()"
};
public async Task MessageDeobfuscationWithSymbolsMap(string renameMode, string[] expectedObfuscatedOutput) =>
await Run(
"MessageDeobfuscation.exe",
expectedObfuscatedOutput,
new SettingItem<Protection>("rename") {["mode"] = "decodable"},
"SymbolsMap",
new SettingItem<Protection>("rename") {["mode"] = renameMode},
$"SymbolsMap_{renameMode}",
seed: "1234",
postProcessAction: outputPath => {
var messageDeobfuscator = MessageDeobfuscator.Load(Path.Combine(outputPath, "symbols.map"));
Expand All @@ -39,7 +36,26 @@ await Run(
return Task.Delay(0);
}
);
}

public static IEnumerable<object[]> RenameModeAndExpectedObfuscatedOutput() =>
new[] {
new object[] {
nameof(RenameMode.Decodable),
new[] {
"Exception",
" at _OokpKOmal5JNZMPvSAFgHLHjBke._tc5CFDIJ2J9Fx3ehd3sgjTMAxCaA._8Tq88jpv7mEXkEMavg6AaMFsXJt(String )",
" at _ykdLsBmsKGrd6fxeEseqJs8XlpP._tfvbqapfg44suL8taZVvOKM4AoG()"
}
},
new object[] {
nameof(RenameMode.Sequential),
new[] {
"Exception",
" at _A._C._b(String )",
" at _B._c()"
}
}
};

[Fact]
[Trait("Category", "Protection")]
Expand Down

0 comments on commit 3da142a

Please sign in to comment.