iw.js
function parse_cell(cell) {
  var parsed = { };
  var match;

  if ((match = cell.match(/BSS ([0-9A-Fa-f:-]{17})\(on/))) {
    parsed.address = match[1].toLowerCase();
  }

  if ((match = cell.match(/freq: ([0-9]+)/))) {
    parsed.frequency = parseInt(match[1], 10);
  }

  if ((match = cell.match(/signal: (-?[0-9.]+) dBm/))) {
    parsed.signal = parseFloat(match[1]);
  }

  if ((match = cell.match(/last seen: ([0-9]+) ms ago/))) {
    parsed.lastSeenMs = parseInt(match[1], 10);
  }

  if ((match = cell.match(/SSID: \\x00/))) {
    delete parsed.ssid;
  }
  else if ((match = cell.match(/SSID: ([^\n]*)/))) {
    parsed.ssid = match[1];
  }

  if ((match = cell.match(/DS Parameter set: channel ([0-9]+)/))) {
    parsed.channel = parseInt(match[1], 10);
  }
  else if ((match = cell.match(/\* primary channel: ([0-9]+)/))) {
    parsed.channel = parseInt(match[1], 10);
  }

  if ((match = cell.match(/RSN:[\s*]+Version: 1/))) {
    parsed.security = 'wpa2';
  }
  else if ((match = cell.match(/WPA:[\s*]+Version: 1/))) {
    parsed.security = 'wpa';
  }
  else if ((match = cell.match(/capability: ESS Privacy/))) {
    parsed.security = 'wep';
  }
  else if ((match = cell.match(/capability: ESS/))) {
    parsed.security = 'open';
  }
  return parsed;
}
function parse_cell(cell) {
  var parsed = { };
  var match;

  if ((match = cell.match(/BSS ([0-9A-Fa-f:-]{17})\(on/))) {
    parsed.address = match[1].toLowerCase();
  }

  if ((match = cell.match(/freq: ([0-9]+)/))) {
    parsed.frequency = parseInt(match[1], 10);
  }

  if ((match = cell.match(/signal: (-?[0-9.]+) dBm/))) {
    parsed.signal = parseFloat(match[1]);
  }

  if ((match = cell.match(/last seen: ([0-9]+) ms ago/))) {
    parsed.lastSeenMs = parseInt(match[1], 10);
  }

  if ((match = cell.match(/SSID: \\x00/))) {
    delete parsed.ssid;
  }
  else if ((match = cell.match(/SSID: ([^\n]*)/))) {
    parsed.ssid = match[1];
  }

  if ((match = cell.match(/DS Parameter set: channel ([0-9]+)/))) {
    parsed.channel = parseInt(match[1], 10);
  }
  else if ((match = cell.match(/\* primary channel: ([0-9]+)/))) {
    parsed.channel = parseInt(match[1], 10);
  }

  if ((match = cell.match(/RSN:[\s*]+Version: 1/))) {
    parsed.security = 'wpa2';
  }
  else if ((match = cell.match(/WPA:[\s*]+Version: 1/))) {
    parsed.security = 'wpa';
  }
  else if ((match = cell.match(/capability: ESS Privacy/))) {
    parsed.security = 'wep';
  }
  else if ((match = cell.match(/capability: ESS/))) {
    parsed.security = 'open';
  }
  return parsed;
}
Parses a scanned wireless network cell.

@private
@static
@category iw
@param {string} cell The section of stdout for the cell.
@returns {object} The scanned network object.