pushstore.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const fs = require('fs')
  2. const plist = require('../../util/plist')
  3. const pushstoreParse = require('../../util/pushstore_parse')
  4. module.exports = {
  5. version: 4,
  6. name: 'system.pushstore',
  7. description: `List pushstore contents`,
  8. requiresBackup: true,
  9. // Available fields.
  10. output: {
  11. appNotificationCreationDate: el => el.AppNotificationCreationDate,
  12. appNotificationTitle: el => el.AppNotificationTitle,
  13. appNotificationMessage: el => el.AppNotificationMessage,
  14. requestedDate: el => el.RequestedDate,
  15. triggerDate: el => el.TriggerDate
  16. },
  17. // Run on a v3 lib / backup object
  18. run (lib, { backup }) {
  19. return new Promise(async (resolve, reject) => {
  20. try {
  21. // Run files report as a sub-report.
  22. let files = await lib.run('backup.files', { backup })
  23. files = files.filter((file) => {
  24. if (file.path) {
  25. return ~file.path.indexOf('Library/SpringBoard/PushStore/')
  26. }
  27. return false
  28. })
  29. // Collect the push stores
  30. const pushstores = []
  31. // For each file, run a parse on the plist.
  32. files.forEach((file) => {
  33. let data = plist.parseFile(backup.getFileName(file.id))
  34. pushstores.push(...pushstoreParse.run(data))
  35. })
  36. resolve(pushstores)
  37. } catch (e) {
  38. reject(e)
  39. }
  40. })
  41. }
  42. }