wifi.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const stripAnsi = require('strip-ansi')
  2. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  3. const normalizeCols = require('../util/normalize.js')
  4. module.exports.name = 'wifi'
  5. module.exports.description = 'List associated wifi networks and their usage information'
  6. // Specify this reporter requires a backup.
  7. // The second parameter to func() is now a backup instead of the path to one.
  8. module.exports.requiresBackup = true
  9. // Specify this reporter supports the promises API for allowing chaining of reports.
  10. module.exports.usesPromises = true
  11. module.exports.func = function (program, backup, resolve, reject) {
  12. backup.getWifiList()
  13. .then((items) => {
  14. var result = program.formatter.format(items['List of known networks'], {
  15. program: program,
  16. columns: {
  17. 'Last Joined': el => el.lastJoined,
  18. 'Last AutoJoined': el => el.lastAutoJoined,
  19. 'SSID': el => el.SSID_STR,
  20. 'BSSID': el => el.BSSID,
  21. 'Security': el => el.SecurityMode || '',
  22. 'Hidden': el => el.HIDDEN_NETWORK || '',
  23. 'Enabled': el => el.enabled
  24. }
  25. })
  26. resolve(result)
  27. })
  28. .catch(reject)
  29. }