Macho加密判断

This commit is contained in:
Perfare 2020-06-19 01:22:21 +08:00
parent 6200b9e84a
commit 4dc37fa71e
2 changed files with 73 additions and 53 deletions

View file

@ -25,8 +25,9 @@ namespace Il2CppDumper
var pos = Position; var pos = Position;
var cmd = ReadUInt32(); var cmd = ReadUInt32();
var cmdsize = ReadUInt32(); var cmdsize = ReadUInt32();
if (cmd == 1) //LC_SEGMENT switch (cmd)
{ {
case 1: //LC_SEGMENT
var segname = Encoding.UTF8.GetString(ReadBytes(16)).TrimEnd('\0'); var segname = Encoding.UTF8.GetString(ReadBytes(16)).TrimEnd('\0');
if (segname == "__TEXT") //__PAGEZERO if (segname == "__TEXT") //__PAGEZERO
{ {
@ -53,6 +54,15 @@ namespace Il2CppDumper
section.end = section.addr + section.size; section.end = section.addr + section.size;
Position += 8; //skip reserved1, reserved2 Position += 8; //skip reserved1, reserved2
} }
break;
case 0x21: //LC_ENCRYPTION_INFO
Position += 8;
var cryptID = ReadUInt32();
if (cryptID != 0)
{
Console.WriteLine("ERROR: This Mach-O executable is encrypted and cannot be processed.");
}
break;
} }
Position = pos + cmdsize;//next Position = pos + cmdsize;//next
} }

View file

@ -24,8 +24,9 @@ namespace Il2CppDumper
var pos = Position; var pos = Position;
var cmd = ReadUInt32(); var cmd = ReadUInt32();
var cmdsize = ReadUInt32(); var cmdsize = ReadUInt32();
if (cmd == 0x19) //LC_SEGMENT_64 switch (cmd)
{ {
case 0x19: //LC_SEGMENT_64
var segname = Encoding.UTF8.GetString(ReadBytes(16)).TrimEnd('\0'); var segname = Encoding.UTF8.GetString(ReadBytes(16)).TrimEnd('\0');
if (segname == "__TEXT") //__PAGEZERO if (segname == "__TEXT") //__PAGEZERO
{ {
@ -52,6 +53,15 @@ namespace Il2CppDumper
section.end = section.addr + section.size; section.end = section.addr + section.size;
Position += 12; //skip reserved1, reserved2, reserved3 Position += 12; //skip reserved1, reserved2, reserved3
} }
break;
case 0x2C: //LC_ENCRYPTION_INFO_64
Position += 8;
var cryptID = ReadUInt32();
if (cryptID != 0)
{
Console.WriteLine("ERROR: This Mach-O executable is encrypted and cannot be processed.");
}
break;
} }
Position = pos + cmdsize;//skip Position = pos + cmdsize;//skip
} }