调整表达式混淆顺序,改到EvalStackObfus之前
parent
338d2acf05
commit
1f9aac59ee
|
@ -72,7 +72,7 @@ namespace Obfuz.ObfusPasses.EvalStackObfus
|
|||
|
||||
protected override void ObfuscateData(MethodDef method)
|
||||
{
|
||||
Debug.Log($"Obfuscating method: {method.FullName} with EvalStackObfusPass");
|
||||
//Debug.Log($"Obfuscating method: {method.FullName} with EvalStackObfusPass");
|
||||
IList<Instruction> instructions = method.Body.Instructions;
|
||||
var outputInstructions = new List<Instruction>();
|
||||
var totalFinalInstructions = new List<Instruction>();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using dnlib.DotNet.Emit;
|
||||
using Obfuz.Emit;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
|
||||
{
|
||||
|
@ -10,7 +11,11 @@ namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
|
|||
|
||||
public override bool ObfuscateBasicUnaryOp(Instruction inst, EvalDataType op, EvalDataType ret, List<Instruction> outputInsts, ObfusMethodContext ctx)
|
||||
{
|
||||
if (!GenerateIdentityTransformForArgument(inst, op, outputInsts, ctx))
|
||||
if (!base.ObfuscateBasicUnaryOp(inst, op, ret, outputInsts, ctx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (outputInsts.Last().OpCode.Code != inst.OpCode.Code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -20,7 +25,11 @@ namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
|
|||
|
||||
public override bool ObfuscateBasicBinOp(Instruction inst, EvalDataType op1, EvalDataType op2, EvalDataType ret, List<Instruction> outputInsts, ObfusMethodContext ctx)
|
||||
{
|
||||
if (!GenerateIdentityTransformForArgument(inst, op2, outputInsts, ctx))
|
||||
if (!base.ObfuscateBasicBinOp(inst, op1, op2, ret, outputInsts, ctx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (outputInsts.Last().OpCode.Code != inst.OpCode.Code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -30,7 +39,12 @@ namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
|
|||
|
||||
public override bool ObfuscateUnaryBitwiseOp(Instruction inst, EvalDataType op, EvalDataType ret, List<Instruction> outputInsts, ObfusMethodContext ctx)
|
||||
{
|
||||
if (!GenerateIdentityTransformForArgument(inst, op, outputInsts, ctx))
|
||||
if (!base.ObfuscateUnaryBitwiseOp(inst, op, ret, outputInsts, ctx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outputInsts.Last().OpCode.Code != inst.OpCode.Code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -40,7 +54,11 @@ namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
|
|||
|
||||
public override bool ObfuscateBinBitwiseOp(Instruction inst, EvalDataType op1, EvalDataType op2, EvalDataType ret, List<Instruction> outputInsts, ObfusMethodContext ctx)
|
||||
{
|
||||
if (!GenerateIdentityTransformForArgument(inst, op2, outputInsts, ctx))
|
||||
if (!base.ObfuscateBinBitwiseOp(inst, op1, op2, ret, outputInsts, ctx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (outputInsts.Last().OpCode.Code != inst.OpCode.Code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +68,11 @@ namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
|
|||
|
||||
public override bool ObfuscateBitShiftOp(Instruction inst, EvalDataType op1, EvalDataType op2, EvalDataType ret, List<Instruction> outputInsts, ObfusMethodContext ctx)
|
||||
{
|
||||
if (!GenerateIdentityTransformForArgument(inst, op2, outputInsts, ctx))
|
||||
if (!base.ObfuscateBitShiftOp(inst, op1, op2, ret,outputInsts, ctx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (outputInsts.Last().OpCode.Code != inst.OpCode.Code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -170,6 +170,10 @@ namespace Obfuz
|
|||
{
|
||||
builder.AddPass(new ConstEncryptPass(settings.constEncryptSettings.ToFacade()));
|
||||
}
|
||||
if (obfuscationPasses.HasFlag(ObfuscationPassType.ExprObfus))
|
||||
{
|
||||
builder.AddPass(new ExprObfusPass(settings.exprObfusSettings.ToFacade()));
|
||||
}
|
||||
if (obfuscationPasses.HasFlag(ObfuscationPassType.EvalStackObfus))
|
||||
{
|
||||
builder.AddPass(new EvalStackObfusPass(settings.evalStackObfusSettings.ToFacade()));
|
||||
|
@ -178,10 +182,6 @@ namespace Obfuz
|
|||
{
|
||||
builder.AddPass(new FieldEncryptPass(settings.fieldEncryptSettings.ToFacade()));
|
||||
}
|
||||
if (obfuscationPasses.HasFlag(ObfuscationPassType.ExprObfus))
|
||||
{
|
||||
builder.AddPass(new ExprObfusPass(settings.exprObfusSettings.ToFacade()));
|
||||
}
|
||||
if (obfuscationPasses.HasFlag(ObfuscationPassType.CallObfus))
|
||||
{
|
||||
builder.AddPass(new CallObfusPass(settings.callObfusSettings.ToFacade()));
|
||||
|
|
Loading…
Reference in New Issue