Exemplo n.º 1
0
        bool UnpackNativeImage(IEnumerable <IDeobfuscator> deobfuscators)
        {
            using (var peImage = new PEImage(Filename)) {
                foreach (var deob in deobfuscators)
                {
                    byte[] unpackedData = null;
                    try {
                        unpackedData = deob.UnpackNativeFile(peImage);
                    }
                    catch {
                    }
                    if (unpackedData == null)
                    {
                        continue;
                    }

                    var oldModule = module;
                    try {
                        module = assemblyModule.Load(unpackedData);
                    }
                    catch {
                        Logger.w("Could not load unpacked data. File: {0}, deobfuscator: {0}", peImage.FileName ?? "(unknown filename)", deob.TypeLong);
                        continue;
                    }
                    finally {
                        if (oldModule != null)
                        {
                            oldModule.Dispose();
                        }
                    }
                    this.deob = deob;
                    return(true);
                }
            }

            return(false);
        }