diff --git a/ifconfig.js b/ifconfig.js index 08f9fa7..d5fe4b2 100644 --- a/ifconfig.js +++ b/ifconfig.js @@ -51,30 +51,30 @@ function parse_status_block(block) { var match; var parsed = { - interface: block.match(/^([^\s]+)/)[1] + interface: block.match(/^([^\s]+)/)[1].replace(':','') }; if ((match = block.match(/Link encap:\s*([^\s]+)/))) { parsed.link = match[1].toLowerCase(); } - if ((match = block.match(/HWaddr\s+([^\s]+)/))) { - parsed.address = match[1].toLowerCase(); + if ((match = block.match(/ether\s+([^\s]+)/))) { + parsed.mac = match[1].toLowerCase(); } - if ((match = block.match(/inet6\s+addr:\s*([^\s]+)/))) { + if ((match = block.match(/inet6\s*([^\s]+)/))) { parsed.ipv6_address = match[1]; } - if ((match = block.match(/inet\s+addr:\s*([^\s]+)/))) { + if ((match = block.match(/inet\s*([^\s]+)/))) { parsed.ipv4_address = match[1]; } - if ((match = block.match(/Bcast:\s*([^\s]+)/))) { + if ((match = block.match(/Bcast:|broadcast\s*([^\s]+)/))) { parsed.ipv4_broadcast = match[1]; } - if ((match = block.match(/Mask:\s*([^\s]+)/))) { + if ((match = block.match(/Mask|netmask\s*([^\s]+)/))) { parsed.ipv4_subnet_mask = match[1]; } diff --git a/iwconfig.js b/iwconfig.js index fb2f5fd..d3187fd 100644 --- a/iwconfig.js +++ b/iwconfig.js @@ -91,7 +91,7 @@ function parse_status_block(block) { parsed.ssid = match[1]; } - if ((match = block.match(/unassociated/))) { + if ((match = block.match(/Not-Associated/))) { parsed.unassociated = true; } @@ -126,6 +126,8 @@ function parse_status(callback) { */ function parse_status_interface(callback) { return function(error, stdout, stderr) { + console.log('parse status interface:') + console.log('stderr') if (error) callback(error); else callback(error, parse_status_block(stdout.trim())); };