Exemplo n.º 1
0
        public bool mergeResources(out EmbeddedResource rsrc)
        {
            rsrc = null;

            switch (version)
            {
            case ResourceVersion.V3:
                if (data30.resource == null)
                {
                    return(false);
                }

                DeobUtils.decryptAndAddResources(module, data30.resource.Name.String, () => decryptResourceV3(data30.resource));
                rsrc = data30.resource;
                return(true);

            case ResourceVersion.V40:
                return(decryptResource(data40.resourceField, data40.magic));

            case ResourceVersion.V41:
                return(decryptResource(data41.resourceField, data41.magic));

            default:
                return(true);
            }
        }
Exemplo n.º 2
0
        public bool mergeResources(out EmbeddedResource rsrc)
        {
            rsrc = null;

            if (isV3)
            {
                if (resource == null)
                {
                    return(false);
                }

                DeobUtils.decryptAndAddResources(module, resource.Name, () => decryptResourceV3(resource));
                rsrc = resource;
            }
            else
            {
                if (resourceField == null)
                {
                    return(false);
                }

                string name = string.Format("Embedded data field {0:X8} RVA {1:X8}", resourceField.MetadataToken.ToInt32(), resourceField.RVA);
                DeobUtils.decryptAndAddResources(module, name, () => decryptResourceV4(resourceField.InitialValue, magicV4));
                resourceField.InitialValue = new byte[1];
                resourceField.FieldType    = module.TypeSystem.Byte;
            }
            return(true);
        }
Exemplo n.º 3
0
		public EmbeddedResource mergeResources() {
			if (encryptedResource.Resource == null)
				return null;
			DeobUtils.decryptAndAddResources(module, encryptedResource.Resource.Name, () => {
				return QuickLZ.decompress(encryptedResource.decrypt());
			});
			return encryptedResource.Resource;
		}
Exemplo n.º 4
0
 public EmbeddedResource mergeResources()
 {
     if (encryptedResource.Resource == null)
     {
         return(null);
     }
     DeobUtils.decryptAndAddResources(module, encryptedResource.Resource.Name.String, () => {
         return(QuickLZ.decompress(encryptedResource.decrypt()));
     });
     return(encryptedResource.Resource);
 }
Exemplo n.º 5
0
        public EmbeddedResource mergeResources()
        {
            if (encryptedResource == null)
            {
                return(null);
            }
            DeobUtils.decryptAndAddResources(module, encryptedResource.Name, () => decryptResourceAssembly());
            var result = encryptedResource;

            encryptedResource = null;
            return(result);
        }
Exemplo n.º 6
0
		public List<AssemblyResolver.AssemblyInfo> mergeResources() {
			var list = new List<AssemblyResolver.AssemblyInfo>();
			foreach (var asmName in resourceInfos) {
				var asmInfo = assemblyResolver.get(asmName);
				if (asmInfo == null)
					throw new ApplicationException(string.Format("Could not find resource assembly {0}", Utils.toCsharpString(asmName)));

				DeobUtils.decryptAndAddResources(module, asmInfo.ResourceName, () => asmInfo.Data);
				list.Add(asmInfo);
			}
			resourceInfos.Clear();
			return list;
		}
Exemplo n.º 7
0
        bool decryptResource(FieldDefinition resourceField, int magic)
        {
            if (resourceField == null)
            {
                return(false);
            }

            string name = string.Format("Embedded data field {0:X8} RVA {1:X8}", resourceField.MetadataToken.ToInt32(), resourceField.RVA);

            DeobUtils.decryptAndAddResources(module, name, () => decryptResourceV4(resourceField.InitialValue, magic));
            resourceField.InitialValue = new byte[1];
            resourceField.FieldType    = module.TypeSystem.Byte;
            return(true);
        }
Exemplo n.º 8
0
        public EmbeddedResource mergeResources()
        {
            if (rsrcDecryptMethod == null)
            {
                return(null);
            }
            var resource = DotNetUtils.getResource(module, DotNetUtils.getCodeStrings(rsrcDecryptMethod)) as EmbeddedResource;

            if (resource == null)
            {
                return(null);
            }
            DeobUtils.decryptAndAddResources(module, resource.Name, () => decryptResource(resource));
            return(resource);
        }
Exemplo n.º 9
0
        public EmbeddedResource mergeResources()
        {
            if (mergedIt)
            {
                return(null);
            }

            var resource = DotNetUtils.getResource(module, getResourceNames()) as EmbeddedResource;

            if (resource == null)
            {
                return(null);
            }

            DeobUtils.decryptAndAddResources(module, resource.Name, () => resourceDecrypter.decrypt(resource.GetResourceStream()));
            mergedIt = true;
            return(resource);
        }
Exemplo n.º 10
0
        public EmbeddedAssemblyInfo mergeResources()
        {
            if (mergedIt)
            {
                return(null);
            }

            var info = resourceResolverInfo.ResourceInfo;

            if (info == null)
            {
                return(null);
            }

            DeobUtils.decryptAndAddResources(module, info.resourceName, () => assemblyResolver.removeDecryptedResource(info));
            mergedIt = true;
            return(info);
        }