conversations.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const stripAnsi = require('strip-ansi')
  2. const chalk = require('chalk')
  3. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  4. const normalizeCols = require('../util/normalize.js')
  5. module.exports.name = 'conversations'
  6. module.exports.description = 'List all SMS and iMessage conversations'
  7. module.exports.func = function (program, base) {
  8. if (!program.backup) {
  9. console.log('use -b or --backup <id> to specify backup.')
  10. process.exit(1)
  11. }
  12. // Grab the backup
  13. var backup = iPhoneBackup.fromID(program.backup, base)
  14. backup.getConversations()
  15. .then((items) => {
  16. program.formatter.format(items, {
  17. color: program.color,
  18. columns: {
  19. 'ID': el => el.ROWID,
  20. 'Date': el => el.XFORMATTEDDATESTRING || '??',
  21. 'Service': el => el.service_name + '',
  22. 'Chat Name': el => el.chat_identifier + '',
  23. 'Display Name': el => el.display_name + '',
  24. }
  25. })
  26. })
  27. .catch((e) => {
  28. console.log('[!] Encountered an Error:', e)
  29. })
  30. }