fork(6) download
  1. from backups.backup3 import decrypt_backup3
  2. from backups.backup4 import MBDB
  3. from keystore.keybag import Keybag
  4. from util import readPlist, makedirs
  5. import os
  6. import sys
  7. import plistlib
  8.  
  9. showinfo = ["Device Name", "Display Name", "Last Backup Date", "IMEI",
  10. "Serial Number", "Product Type", "Product Version", "iTunes Version"]
  11.  
  12. def extract_backup(backup_path, output_path, password=""):
  13. if not os.path.exists(backup_path + "/Manifest.plist"):
  14. print "Manifest.plist not found"
  15. return
  16. manifest = readPlist(backup_path + "/Manifest.plist")
  17.  
  18. info = readPlist( backup_path + "/Info.plist")
  19. for i in showinfo:
  20. print i + " : " + unicode(info.get(i, "missing"))
  21.  
  22. print "Extract backup to %s ? (y/n)" % output_path
  23. if raw_input() == "n":
  24. return
  25.  
  26. print "Backup is %sencrypted" % (int(not manifest["IsEncrypted"]) * "not ")
  27.  
  28. if manifest["IsEncrypted"] and password == "":
  29. print "Enter backup password : "
  30. password = raw_input()
  31.  
  32. if not manifest.has_key("BackupKeyBag"):
  33. print "No BackupKeyBag in manifest, assuming iOS 3.x backup"
  34. decrypt_backup3(backup_path, output_path, password)
  35. else:
  36. mbdb = MBDB(backup_path)
  37.  
  38. kb = Keybag.createWithBackupManifest(manifest, password)
  39. if not kb:
  40. return
  41. manifest["password"] = password
  42. makedirs(output_path)
  43. plistlib.writePlist(manifest, output_path + "/Manifest.plist")
  44.  
  45. mbdb.keybag = kb
  46. mbdb.extract_backup(output_path)
  47.  
  48. print "You can decrypt the keychain using the following command : "
  49. print "python keychain_tool.py -d %s %s" % (output_path + "/keychain-backup.plist", output_path + "/Manifest.plist")
  50.  
  51. def extract_all():
  52. if sys.platform == "win32":
  53. mobilesync = os.environ["APPDATA"] + "/Apple Computer/MobileSync/Backup/"
  54. elif sys.platform == "darwin":
  55. mobilesync = os.environ["HOME"] + "/Library/Application Support/MobileSync/Backup/"
  56. else:
  57. print "Unsupported operating system"
  58. return
  59. print "-" * 60
  60. print "Searching for iTunes backups"
  61. print "-" * 60
  62.  
  63. for udid in os.listdir(mobilesync):
  64. extract_backup(mobilesync + "/" + udid, udid + "_extract")
  65.  
  66. def main():
  67. if len(sys.argv) < 2:
  68. print "Usage: %s <backup path> [output path]" % sys.argv[0]
  69. return
  70. backup_path = sys.argv[1]
  71. output_path = os.path.dirname(backup_path) + "_extract"
  72. if len(sys.argv) >= 3:
  73. output_path = sys.argv[2]
  74.  
  75. extract_backup(backup_path, output_path)
  76.  
  77. if __name__ == "__main__":
  78. main()
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,0): error CS1525: Unexpected symbol `from'
prog.cs(9,25): warning CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(13,5): warning CS0658: `if' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(14,40): warning CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(20,15): warning CS0658: `identifier' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(24,9): warning CS0658: `return' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(29,40): warning CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(33,68): warning CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(36,14): warning CS0658: `=' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(40,13): warning CS0658: `return' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(52,5): warning CS0658: `if' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(53,20): warning CS0658: `=' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(55,20): warning CS0658: `=' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(57,44): warning CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(66,1): warning CS0658: `identifier' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(67,5): warning CS0658: `if' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(68,53): warning CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(73,21): warning CS0658: `=' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(78,1): error CS1525: Unexpected symbol `end-of-file', expecting `,' or `]'
Compilation failed: 2 error(s), 17 warnings
stdout
Standard output is empty