Exemplo n.º 1
0
        bool unpackNativeImage(IEnumerable <IDeobfuscator> deobfuscators)
        {
            var peImage = new PeImage(Utils.readFile(Filename));

            foreach (var deob in deobfuscators)
            {
                byte[] unpackedData = null;
                try {
                    unpackedData = deob.unpackNativeFile(peImage);
                }
                catch {
                }
                if (unpackedData == null)
                {
                    continue;
                }

                try {
                    module = assemblyModule.load(unpackedData);
                }
                catch {
                    Log.w("Could not load unpacked data. Deobfuscator: {0}", deob.TypeLong);
                    continue;
                }
                this.deob = deob;
                return(true);
            }

            return(false);
        }
        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);
        }