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

network

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

network - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

55

lib/darwin.js

@@ -5,3 +5,2 @@ "use strict";

// by Tomas Pollak - http://forkhq.com
//////////////////////////////////////////

@@ -11,2 +10,19 @@ var os = require('os'),

//
// helpers
//////////////////////////////////////////
function determine_nic_type(str) {
return str.match(/Ethernet/)
? 'Wired'
: str.match(/Wi-?Fi|AirPort/i)
? 'Wireless'
: str.match(/FireWire/)
? 'FireWire'
: str.match(/Thunderbolt/)
? 'Thunderbolt'
: 'Other';
}
exports.get_active_network_interface_name = function(cb) {

@@ -62,27 +78,24 @@ var cmd = "netstat -rn | grep UG | awk '{print $6}'";

var parts = block.match(/Port: (.+)/);
if (!parts) return;
var parts = block.match(/Port: (.+)/),
mac = block.match(/Address: ([A-Fa-f0-9:-]+)/),
name = block.match(/Device: (\w+)/);
var port = parts[1],
type = port.match(/Ethernet/) ? 'Wired': port.match(/Wi-?Fi|AirPort/i) ? 'Wireless' : port;
if (!parts || !mac || !name) return;
if (type == 'Wired' || type == 'Wireless') {
var obj = {},
port = parts[1];
var obj = {
ip_address: null,
type: type
obj.name = name[1];
obj.desc = port;
obj.type = determine_nic_type(port);
obj.ip_address = null;
obj.mac_address = mac[1];
(nics[obj.name] || []).forEach(function(type) {
if (type.family == 'IPv4') {
obj.ip_address = type.address;
}
});
obj.name = block.match(/Device: (\w+)/)[1];
obj.mac_address = block.match(/Address: ([A-Fa-f0-9:-]+)/)[1];
(nics[obj.name] || []).forEach(function(type) {
if (type.family == 'IPv4') {
obj.ip_address = type.address;
}
});
list.push(obj);
}
list.push(obj);
})

@@ -89,0 +102,0 @@

{
"name": "network",
"version": "0.0.11",
"version": "0.0.12",
"description": "Cross platform network utilities for Node.js (gateway_ip, MAC address, etc)",

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

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