profile.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const plist = require('../../../util/plist')
  2. const fs = require('fs')
  3. // Derive filenames based on domain + file path
  4. const fileHash = require('../../../util/backup_filehash')
  5. const file = fileHash('Library/Preferences/com.facebook.Messenger.plist', 'AppDomain-com.facebook.Messenger')
  6. module.exports = {
  7. version: 4,
  8. name: 'facebook_profile',
  9. description: `Show Facebook Messenger user id`,
  10. requiresBackup: true,
  11. // Run on a v3 lib / backup object.
  12. run (lib, { backup }) {
  13. return facebookProfileReport(backup)
  14. },
  15. // Fields for apps report
  16. output: {
  17. 'Facebook User ID': el => el.fbid
  18. }
  19. }
  20. const facebookProfileReport = (backup) => {
  21. return new Promise((resolve, reject) => {
  22. var filename = backup.getFileName(file)
  23. try {
  24. let facebookPlist = plist.parseFile(filename)
  25. let facebookUserIds = Object.keys(facebookPlist['kUserGlobalSettings'])
  26. facebookUserIds = facebookUserIds.map((fbid) => ({
  27. fbid: fbid
  28. }))
  29. resolve(facebookUserIds)
  30. } catch (e) {
  31. reject(e)
  32. }
  33. })
  34. }