Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

macaddress

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

macaddress - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

LICENSE

39

index.js

@@ -0,1 +1,4 @@

/* jshint node: true */
'use strict';
var os = require('os');

@@ -24,3 +27,3 @@

var task = tasks[key];
(global.setImmediate || global.setTimeout)(function () {
(process.nextTick || global.setImmediate || global.setTimeout)(function () {
task(doneIt.bind(null, key), 1);

@@ -32,6 +35,19 @@ });

lib.networkInterfaces = function () {
var ifaces = os.networkInterfaces();
var allAddresses = {};
try {
var ifaces = os.networkInterfaces();
} catch (e) {
// At October 2016 WSL does not support os.networkInterfaces() and throws
// Return empty object as if no interfaces were found
// https://github.com/Microsoft/BashOnWindows/issues/468
if (e.syscall === 'uv_interface_addresses') {
return allAddresses;
} else {
throw e;
};
};
Object.keys(ifaces).forEach(function (iface) {
addresses = {};
var addresses = {};
var hasAddresses = false;

@@ -67,7 +83,8 @@ ifaces[iface].forEach(function (address) {

case 'sunos':
case 'freebsd':
_getMacAddress = require('./lib/unix.js');
break;
default:
console.warn("node-macaddress: Unkown os.platform(), defaulting to `unix'.");
console.warn("node-macaddress: Unknown os.platform(), defaulting to 'unix'.");
_getMacAddress = require('./lib/unix.js');

@@ -93,3 +110,5 @@ break;

if (typeof callback === 'function') {
callback("no interfaces found", null);
process.nextTick(function() {
callback(new Error("no interfaces found"), null);
});
}

@@ -100,3 +119,5 @@ return null;

if (typeof callback === 'function') {
callback(null, ifaces[iface].mac);
process.nextTick(function() {
callback(null, ifaces[iface].mac);
});
}

@@ -125,3 +146,5 @@ return ifaces[iface].mac;

if (typeof callback === 'function') {
callback(null, ifaces);
process.nextTick(function(){
callback(null, ifaces);
});
}

@@ -128,0 +151,0 @@ return ifaces;

@@ -1,5 +0,5 @@

var exec = require('child_process').exec;
var execFile = require('child_process').execFile;
module.exports = function (iface, callback) {
exec("cat /sys/class/net/" + iface + "/address", function (err, out) {
execFile("cat", ["/sys/class/net/" + iface + "/address"], function (err, out) {
if (err) {

@@ -11,2 +11,2 @@ callback(err, null);

});
};
};

@@ -1,5 +0,5 @@

var exec = require('child_process').exec;
var execFile = require('child_process').execFile;
module.exports = function (iface, callback) {
exec("ifconfig " + iface, function (err, out) {
execFile("ifconfig", [iface], function (err, out) {
if (err) {

@@ -6,0 +6,0 @@ callback(err, null);

@@ -1,2 +0,2 @@

var exec = require('child_process').exec;
var execFile = require('child_process').execFile;

@@ -10,3 +10,3 @@ var regexRegex = /[-\/\\^$*+?.()|[\]{}]/g;

module.exports = function (iface, callback) {
exec("ipconfig /all", function (err, out) {
execFile("ipconfig", ["/all"], function (err, out) {
if (err) {

@@ -13,0 +13,0 @@ callback(err, null);

{
"name": "macaddress",
"version": "0.2.8",
"version": "0.2.9",
"description": "Get the MAC addresses (hardware addresses) of the hosts network interfaces.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,1 +1,4 @@

/* jshint node: true */
'use strict';
var macaddress = require('./index');

@@ -2,0 +5,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc