Ejemplo n.º 1
0
        bool CheckMcKeyRva(MyPEImage peImage, uint newXorKey)
        {
            xorKey = newXorKey;
            uint rva = GetMcKeyRva();

            return((rva & 0xFFF) == 0 && peImage.FindSection((RVA)rva) != null);
        }
Ejemplo n.º 2
0
        static EncryptionVersion GetHeaderOffsetAndVersion(MyPEImage peImage, out uint headerOffset)
        {
            headerOffset = 0;

            var version = GetVersion(peImage, headerOffset);

            if (version != EncryptionVersion.Unknown)
            {
                return(version);
            }

            var section = peImage.FindSection(".rsrc");

            if (section != null)
            {
                version = GetHeaderOffsetAndVersion(section, peImage, out headerOffset);
                if (version != EncryptionVersion.Unknown)
                {
                    return(version);
                }
            }

            foreach (var section2 in peImage.Sections)
            {
                version = GetHeaderOffsetAndVersion(section2, peImage, out headerOffset);
                if (version != EncryptionVersion.Unknown)
                {
                    return(version);
                }
            }

            return(EncryptionVersion.Unknown);
        }
Ejemplo n.º 3
0
        static ImageSectionHeader GetLastOf(MyPEImage peImage, string[] sections)
        {
            ImageSectionHeader sect = null;

            foreach (var name in sections)
            {
                var sect2 = peImage.FindSection(name);
                if (sect2 == null)
                {
                    continue;
                }
                if (sect == null || sect2.VirtualAddress > sect.VirtualAddress)
                {
                    sect = sect2;
                }
            }
            return(sect);
        }
Ejemplo n.º 4
0
		static ImageSectionHeader GetLastOf(MyPEImage peImage, string[] sections) {
			ImageSectionHeader sect = null;
			foreach (var name in sections) {
				var sect2 = peImage.FindSection(name);
				if (sect2 == null)
					continue;
				if (sect == null || sect2.VirtualAddress > sect.VirtualAddress)
					sect = sect2;
			}
			return sect;
		}
Ejemplo n.º 5
0
		static EncryptionVersion GetHeaderOffsetAndVersion(MyPEImage peImage, out uint headerOffset) {
			headerOffset = 0;

			var version = GetVersion(peImage, headerOffset);
			if (version != EncryptionVersion.Unknown)
				return version;

			var section = peImage.FindSection(".rsrc");
			if (section != null) {
				version = GetHeaderOffsetAndVersion(section, peImage, out headerOffset);
				if (version != EncryptionVersion.Unknown)
					return version;
			}

			foreach (var section2 in peImage.Sections) {
				version = GetHeaderOffsetAndVersion(section2, peImage, out headerOffset);
				if (version != EncryptionVersion.Unknown)
					return version;
			}

			return EncryptionVersion.Unknown;
		}
Ejemplo n.º 6
0
		bool CheckMcKeyRva(MyPEImage peImage, uint newXorKey) {
			xorKey = newXorKey;
			uint rva = GetMcKeyRva();
			return (rva & 0xFFF) == 0 && peImage.FindSection((RVA)rva) != null;
		}