<legend id='HqaL2'><style id='HqaL2'><dir id='HqaL2'><q id='HqaL2'></q></dir></style></legend>

      <bdo id='HqaL2'></bdo><ul id='HqaL2'></ul>

      1. <tfoot id='HqaL2'></tfoot>
      2. <i id='HqaL2'><tr id='HqaL2'><dt id='HqaL2'><q id='HqaL2'><span id='HqaL2'><b id='HqaL2'><form id='HqaL2'><ins id='HqaL2'></ins><ul id='HqaL2'></ul><sub id='HqaL2'></sub></form><legend id='HqaL2'></legend><bdo id='HqaL2'><pre id='HqaL2'><center id='HqaL2'></center></pre></bdo></b><th id='HqaL2'></th></span></q></dt></tr></i><div id='HqaL2'><tfoot id='HqaL2'></tfoot><dl id='HqaL2'><fieldset id='HqaL2'></fieldset></dl></div>

        <small id='HqaL2'></small><noframes id='HqaL2'>

        如何在 iOS 4.0 iTunes 备份中解析 Manifest.mbdb 文件

        时间:2023-10-03

        <tfoot id='1j6RN'></tfoot>

          <bdo id='1j6RN'></bdo><ul id='1j6RN'></ul>

                1. <small id='1j6RN'></small><noframes id='1j6RN'>

                  <i id='1j6RN'><tr id='1j6RN'><dt id='1j6RN'><q id='1j6RN'><span id='1j6RN'><b id='1j6RN'><form id='1j6RN'><ins id='1j6RN'></ins><ul id='1j6RN'></ul><sub id='1j6RN'></sub></form><legend id='1j6RN'></legend><bdo id='1j6RN'><pre id='1j6RN'><center id='1j6RN'></center></pre></bdo></b><th id='1j6RN'></th></span></q></dt></tr></i><div id='1j6RN'><tfoot id='1j6RN'></tfoot><dl id='1j6RN'><fieldset id='1j6RN'></fieldset></dl></div>
                    <tbody id='1j6RN'></tbody>
                  <legend id='1j6RN'><style id='1j6RN'><dir id='1j6RN'><q id='1j6RN'></q></dir></style></legend>
                  本文介绍了如何在 iOS 4.0 iTunes 备份中解析 Manifest.mbdb 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 iOS 4.0 中,Apple 重新设计了备份过程.

                  In iOS 4.0 Apple has redesigned the backup process.

                  iTunes 用于将与备份文件关联的文件名列表存储在 Manifest.plist 文件中,但在 iOS 4.0 中,它已将此信息移动到 Manifest.mbdb

                  iTunes used to store a list of filenames associated with backup files in the Manifest.plist file, but in iOS 4.0 it has moved this information to a Manifest.mbdb

                  您可以通过使用 iOS 4.0 设备进行备份并查看 ~/Library/Application Support/MobileSync/Backup 文件夹来查看此文件的示例(查看最近日期的子文件夹)

                  You can see an example of this file by making a backup with your iOS 4.0 devices and looking in your ~/Library/Application Support/MobileSync/Backup folder (Look inside the subfolders with the most recent date)

                  这是文件在文本编辑器中的截图:

                  Here's a screenshot of what the file looks like in a text editor:


                  (来源:supercrazyawesome.com)

                  如何将其解析为 Cocoa 应用程序,以便更新我的(免费)iPhone Backup Extractor 应用程序 (http://supercrazyawesome.com) 适用于 iOS 4.0?

                  How do I parse this into a Cocoa application so that I can update my (free) iPhone Backup Extractor app (http://supercrazyawesome.com) for iOS 4.0?

                  推荐答案

                  谢谢 user374559 和 reneD -- 代码和描述很有帮助.

                  Thank you, user374559 and reneD -- that code and description is very helpful.

                  我尝试了一些 Python 来解析并打印出类似 Unix ls-l 格式的信息:

                  My stab at some Python to parse and print out the information in a Unix ls-l like format:

                  #!/usr/bin/env python
                  import sys
                  
                  def getint(data, offset, intsize):
                      """Retrieve an integer (big-endian) and new offset from the current offset"""
                      value = 0
                      while intsize > 0:
                          value = (value<<8) + ord(data[offset])
                          offset = offset + 1
                          intsize = intsize - 1
                      return value, offset
                  
                  def getstring(data, offset):
                      """Retrieve a string and new offset from the current offset into the data"""
                      if data[offset] == chr(0xFF) and data[offset+1] == chr(0xFF):
                          return '', offset+2 # Blank string
                      length, offset = getint(data, offset, 2) # 2-byte length
                      value = data[offset:offset+length]
                      return value, (offset + length)
                  
                  def process_mbdb_file(filename):
                      mbdb = {} # Map offset of info in this file => file info
                      data = open(filename).read()
                      if data[0:4] != "mbdb": raise Exception("This does not look like an MBDB file")
                      offset = 4
                      offset = offset + 2 # value x05 x00, not sure what this is
                      while offset < len(data):
                          fileinfo = {}
                          fileinfo['start_offset'] = offset
                          fileinfo['domain'], offset = getstring(data, offset)
                          fileinfo['filename'], offset = getstring(data, offset)
                          fileinfo['linktarget'], offset = getstring(data, offset)
                          fileinfo['datahash'], offset = getstring(data, offset)
                          fileinfo['unknown1'], offset = getstring(data, offset)
                          fileinfo['mode'], offset = getint(data, offset, 2)
                          fileinfo['unknown2'], offset = getint(data, offset, 4)
                          fileinfo['unknown3'], offset = getint(data, offset, 4)
                          fileinfo['userid'], offset = getint(data, offset, 4)
                          fileinfo['groupid'], offset = getint(data, offset, 4)
                          fileinfo['mtime'], offset = getint(data, offset, 4)
                          fileinfo['atime'], offset = getint(data, offset, 4)
                          fileinfo['ctime'], offset = getint(data, offset, 4)
                          fileinfo['filelen'], offset = getint(data, offset, 8)
                          fileinfo['flag'], offset = getint(data, offset, 1)
                          fileinfo['numprops'], offset = getint(data, offset, 1)
                          fileinfo['properties'] = {}
                          for ii in range(fileinfo['numprops']):
                              propname, offset = getstring(data, offset)
                              propval, offset = getstring(data, offset)
                              fileinfo['properties'][propname] = propval
                          mbdb[fileinfo['start_offset']] = fileinfo
                      return mbdb
                  
                  def process_mbdx_file(filename):
                      mbdx = {} # Map offset of info in the MBDB file => fileID string
                      data = open(filename).read()
                      if data[0:4] != "mbdx": raise Exception("This does not look like an MBDX file")
                      offset = 4
                      offset = offset + 2 # value 0x02 0x00, not sure what this is
                      filecount, offset = getint(data, offset, 4) # 4-byte count of records 
                      while offset < len(data):
                          # 26 byte record, made up of ...
                          fileID = data[offset:offset+20] # 20 bytes of fileID
                          fileID_string = ''.join(['%02x' % ord(b) for b in fileID])
                          offset = offset + 20
                          mbdb_offset, offset = getint(data, offset, 4) # 4-byte offset field
                          mbdb_offset = mbdb_offset + 6 # Add 6 to get past prolog
                          mode, offset = getint(data, offset, 2) # 2-byte mode field
                          mbdx[mbdb_offset] = fileID_string
                      return mbdx
                  
                  def modestr(val):
                      def mode(val):
                          if (val & 0x4): r = 'r'
                          else: r = '-'
                          if (val & 0x2): w = 'w'
                          else: w = '-'
                          if (val & 0x1): x = 'x'
                          else: x = '-'
                          return r+w+x
                      return mode(val>>6) + mode((val>>3)) + mode(val)
                  
                  def fileinfo_str(f, verbose=False):
                      if not verbose: return "(%s)%s::%s" % (f['fileID'], f['domain'], f['filename'])
                      if (f['mode'] & 0xE000) == 0xA000: type = 'l' # symlink
                      elif (f['mode'] & 0xE000) == 0x8000: type = '-' # file
                      elif (f['mode'] & 0xE000) == 0x4000: type = 'd' # dir
                      else: 
                          print >> sys.stderr, "Unknown file type %04x for %s" % (f['mode'], fileinfo_str(f, False))
                          type = '?' # unknown
                      info = ("%s%s %08x %08x %7d %10d %10d %10d (%s)%s::%s" % 
                              (type, modestr(f['mode']&0x0FFF) , f['userid'], f['groupid'], f['filelen'], 
                               f['mtime'], f['atime'], f['ctime'], f['fileID'], f['domain'], f['filename']))
                      if type == 'l': info = info + ' -> ' + f['linktarget'] # symlink destination
                      for name, value in f['properties'].items(): # extra properties
                          info = info + ' ' + name + '=' + repr(value)
                      return info
                  
                  verbose = True
                  if __name__ == '__main__':
                      mbdb = process_mbdb_file("Manifest.mbdb")
                      mbdx = process_mbdx_file("Manifest.mbdx")
                      for offset, fileinfo in mbdb.items():
                          if offset in mbdx:
                              fileinfo['fileID'] = mbdx[offset]
                          else:
                              fileinfo['fileID'] = "<nofileID>"
                              print >> sys.stderr, "No fileID found for %s" % fileinfo_str(fileinfo)
                          print fileinfo_str(fileinfo, verbose)
                  

                  这篇关于如何在 iOS 4.0 iTunes 备份中解析 Manifest.mbdb 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:无法在 iPhone 设备上捆绑加载笔尖 下一篇:如何更改 Xcode 项目名称

                  相关文章

                  <tfoot id='qMYdy'></tfoot>

                    <bdo id='qMYdy'></bdo><ul id='qMYdy'></ul>

                2. <i id='qMYdy'><tr id='qMYdy'><dt id='qMYdy'><q id='qMYdy'><span id='qMYdy'><b id='qMYdy'><form id='qMYdy'><ins id='qMYdy'></ins><ul id='qMYdy'></ul><sub id='qMYdy'></sub></form><legend id='qMYdy'></legend><bdo id='qMYdy'><pre id='qMYdy'><center id='qMYdy'></center></pre></bdo></b><th id='qMYdy'></th></span></q></dt></tr></i><div id='qMYdy'><tfoot id='qMYdy'></tfoot><dl id='qMYdy'><fieldset id='qMYdy'></fieldset></dl></div>

                  <small id='qMYdy'></small><noframes id='qMYdy'>

                  <legend id='qMYdy'><style id='qMYdy'><dir id='qMYdy'><q id='qMYdy'></q></dir></style></legend>