Skip to content

Commit 3da142a

Browse files
authored
Merge 09016d3 into 5d8e2b9
2 parents 5d8e2b9 + 09016d3 commit 3da142a

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

Tests/MessageDeobfuscation.Test/MessageDeobfuscationTest.cs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using System.Threading.Tasks;
45
using Confuser.Core;
@@ -17,20 +18,16 @@ public class MessageDeobfuscationTest : TestBase {
1718

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

20-
[Fact]
21+
[Theory]
22+
[MemberData(nameof(RenameModeAndExpectedObfuscatedOutput))]
2123
[Trait("Category", "Protection")]
2224
[Trait("Protection", "rename")]
23-
public async Task MessageDeobfuscationWithSymbolsMap() {
24-
var expectedObfuscatedOutput = new[] {
25-
"Exception",
26-
" at _OokpKOmal5JNZMPvSAFgHLHjBke._tc5CFDIJ2J9Fx3ehd3sgjTMAxCaA._8Tq88jpv7mEXkEMavg6AaMFsXJt(String )",
27-
" at _ykdLsBmsKGrd6fxeEseqJs8XlpP._tfvbqapfg44suL8taZVvOKM4AoG()"
28-
};
25+
public async Task MessageDeobfuscationWithSymbolsMap(string renameMode, string[] expectedObfuscatedOutput) =>
2926
await Run(
3027
"MessageDeobfuscation.exe",
3128
expectedObfuscatedOutput,
32-
new SettingItem<Protection>("rename") {["mode"] = "decodable"},
33-
"SymbolsMap",
29+
new SettingItem<Protection>("rename") {["mode"] = renameMode},
30+
$"SymbolsMap_{renameMode}",
3431
seed: "1234",
3532
postProcessAction: outputPath => {
3633
var messageDeobfuscator = MessageDeobfuscator.Load(Path.Combine(outputPath, "symbols.map"));
@@ -39,7 +36,26 @@ await Run(
3936
return Task.Delay(0);
4037
}
4138
);
42-
}
39+
40+
public static IEnumerable<object[]> RenameModeAndExpectedObfuscatedOutput() =>
41+
new[] {
42+
new object[] {
43+
nameof(RenameMode.Decodable),
44+
new[] {
45+
"Exception",
46+
" at _OokpKOmal5JNZMPvSAFgHLHjBke._tc5CFDIJ2J9Fx3ehd3sgjTMAxCaA._8Tq88jpv7mEXkEMavg6AaMFsXJt(String )",
47+
" at _ykdLsBmsKGrd6fxeEseqJs8XlpP._tfvbqapfg44suL8taZVvOKM4AoG()"
48+
}
49+
},
50+
new object[] {
51+
nameof(RenameMode.Sequential),
52+
new[] {
53+
"Exception",
54+
" at _A._C._b(String )",
55+
" at _B._c()"
56+
}
57+
}
58+
};
4359

4460
[Fact]
4561
[Trait("Category", "Protection")]

0 commit comments

Comments
 (0)