Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions de4dot.code/deobfuscators/Babel_NET/BabelMethodCallInliner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ bool InlineMethod(Instruction callInstr, int instrIndex) {
if (!GetNewValue(methodToInline, ldci4.GetLdcI4Value(), out int newValue))
return false;

block.Instructions[instrIndex - 1] = new Instr(OpCodes.Nop.ToInstruction());
block.Instructions[instrIndex] = new Instr(Instruction.CreateLdcI4(newValue));
block.Instructions[instrIndex - 1].Instruction.OpCode = OpCodes.Nop;
var newLdc = Instruction.CreateLdcI4(newValue);
block.Instructions[instrIndex].Instruction.OpCode = newLdc.OpCode;
block.Instructions[instrIndex].Instruction.Operand = newLdc.Operand;
return true;
}

Expand Down Expand Up @@ -171,6 +173,10 @@ bool GetNewValue(MethodDef method, int arg, out int newValue) {
case Code.Sub:
case Code.Xor:
case Code.Or:
case Code.Shl:
case Code.Shr:
case Code.Neg:
case Code.Not:
case Code.Nop:
case Code.Dup:
case Code.Mul:
Expand Down
3 changes: 3 additions & 0 deletions de4dot.code/deobfuscators/Babel_NET/StringDecrypter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ IDecrypterInfo CheckNested(TypeDef type, TypeDef nested) {
// Check for string,int variant with 3 nested fields and key length 16.
// When .NET Reactor was applied on top, field count is +1 due to an extraneous object field.
if (CheckFields(nested, "System.Byte[]", nested)) {
if (BabelUtils.IsChainedObfuscation(nested.FindMethod(".ctor")))
return null;

var nestedDecrypter16 = DotNetUtils.GetMethod(nested, "System.String", "(System.String,System.Int32)");
if (nestedDecrypter16 is { IsStatic: false }) {
var decrypter16 = DotNetUtils.GetMethod(type, "System.String", "(System.String,System.Int32)");
Expand Down
Loading