Add options to disable decryption of methods and bools
This commit is contained in:
parent
63ab61fb12
commit
dfb73f222f
|
@ -24,8 +24,13 @@ using de4dot.blocks;
|
||||||
|
|
||||||
namespace de4dot.deobfuscators.dotNET_Reactor {
|
namespace de4dot.deobfuscators.dotNET_Reactor {
|
||||||
class DeobfuscatorInfo : DeobfuscatorInfoBase {
|
class DeobfuscatorInfo : DeobfuscatorInfoBase {
|
||||||
|
BoolOption decryptMethods;
|
||||||
|
BoolOption decryptBools;
|
||||||
|
|
||||||
public DeobfuscatorInfo()
|
public DeobfuscatorInfo()
|
||||||
: base("dr") {
|
: base("dr") {
|
||||||
|
decryptMethods = new BoolOption(null, makeArgName("methods"), "Decrypt methods", true);
|
||||||
|
decryptBools = new BoolOption(null, makeArgName("bools"), "Decrypt booleans", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string ObfuscatorType {
|
internal static string ObfuscatorType {
|
||||||
|
@ -39,11 +44,15 @@ namespace de4dot.deobfuscators.dotNET_Reactor {
|
||||||
public override IDeobfuscator createDeobfuscator() {
|
public override IDeobfuscator createDeobfuscator() {
|
||||||
return new Deobfuscator(new Deobfuscator.Options {
|
return new Deobfuscator(new Deobfuscator.Options {
|
||||||
ValidNameRegex = validNameRegex.get(),
|
ValidNameRegex = validNameRegex.get(),
|
||||||
|
DecryptMethods = decryptMethods.get(),
|
||||||
|
DecryptBools = decryptBools.get(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<Option> getOptionsInternal() {
|
protected override IEnumerable<Option> getOptionsInternal() {
|
||||||
return new List<Option>() {
|
return new List<Option>() {
|
||||||
|
decryptMethods,
|
||||||
|
decryptBools,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +68,8 @@ namespace de4dot.deobfuscators.dotNET_Reactor {
|
||||||
BoolValueInliner boolValueInliner;
|
BoolValueInliner boolValueInliner;
|
||||||
|
|
||||||
internal class Options : OptionsBase {
|
internal class Options : OptionsBase {
|
||||||
|
public bool DecryptMethods { get; set; }
|
||||||
|
public bool DecryptBools { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Type {
|
public override string Type {
|
||||||
|
@ -113,6 +124,9 @@ namespace de4dot.deobfuscators.dotNET_Reactor {
|
||||||
}
|
}
|
||||||
peImage = new PE.PeImage(fileData);
|
peImage = new PE.PeImage(fileData);
|
||||||
|
|
||||||
|
if (!options.DecryptMethods)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (!methodsDecrypter.decrypt(peImage, DeobfuscatedFile))
|
if (!methodsDecrypter.decrypt(peImage, DeobfuscatedFile))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -137,9 +151,11 @@ namespace de4dot.deobfuscators.dotNET_Reactor {
|
||||||
booleanDecrypter.init(fileData, DeobfuscatedFile);
|
booleanDecrypter.init(fileData, DeobfuscatedFile);
|
||||||
boolValueInliner = new BoolValueInliner();
|
boolValueInliner = new BoolValueInliner();
|
||||||
|
|
||||||
|
if (options.DecryptBools) {
|
||||||
boolValueInliner.add(booleanDecrypter.BoolDecrypterMethod, (method, args) => {
|
boolValueInliner.add(booleanDecrypter.BoolDecrypterMethod, (method, args) => {
|
||||||
return booleanDecrypter.decrypt((int)args[0]);
|
return booleanDecrypter.decrypt((int)args[0]);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var info in stringDecrypter.DecrypterInfos) {
|
foreach (var info in stringDecrypter.DecrypterInfos) {
|
||||||
staticStringDecrypter.add(info.method, (method2, args) => {
|
staticStringDecrypter.add(info.method, (method2, args) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user