瀏覽代碼

Merge branch 'master' of github.com:richinfante/iphonebackuptools

Rich Infante 4 年之前
父節點
當前提交
2fe95961d3
共有 4 個文件被更改,包括 22 次插入4 次删除
  1. 15 0
      Readme.md
  2. 2 1
      tools/backup.js
  3. 2 1
      tools/index.js
  4. 3 2
      tools/util/iphone_backup.js

+ 15 - 0
Readme.md

@@ -60,6 +60,21 @@ UDID="0c1bc52c50016933679b0980ccff3680e5831162"
 ibackuptool -b $UDID --report '$TYPE'
 ```
 
+### Terminal Permissions
+
+If you receive an error, then it is possible Terminal does not have permission to access the folder where backups are stored. Read the error message for the location, otherwise try to just list the backups manually:
+
+```bash
+# List all backups manually
+/Users/<username>/Library/Application Support/MobileSync/Backup
+```
+
+You will see `ls: Operation not permitted` and know that Terminal does not have permission. Fix by allowing Terminal in Full Disk Encryption under Security & Privacy. First, close Terminal, and then:
+
+`System Preferences -> Security & Privacy -> Privacy -> Full Disk Access -> + -> tick Terminal`
+
+Open Terminal and try again.
+
 #### Multiple-Reporting 
 You can also provide a comma separated list of reports to generate. Additionally, there is a special `all` report type which will run all available reports. This is best paired with the `-o` option for saving to disk and the `-f` option for selecting a format such as CSV, or JSON.
 

+ 2 - 1
tools/backup.js

@@ -4,6 +4,7 @@ const path = require('path')
 const log = require('./util/log')
 const filehash = require('./util/backup_filehash')
 const manifestMBDBParse = require('./util/manifest_mbdb_parse')
+const os = require('os')
 
 /**
  * Backup3 is the version 4 of the backup library.
@@ -33,7 +34,7 @@ class Backup {
     if (base) {
       this.path = path.join(base, id)
     } else {
-      this.path = path.join(process.env.HOME, '/Library/Application Support/MobileSync/Backup/', id)
+      this.path = path.join(os.homedir(), '/Library/Application Support/MobileSync/Backup/', id)
     }
   }
 

+ 2 - 1
tools/index.js

@@ -4,9 +4,10 @@ const report = require('./reports')
 const matcher = require('./util/matcher')
 const Group = report.Group
 const Backup = require('./backup')
+const os = require('os')
 
 // Backup source directory
-var backupDirectory = path.join(process.env.HOME, '/Library/Application Support/MobileSync/Backup/')
+var backupDirectory = path.join(os.homedir(), '/Library/Application Support/MobileSync/Backup/')
 
 // Object containing all report modules
 var moduleCache = report.types

+ 3 - 2
tools/util/iphone_backup.js

@@ -3,6 +3,7 @@ const path = require('path')
 const sqlite3 = require('sqlite3')
 const fs = require('fs')
 const plist = require('./plist')
+const os = require('os')
 
 // Cookie Parser
 const cookieParser = require('./cookies.js')
@@ -61,7 +62,7 @@ class IPhoneBackup {
     if (base) {
       base = path.join(base, id)
     } else {
-      base = path.join(process.env.HOME, '/Library/Application Support/MobileSync/Backup/', id)
+      base = path.join(os.homedir(), '/Library/Application Support/MobileSync/Backup/', id)
     }
 
     // Parse manifest plist files
@@ -852,7 +853,7 @@ class IPhoneBackup {
 }
 
 module.exports.availableBackups = function () {
-  const base = path.join(process.env.HOME, '/Library/Application Support/MobileSync/Backup/')
+  const base = path.join(os.homedir(), '/Library/Application Support/MobileSync/Backup/')
   return new Promise((resolve, reject) => {
     resolve(fs.readdirSync(base, {
       encoding: 'utf8'