public void CloseServer() {
			if (dynocode != null)
				dynocode.Dispose();
			dynocode = null;
		}
		bool FindConstants(ISimpleDeobfuscator simpleDeobfuscator) {
			dynocode = new DynamicDynocodeIterator();
			simpleDeobfuscator.Deobfuscate(stringMethod);
			stringMethodConsts = new EfConstantsReader(stringMethod);

			if (!FindResource(stringMethod))
				return false;

			checkMinus2 = isV32OrLater || DeobUtils.HasInteger(stringMethod, -2);
			usePublicKeyToken = CallsGetPublicKeyToken(stringMethod);

			var int64Method = FindInt64Method(stringMethod);
			if (int64Method != null)
				decrypterType.Type = int64Method.DeclaringType;

			if (!FindShorts())
				return false;
			if (!FindInt3())
				return false;
			if (!FindInt4())
				return false;
			if (checkMinus2 && !FindInt5())
				return false;

			// The method body of the data decrypter method has been moved into
			// the string decrypter helper method in 5.0
			if (!isV50OrLater) {
				dataDecrypterType = FindDataDecrypterType(stringMethod);
				if (dataDecrypterType == null)
					return false;
			}

			if (isV32OrLater) {
				bool initializedAll;
				int index = FindInitIntsIndex(stringMethod, out initializedAll);

				var cctor = stringType.FindStaticConstructor();
				if (!initializedAll && cctor != null) {
					simpleDeobfuscator.Deobfuscate(cctor);
					if (!FindIntsCctor(cctor))
						return false;
				}

				if (decrypterType.Detected && !decrypterType.Initialize())
					return false;

				if (!isV50OrLater) {
					decrypterType.ShiftConsts = new List<int> { 24, 16, 8, 0, 16, 8, 0, 24 };
				}
				else {
					List<int> shiftConsts;
					if (!FindShiftInts(decrypterType.Int64Method, out shiftConsts))
						return false;

					decrypterType.ShiftConsts = shiftConsts;
				}

				if (!FindInts(index))
					return false;
			}


			InitializeFlags();
			Initialize();

			return true;
		}
Beispiel #3
0
		bool FindConstants(ISimpleDeobfuscator simpleDeobfuscator) {
			dynocode = new DynamicDynocodeIterator();
			simpleDeobfuscator.Deobfuscate(stringMethod);
			stringMethodConsts = new EfConstantsReader(stringMethod);

			if (!FindResource(stringMethod))
				return false;

			checkMinus2 = isV32OrLater || DeobUtils.HasInteger(stringMethod, -2);
			usePublicKeyToken = CallsGetPublicKeyToken(stringMethod);

			var int64Method = FindInt64Method(stringMethod);
			if (int64Method != null)
				decrypterType.Type = int64Method.DeclaringType;

			if (!FindShorts())
				return false;
			if (!FindInt3())
				return false;
			if (!FindInt4())
				return false;
			if (checkMinus2 && !FindInt5())
				return false;
			dataDecrypterType = FindDataDecrypterType(stringMethod);
			if (dataDecrypterType == null)
				return false;

			if (isV32OrLater) {
				bool initializedAll;
				int index = FindInitIntsIndex(stringMethod, out initializedAll);

				var cctor = stringType.FindStaticConstructor();
				if (!initializedAll && cctor != null) {
					simpleDeobfuscator.Deobfuscate(cctor);
					if (!FindIntsCctor(cctor))
						return false;
				}

				if (decrypterType.Detected && !decrypterType.Initialize())
					return false;

				if (!FindInts(index))
					return false;
			}

			InitializeFlags();
			Initialize();

			return true;
		}