apps.js 822 B

12345678910111213141516171819202122232425262728293031
  1. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  2. module.exports.name = 'apps'
  3. module.exports.description = 'List all installed applications and container IDs.'
  4. module.exports.func = function (program, base) {
  5. if (!program.backup) {
  6. console.log('use -b or --backup <id> to specify backup.')
  7. process.exit(1)
  8. }
  9. // Grab the backup
  10. var backup = iPhoneBackup.fromID(program.backup, base)
  11. if (!backup.manifest) return {}
  12. // Possibly dump output
  13. if (program.dump) {
  14. console.log(JSON.stringify(backup.manifest, null, 4))
  15. return
  16. }
  17. // Enumerate the apps in the backup
  18. var apps = []
  19. for (var key in backup.manifest.Applications) {
  20. apps.push(key)
  21. }
  22. console.log(`Apps installed inside backup: ${backup.id}`)
  23. console.log(apps.map(el => '- ' + el).join('\n'))
  24. }