예제 #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 v1";
            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:");
            Logger.Instance.Indent();
            for (int i = 0; i < detector.Handlers.Count; i++)
            {
                Logger.v("{0:X4}: {1}", i, detector.Handlers[i].Name);
            }
            Logger.Instance.DeIndent();

            return(detector);
        }
예제 #2
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 v1";
			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:");
			Logger.Instance.Indent();
			for (int i = 0; i < detector.Handlers.Count; i++)
				Logger.v("{0:X4}: {1}", i, detector.Handlers[i].Name);
			Logger.Instance.DeIndent();

			return detector;
		}
		public CsvmToCilMethodConverter(IDeobfuscatorContext deobfuscatorContext, ModuleDefMD module, VmOpCodeHandlerDetector opCodeDetector)
			: base(deobfuscatorContext, module) {
			this.opCodeDetector = opCodeDetector;
		}
 public CsvmToCilMethodConverter(IDeobfuscatorContext deobfuscatorContext, ModuleDefMD module, VmOpCodeHandlerDetector opCodeDetector)
     : base(deobfuscatorContext, module)
 {
     this.opCodeDetector = opCodeDetector;
 }