
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Node.js utility package for working with IP addresses and CIDR ranges.
$ npm install netaddr --save
var Addr = require('netaddr').Addr;
// Create a fixed IP address from a string
var localhost = Addr('127.0.0.1');
// Create CIDR range from a string
var subnet = Addr('10.0.0.0/16');
// Create a CIDR range from an integer and prefix
var subnet = Addr(167772160, 16);
// Convert an IP address to an integer
var intval = Addr('127.0.0.1').toInt();
// Get the network address
var network = subnet.network();
// Get the broadcast address
var broadcast = subnet.broadcast();
// Mask the address with a new prefix
var masked = subnet.mask(24);
// Check if one CIDR contains another CIDR or IP
subnet.contains(Addr('10.0.3.0/24')); // true
// Check where two CIDRs intersect
subnet.intersect(Addr('10.0.3.0/24'));
// Increment an address (non-mutating)
localhost.increment();
// Decrement an address (non-mutating)
localhost.decrement();
// Find the next adjacent subnet
subnet.nextSibling();
// Find the previous adjacent subnet
subnet.prevSibling();
Attempts to create an invalid Addr
will throw an Error
.
Currently only IPv4 is supported, though there are plans to add IPv6 support. This is complicated by the fact JavaScript does not support 64-bit integers, let alone 128-bit integers.
Copyright © 2015 Chris Corbyn. See the LICENSE file for details.
FAQs
Utility for IP addresses and CIDR expressions
We found that netaddr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.