Comparing version 1.0.1 to 1.1.0
var macfromip = require('./macfromip.js'); | ||
macfromip.getMac('192.168.1.80', function(data){ | ||
console.log(data); | ||
macfromip.getMac('192.168.2.57', function(err, data){ | ||
if(err){ | ||
console.log(err); | ||
} | ||
else{ | ||
console.log(data); | ||
} | ||
}); |
@@ -69,6 +69,8 @@ /* jshint node: true */ | ||
if (error !== null) { | ||
callback('exec error: ' + error); | ||
callback('IP address unreachable', 'exec error: ' + error); | ||
return; | ||
} | ||
if (stderr !== null && stderr !== '') { | ||
callback('stderr: ' + stderr); | ||
callback('IP address unreachable', 'stderr: ' + stderr); | ||
return; | ||
} | ||
@@ -79,10 +81,13 @@ | ||
if (error2 !== null) { | ||
callback('exec error: ' + error2); | ||
callback('IP address unreachable', 'exec error: ' + error2); | ||
return; | ||
} | ||
if (stderr2 !== null && stderr2 !== '') { | ||
callback('stderr: ' + stderr2); | ||
callback('IP address unreachable', 'stderr: ' + stderr2); | ||
return; | ||
} | ||
stdout2 = (stdout2.substring(stdout2.indexOf(ipAddress) + (ipAddress.length + 5))).substring(MACADDRESS_LENGTH, 0); | ||
callback(stdout2); | ||
callback(false, stdout2); | ||
return; | ||
}); | ||
@@ -96,6 +101,8 @@ }); | ||
if (error !== null) { | ||
callback('exec error: ' + error); | ||
callback('IP address unreachable', 'exec error: ' + error); | ||
return; | ||
} | ||
if (stderr !== null && stderr !== '') { | ||
callback('stderr: ' + stderr); | ||
callback('IP address unreachable', 'stderr: ' + stderr); | ||
return; | ||
} | ||
@@ -106,6 +113,8 @@ | ||
if (error2 !== null) { | ||
callback('exec error: ' + error2); | ||
callback('IP address unreachable', 'exec error: ' + error2); | ||
return; | ||
} | ||
if (stderr2 !== null && stderr2 !== '') { | ||
callback('stderr: ' + stderr2); | ||
callback('IP address unreachable', 'stderr: ' + stderr2); | ||
return; | ||
} | ||
@@ -116,3 +125,4 @@ | ||
stdout2 = (stdout2.substring(stdout2.indexOf(ipAddress) + (ipAddress.length + offset))).substring(MACADDRESS_LENGTH, 0); | ||
callback(stdout2); | ||
callback(false, stdout2); | ||
return; | ||
}); | ||
@@ -134,4 +144,4 @@ }); | ||
case 'linux': | ||
macfromip.getMacInLinux(ipAddress, function(mac){ | ||
callback(mac); | ||
macfromip.getMacInLinux(ipAddress, function(err, mac){ | ||
callback(err, mac); | ||
}); | ||
@@ -141,4 +151,4 @@ break; | ||
case 'win32': | ||
macfromip.getMacInWin32(ipAddress, function(mac){ | ||
callback(mac); | ||
macfromip.getMacInWin32(ipAddress, function(err, mac){ | ||
callback(err, mac); | ||
}); | ||
@@ -148,4 +158,4 @@ break; | ||
case 'darwin': | ||
macfromip.getMacInLinux(ipAddress, function(mac){ | ||
callback(mac); | ||
macfromip.getMacInLinux(ipAddress, function(err, mac){ | ||
callback(err, mac); | ||
}); | ||
@@ -155,5 +165,5 @@ break; | ||
default: | ||
callback('Unsupported platform: ' + os.platform()); | ||
callback('Unsupported platform: ' + os.platform(), null); | ||
break; | ||
} | ||
}; |
{ | ||
"name": "macfromip", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "On given an IP Address, will attempt to identify that IP's MAC address.", | ||
@@ -5,0 +5,0 @@ "author": "bcamarneiro <camarneirobruno@gmail.com>", |
Sorry, the diff of this file is not supported yet
6882
160