修复CallObfus的bug

backup
walon 2025-05-10 11:04:25 +08:00
parent 8c48e6bf61
commit 2166821d13
4 changed files with 8 additions and 8 deletions

View File

@ -41,7 +41,7 @@ namespace Obfuz.ObfusPasses.CallObfus
protected override bool NeedObfuscateMethod(MethodDef method)
{
return _dynamicProxyPolicy.NeedDynamicProxyCallInMethod(method);
return _dynamicProxyPolicy.NeedObfuscateCallInMethod(method);
}
protected override bool TryObfuscateInstruction(MethodDef callerMethod, Instruction inst, BasicBlock block,
@ -80,7 +80,7 @@ namespace Obfuz.ObfusPasses.CallObfus
ObfuscationCachePolicy cachePolicy = _dynamicProxyPolicy.GetMethodObfuscationCachePolicy(callerMethod);
bool cachedCallIndex = block.inLoop ? cachePolicy.cacheInLoop : cachePolicy.cacheNotInLoop;
if (!_dynamicProxyPolicy.NeedDynamicProxyCalledMethod(callerMethod, calledMethod, callVir, cachedCallIndex))
if (!_dynamicProxyPolicy.NeedObfuscateCalledMethod(callerMethod, calledMethod, callVir, cachedCallIndex))
{
return false;
}

View File

@ -405,7 +405,7 @@ namespace Obfuz.ObfusPasses.CallObfus
return rule;
}
public override bool NeedDynamicProxyCallInMethod(MethodDef method)
public override bool NeedObfuscateCallInMethod(MethodDef method)
{
ObfuscationRule rule = GetMethodObfuscationRule(method);
return rule.disableObfuscation != true;
@ -507,7 +507,7 @@ namespace Obfuz.ObfusPasses.CallObfus
return isWhiteList;
}
public override bool NeedDynamicProxyCalledMethod(MethodDef callerMethod, IMethod calledMethod, bool callVir, bool currentInLoop)
public override bool NeedObfuscateCalledMethod(MethodDef callerMethod, IMethod calledMethod, bool callVir, bool currentInLoop)
{
if (IsInWhiteList(calledMethod))
{

View File

@ -16,10 +16,10 @@ namespace Obfuz.ObfusPasses.CallObfus
public interface IObfuscationPolicy
{
bool NeedDynamicProxyCallInMethod(MethodDef method);
bool NeedObfuscateCallInMethod(MethodDef method);
ObfuscationCachePolicy GetMethodObfuscationCachePolicy(MethodDef method);
bool NeedDynamicProxyCalledMethod(MethodDef callerMethod, IMethod calledMethod, bool callVir, bool currentInLoop);
bool NeedObfuscateCalledMethod(MethodDef callerMethod, IMethod calledMethod, bool callVir, bool currentInLoop);
}
}

View File

@ -4,10 +4,10 @@ namespace Obfuz.ObfusPasses.CallObfus
{
public abstract class ObfuscationPolicyBase : IObfuscationPolicy
{
public abstract bool NeedDynamicProxyCallInMethod(MethodDef method);
public abstract bool NeedObfuscateCallInMethod(MethodDef method);
public abstract ObfuscationCachePolicy GetMethodObfuscationCachePolicy(MethodDef method);
public abstract bool NeedDynamicProxyCalledMethod(MethodDef callerMethod, IMethod calledMethod, bool callVir, bool currentInLoop);
public abstract bool NeedObfuscateCalledMethod(MethodDef callerMethod, IMethod calledMethod, bool callVir, bool currentInLoop);
}
}