wifi.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. module.exports.func = function (program, base) {
  7. if (!program.backup) {
  8. console.log('use -b or --backup <id> to specify backup.')
  9. process.exit(1)
  10. }
  11. // Grab the backup
  12. var backup = iPhoneBackup.fromID(program.backup, base)
  13. backup.getWifiList()
  14. .then((items) => {
  15. program.formatter.format(items['List of known networks'], {
  16. color: program.color,
  17. columns: {
  18. 'Last Joined': el => el.lastJoined,
  19. 'Last AutoJoined': el => el.lastAutoJoined,
  20. 'SSID': el => el.SSID_STR,
  21. 'BSSID': el => el.BSSID,
  22. 'Security': el => el.SecurityMode || '',
  23. 'Hidden': el => el.HIDDEN_NETWORK || '',
  24. 'Enabled': el => el.enabled
  25. }
  26. })
  27. })
  28. .catch((e) => {
  29. console.log('[!] Encountered an Error:', e)
  30. })
  31. }