修复CallObfus的bug
parent
8c48e6bf61
commit
2166821d13
|
@ -41,7 +41,7 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
|
|
||||||
protected override bool NeedObfuscateMethod(MethodDef method)
|
protected override bool NeedObfuscateMethod(MethodDef method)
|
||||||
{
|
{
|
||||||
return _dynamicProxyPolicy.NeedDynamicProxyCallInMethod(method);
|
return _dynamicProxyPolicy.NeedObfuscateCallInMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool TryObfuscateInstruction(MethodDef callerMethod, Instruction inst, BasicBlock block,
|
protected override bool TryObfuscateInstruction(MethodDef callerMethod, Instruction inst, BasicBlock block,
|
||||||
|
@ -80,7 +80,7 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
ObfuscationCachePolicy cachePolicy = _dynamicProxyPolicy.GetMethodObfuscationCachePolicy(callerMethod);
|
ObfuscationCachePolicy cachePolicy = _dynamicProxyPolicy.GetMethodObfuscationCachePolicy(callerMethod);
|
||||||
bool cachedCallIndex = block.inLoop ? cachePolicy.cacheInLoop : cachePolicy.cacheNotInLoop;
|
bool cachedCallIndex = block.inLoop ? cachePolicy.cacheInLoop : cachePolicy.cacheNotInLoop;
|
||||||
|
|
||||||
if (!_dynamicProxyPolicy.NeedDynamicProxyCalledMethod(callerMethod, calledMethod, callVir, cachedCallIndex))
|
if (!_dynamicProxyPolicy.NeedObfuscateCalledMethod(callerMethod, calledMethod, callVir, cachedCallIndex))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,7 +405,7 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool NeedDynamicProxyCallInMethod(MethodDef method)
|
public override bool NeedObfuscateCallInMethod(MethodDef method)
|
||||||
{
|
{
|
||||||
ObfuscationRule rule = GetMethodObfuscationRule(method);
|
ObfuscationRule rule = GetMethodObfuscationRule(method);
|
||||||
return rule.disableObfuscation != true;
|
return rule.disableObfuscation != true;
|
||||||
|
@ -507,7 +507,7 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
return isWhiteList;
|
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))
|
if (IsInWhiteList(calledMethod))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
|
|
||||||
public interface IObfuscationPolicy
|
public interface IObfuscationPolicy
|
||||||
{
|
{
|
||||||
bool NeedDynamicProxyCallInMethod(MethodDef method);
|
bool NeedObfuscateCallInMethod(MethodDef method);
|
||||||
|
|
||||||
ObfuscationCachePolicy GetMethodObfuscationCachePolicy(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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace Obfuz.ObfusPasses.CallObfus
|
||||||
{
|
{
|
||||||
public abstract class ObfuscationPolicyBase : IObfuscationPolicy
|
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 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue