예제 #1
0
        VmOpCodeHandlerDetector GetVmOpCodeHandlerDetector()
        {
            var vmFilename   = vmAssemblyRef.Name + ".dll";
            var vmModulePath = Path.Combine(Path.GetDirectoryName(module.Location), vmFilename);

            Logger.v("CSVM filename: {0}", vmFilename);

            var dataKey = "cs cached VmOpCodeHandlerDetector v2";
            var dict    = (Dictionary <string, VmOpCodeHandlerDetector>)deobfuscatorContext.GetData(dataKey);

            if (dict == null)
            {
                deobfuscatorContext.SetData(dataKey, dict = new Dictionary <string, VmOpCodeHandlerDetector>(StringComparer.OrdinalIgnoreCase));
            }
            if (dict.TryGetValue(vmModulePath, out var detector))
            {
                return(detector);
            }
            dict[vmModulePath] = detector = new VmOpCodeHandlerDetector(ModuleDefMD.Load(vmModulePath));

            detector.FindHandlers();
            Logger.v("CSVM opcodes: {0}", detector.Handlers.Count);
            Logger.Instance.Indent();
            for (int i = 0; i < detector.Handlers.Count; i++)
            {
                Logger.v("{0:X4}: {1}", i, detector.Handlers[i]);
            }
            Logger.Instance.DeIndent();

            return(detector);
        }
		public CsvmToCilMethodConverter(IDeobfuscatorContext deobfuscatorContext, ModuleDefMD module, VmOpCodeHandlerDetector opCodeDetector)
			: base(deobfuscatorContext, module) {
			this.opCodeDetector = opCodeDetector;
		}
예제 #3
0
 public CsvmToCilMethodConverter(IDeobfuscatorContext deobfuscatorContext, ModuleDefMD module, VmOpCodeHandlerDetector opCodeDetector)
     : base(deobfuscatorContext, module) => this.opCodeDetector = opCodeDetector;
예제 #4
0
		VmOpCodeHandlerDetector GetVmOpCodeHandlerDetector() {
			var vmFilename = vmAssemblyRef.Name + ".dll";
			var vmModulePath = Path.Combine(Path.GetDirectoryName(module.Location), vmFilename);
			Logger.v("CSVM filename: {0}", vmFilename);

			var dataKey = "cs cached VmOpCodeHandlerDetector v2";
			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(ModuleDefMD.Load(vmModulePath));

			detector.FindHandlers();
			Logger.v("CSVM opcodes: {0}", detector.Handlers.Count);
			Logger.Instance.Indent();
			for (int i = 0; i < detector.Handlers.Count; i++)
				Logger.v("{0:X4}: {1}", i, detector.Handlers[i]);
			Logger.Instance.DeIndent();

			return detector;
		}