VmOpCodeHandlerDetector getVmOpCodeHandlerDetector() { var vmFilename = vmAssemblyReference.Name + ".dll"; var vmModulePath = Path.Combine(Path.GetDirectoryName(module.FullyQualifiedName), vmFilename); Log.v("CSVM filename: {0}", vmFilename); var dataKey = "cs cached VmOpCodeHandlerDetector"; var dict = (Dictionary <string, VmOpCodeHandlerDetector>)deobfuscatorContext.getData(dataKey); if (dict == null) { deobfuscatorContext.setData(dataKey, dict = new Dictionary <string, VmOpCodeHandlerDetector>(StringComparer.OrdinalIgnoreCase)); } VmOpCodeHandlerDetector detector; if (dict.TryGetValue(vmModulePath, out detector)) { return(detector); } dict[vmModulePath] = detector = new VmOpCodeHandlerDetector(ModuleDefinition.ReadModule(vmModulePath)); detector.findHandlers(); Log.v("CSVM opcodes:"); Log.indent(); for (int i = 0; i < detector.Handlers.Count; i++) { Log.v("{0:X4}: {1}", i, detector.Handlers[i].Name); } Log.deIndent(); return(detector); }
public CsvmToCilMethodConverter(IDeobfuscatorContext deobfuscatorContext, ModuleDefinition module, VmOpCodeHandlerDetector opCodeDetector) { this.deobfuscatorContext = deobfuscatorContext; this.module = module; this.opCodeDetector = opCodeDetector; }
VmOpCodeHandlerDetector getVmOpCodeHandlerDetector() { var vmFilename = vmAssemblyReference.Name + ".dll"; var vmModulePath = Path.Combine(Path.GetDirectoryName(module.FullyQualifiedName), vmFilename); Log.v("CSVM filename: {0}", vmFilename); var dataKey = "cs cached VmOpCodeHandlerDetector"; var dict = (Dictionary<string, VmOpCodeHandlerDetector>)deobfuscatorContext.getData(dataKey); if (dict == null) deobfuscatorContext.setData(dataKey, dict = new Dictionary<string, VmOpCodeHandlerDetector>(StringComparer.OrdinalIgnoreCase)); VmOpCodeHandlerDetector detector; if (dict.TryGetValue(vmModulePath, out detector)) return detector; dict[vmModulePath] = detector = new VmOpCodeHandlerDetector(ModuleDefinition.ReadModule(vmModulePath)); detector.findHandlers(); Log.v("CSVM opcodes:"); Log.indent(); for (int i = 0; i < detector.Handlers.Count; i++) Log.v("{0:X4}: {1}", i, detector.Handlers[i].Name); Log.deIndent(); return detector; }