Ejemplo 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);
            }
        }
Ejemplo n.º 2
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);
 }
        public EmbeddedResource MergeResources()
        {
            if (encryptedResource == null)
            {
                return(null);
            }
            DeobUtils.DecryptAndAddResources(module, encryptedResource.Name.String, () => DecryptResourceAssembly());
            var result = encryptedResource;

            encryptedResource = null;
            return(result);
        }
Ejemplo n.º 4
0
        public EmbeddedResource MergeResources()
        {
            if (resource == null)
            {
                return(null);
            }
            DeobUtils.DecryptAndAddResources(module, resource.Name.String, () => DecryptResource());
            var tmpResource = resource;

            resource = null;
            return(tmpResource);
        }
Ejemplo n.º 5
0
        public EmbeddedResource MergeResources()
        {
            if (rsrcResolveMethod == null)
            {
                return(null);
            }
            var resource = DotNetUtils.GetResource(module, DotNetUtils.GetCodeStrings(rsrcResolveMethod)) as EmbeddedResource;

            if (resource == null)
            {
                return(null);
            }
            DeobUtils.DecryptAndAddResources(module, resource.Name.String, () => DecryptResource(resource));
            return(resource);
        }
Ejemplo n.º 6
0
        bool DecryptResource(FieldDef resourceField, int magic)
        {
            if (resourceField == null)
            {
                return(false);
            }

            string name = $"Embedded data field {resourceField.MDToken.ToInt32():X8} RVA {(uint)resourceField.RVA:X8}";

            DeobUtils.DecryptAndAddResources(module, name, () => DecryptResourceV4(resourceField.InitialValue, magic));
            resourceField.InitialValue  = new byte[1];
            resourceField.FieldSig.Type = module.CorLibTypes.Byte;
            resourceField.RVA           = 0;
            return(true);
        }
Ejemplo n.º 7
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($"Could not find resource assembly {Utils.ToCsharpString(asmName)}");
                }

                DeobUtils.DecryptAndAddResources(module, asmInfo.ResourceName, () => asmInfo.Data);
                list.Add(asmInfo);
            }
            resourceInfos.Clear();
            return(list);
        }
Ejemplo n.º 8
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.String, () => resourceDecrypter.Decrypt(resource.CreateReader().AsStream()));
            mergedIt = true;
            return(resource);
        }
        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);
        }
Ejemplo n.º 10
0
 public EmbeddedResource MergeResources()
 {
     if (encryptedResource.Resource == null)
     {
         return(null);
     }
     DeobUtils.DecryptAndAddResources(module, encryptedResource.Resource.Name.String, () => {
         try {
             return(QuickLZ.Decompress(encryptedResource.Decrypt()));
         }
         catch {
             try {
                 return(DeobUtils.Inflate(encryptedResource.Decrypt(), true));
             }
             catch {
                 return(null);
             }
         }
     });
     return(encryptedResource.Resource);
 }