diff --git a/de4dot.code/deobfuscators/DeobUtils.cs b/de4dot.code/deobfuscators/DeobUtils.cs index 6335934a..4332f8a7 100644 --- a/de4dot.code/deobfuscators/DeobUtils.cs +++ b/de4dot.code/deobfuscators/DeobUtils.cs @@ -162,5 +162,19 @@ namespace de4dot.code.deobfuscators { ((int)reader.ReadByte() << 8) + reader.ReadByte(); } + + public static bool hasInteger(MethodDefinition method, uint value) { + return hasInteger(method, (int)value); + } + + public static bool hasInteger(MethodDefinition method, int value) { + foreach (var instr in method.Body.Instructions) { + if (!DotNetUtils.isLdcI4(instr)) + continue; + if (DotNetUtils.getLdcI4Value(instr) == value) + return true; + } + return false; + } } }