webhistory.js 1011 B

123456789101112131415161718192021222324252627282930313233
  1. const stripAnsi = require('strip-ansi')
  2. const { URL } = require('url')
  3. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  4. const normalizeCols = require('../util/normalize.js')
  5. module.exports.name = 'webhistory'
  6. module.exports.description = 'List all web history'
  7. // Specify this reporter requires a backup.
  8. // The second parameter to func() is now a backup instead of the path to one.
  9. module.exports.requiresBackup = true
  10. // Specify this only works for iOS 6+
  11. module.exports.supportedVersions = '>=9.0'
  12. module.exports.func = function (program, backup) {
  13. backup.getWebHistory(program.dump)
  14. .then((history) => {
  15. program.formatter.format(history, {
  16. color: program.color,
  17. columns: {
  18. 'Time': el => el.XFORMATTEDDATESTRING,
  19. 'URL': el => new URL(el.url || '').origin || '',
  20. 'Title': el => (el.title || '').substring(0, 64)
  21. }
  22. })
  23. })
  24. .catch((e) => {
  25. console.log('[!] Encountered an Error:', e)
  26. })
  27. }