From f47e2af3d7e5d9385451d85914057daaf02ae554 Mon Sep 17 00:00:00 2001 From: Daryl Kranec Date: Tue, 1 Nov 2016 17:38:36 -0400 Subject: [PATCH 1/5] Fixes matches for Fedora / Kali-like ifconfig outputs. --- ifconfig.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ifconfig.js b/ifconfig.js index 08f9fa7..9b89cce 100644 --- a/ifconfig.js +++ b/ifconfig.js @@ -58,23 +58,23 @@ function parse_status_block(block) { parsed.link = match[1].toLowerCase(); } - if ((match = block.match(/HWaddr\s+([^\s]+)/))) { + if ((match = block.match(/HWaddr|ether\s+([^\s]+)/))) { parsed.address = match[1].toLowerCase(); } - if ((match = block.match(/inet6\s+addr:\s*([^\s]+)/))) { + if ((match = block.match(/inet6\s?(addr:\s)*([^\s]+)/))) { parsed.ipv6_address = match[1]; } - if ((match = block.match(/inet\s+addr:\s*([^\s]+)/))) { + if ((match = block.match(/inet\s?(addr:\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]; } From 4533568628cf2efb9faa785895f3af1c9be7dfda Mon Sep 17 00:00:00 2001 From: dkran Date: Mon, 7 Nov 2016 22:14:36 -0500 Subject: [PATCH 2/5] Modified ifconfig for fedora/kali --- ifconfig.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ifconfig.js b/ifconfig.js index 9b89cce..36382e1 100644 --- a/ifconfig.js +++ b/ifconfig.js @@ -58,15 +58,15 @@ function parse_status_block(block) { parsed.link = match[1].toLowerCase(); } - if ((match = block.match(/HWaddr|ether\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]; } From 4de53451e1b1a03dbd4dc87a5e9f1497263ce121 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 13 Nov 2016 09:36:21 -0500 Subject: [PATCH 3/5] one more change to remove the colon in the wifi interface names --- ifconfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifconfig.js b/ifconfig.js index 36382e1..d5fe4b2 100644 --- a/ifconfig.js +++ b/ifconfig.js @@ -51,7 +51,7 @@ 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]+)/))) { From d9debadb352a30c85fbbd7ad375e936133416fa7 Mon Sep 17 00:00:00 2001 From: Daryl Kranec Date: Mon, 14 Nov 2016 22:05:49 -0500 Subject: [PATCH 4/5] modified Regex matches to better handle the kali format. --- iwconfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iwconfig.js b/iwconfig.js index fb2f5fd..c4b77c5 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; } From ee1953c3af3f9dccf5111bc19e70028b55fcef34 Mon Sep 17 00:00:00 2001 From: Daryl Kranec Date: Sun, 20 Nov 2016 11:03:32 -0500 Subject: [PATCH 5/5] Removed unneccessary code block. Was added via other routine --- iwconfig.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iwconfig.js b/iwconfig.js index c4b77c5..d3187fd 100644 --- a/iwconfig.js +++ b/iwconfig.js @@ -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())); };