cookies.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. module.exports.name = 'cookies'
  2. module.exports.description = 'List all iOS cookies'
  3. // Specify this reporter requires a backup.
  4. // The second parameter to func() is now a backup instead of the path to one.
  5. module.exports.requiresBackup = true
  6. // Specify this reporter supports the promises API for allowing chaining of reports.
  7. module.exports.usesPromises = true
  8. // Specify this only works for iOS 10+
  9. module.exports.supportedVersions = '>=10.0'
  10. module.exports.func = function (program, backup, resolve, reject) {
  11. backup.getCookies()
  12. .then((items) => {
  13. // Use the configured formatter to print the rows.
  14. const result = program.formatter.format(items, {
  15. // Color formatting?
  16. program: program,
  17. // Columns to be displayed in human-readable printouts.
  18. // Some formatters, like raw or CSV, ignore these.
  19. columns: {
  20. 'domain': el => el.domain,
  21. 'url': el => el.cookie.url,
  22. 'path': el => el.cookie.name,
  23. 'value': el => el.cookie.value,
  24. 'creation': el => el.cookie.creation,
  25. 'expiration': el => el.cookie.expiration,
  26. 'flags': el => el.cookie.flags
  27. }
  28. })
  29. resolve(result)
  30. })
  31. .catch(reject)
  32. }