Esempio n. 1
0
AFC_FOPEN_RW = 0x00000002  #/**< r+  O_RDWR   | O_CREAT */
AFC_FOPEN_WRONLY = 0x00000003  #/**< w   O_WRONLY | O_CREAT  | O_TRUNC */
AFC_FOPEN_WR = 0x00000004  #/**< w+  O_RDWR   | O_CREAT  | O_TRUNC */
AFC_FOPEN_APPEND = 0x00000005  #/**< a   O_WRONLY | O_APPEND | O_CREAT */
AFC_FOPEN_RDAPPEND = 0x00000006  #/**< a+  O_RDWR   | O_APPEND | O_CREAT */

AFC_HARDLINK = 1
AFC_SYMLINK = 2

AFC_LOCK_SH = 1 | 4  #/**< shared lock */
AFC_LOCK_EX = 2 | 4  #/**< exclusive lock */
AFC_LOCK_UN = 8 | 4  #/**< unlock */

AFCMAGIC = "CFA6LPAA"
AFCPacket = Struct("AFCPacket", String(
    "magic",
    8,
), ULInt64("entire_length"), ULInt64("this_length"), ULInt64("packet_num"),
                   ULInt64("operation"))


class AFCClient(object):
    def __init__(self,
                 lockdown=None,
                 serviceName="com.apple.afc",
                 service=None,
                 udid=None,
                 logger=None):
        self.logger = logger or logging.getLogger(__name__)
        self.serviceName = serviceName
        self.lockdown = lockdown if lockdown else LockdownClient(udid=udid)
        self.service = service if service else self.lockdown.startService(
Esempio n. 2
0
AFC_FOPEN_WRONLY   = 0x00000003  # w   O_WRONLY | O_CREAT  | O_TRUNC
AFC_FOPEN_WR       = 0x00000004  # w+  O_RDWR   | O_CREAT  | O_TRUNC
AFC_FOPEN_APPEND   = 0x00000005  # a   O_WRONLY | O_APPEND | O_CREAT
AFC_FOPEN_RDAPPEND = 0x00000006  # a+  O_RDWR   | O_APPEND | O_CREAT

AFC_HARDLINK = 1
AFC_SYMLINK  = 2

AFC_LOCK_SH = 1 | 4  # shared lock
AFC_LOCK_EX = 2 | 4  # exclusive lock
AFC_LOCK_UN = 8 | 4  # unlock


AFCMAGIC = "CFA6LPAA"
AFCPacket = Struct("AFCPacket",
                   String("magic", 8,),
                   ULInt64("entire_length"),
                   ULInt64("this_length"),
                   ULInt64("packet_num"),
                   ULInt64("operation")
                   )
#typedef struct {
#    uint64_t filehandle, size;
#} AFCFilePacket;


class AFCError(IOError):
    lookup_table = {
        AFC_E_SUCCESS: "Success",
        AFC_E_UNKNOWN_ERROR: "Unknown error",
        AFC_E_OP_HEADER_INVALID: "OP header invalid",
Esempio n. 3
0
import struct

from construct import Array
from construct.core import Struct
from construct.macros import ULInt32, String, ULInt8, ULInt16

from crypto.aes import AESdecryptCBC
from util import hexdump

WHIMORY_SIGNATURE_MAGIC = "xrmw"

WHIMORY_SIGNATURE_VER_PPN_CUR = 7

PPNSignature = Struct(
    "PPNSignature",
    String("magic", 4),
    ULInt32("f4"),
    ULInt32("whimory_ver_at_birth"),
    ULInt32("ftl_major_version"),
    ULInt32("ftl_minor_version"),
    ULInt32("xxx"),
    ULInt32("vfl_major_version"),
    ULInt32("vfl_minor_version"),
    ULInt32("f20"),
    ULInt32("FPart_major"),
    ULInt32("f22"),
    ULInt32("f23"),
    ULInt32("f24"),
    ULInt32("geometry_num_ce"),
)