
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
ip-range-check
Advanced tools
This module lets you check if an IP matches one or more IP's or CIDR ranges. It handles IPv6, IPv4, and IPv4-mapped over IPv6 addresses.
It accepts either:
"125.19.23.0/24", or "2001:cdba::3257:9652", or "62.230.58.1"["125.19.23.0/24", "2001:cdba::3257:9652", "62.230.58.1"]Importantly, it cannot match an IPv4 address to an IPv6 CIDR or vice versa, (IPv4-mapped IPv6 addresses notwithstanding).
npm install ip-range-check --save
var ipRangeCheck = require("ip-range-check");
// Checks CIDR
ipRangeCheck("192.168.1.1", "102.1.5.2/24")
// > false
ipRangeCheck("192.168.1.1", "192.168.1.0/24")
// > true
// Checks if IP matches string
ipRangeCheck("192.168.1.1", "192.168.1.1")
// > true
// Checks array of CIDR's and string
ipRangeCheck("192.168.1.1", ["102.1.5.2/24", "192.168.1.0/24", "106.1.180.84"])
// > true
// Compare IPv6 with IPv4
ipRangeCheck("195.58.1.62", ["::1/128", "125.92.12.53"])
// > false
var ipRangeCheck = require("ip-range-check");
// Handles IPv6 in the same fashion as IPv4
ipRangeCheck("::1", "::2/128")
// > false
ipRangeCheck("::1", ["::2", "::3/128"])
// > false
ipRangeCheck("2001:cdba::3257:9652", "2001:cdba::3257:9652/128")
// > true
// IPv4-mapped IPv6 addresses are automatically converted back to IPv4 addresses
// and will match against IPv4 CIDR/IP's.
ipRangeCheck("0:0:0:0:0:FFFF:222.1.41.90", "222.1.41.0/24")
// > true
// IPv6 addresses/CIDR's are normalised
ipRangeCheck("2001:cdba:0000:0000:0000:0000:3257:9652", ["2001:cdba::3257:9652"])
// > true
To run the tests:
npm test
The ip6 package provides utilities for working with IPv6 addresses, including checking if an IP is within a range. It is more specialized for IPv6 compared to ip-range-check, which supports both IPv4 and IPv6.
The ip-cidr package allows for parsing and manipulation of CIDR notations. It can be used to check if an IP falls within a CIDR range, similar to ip-range-check, but it is more focused on CIDR operations.
The range_check package provides functions to check if an IP is within a range, supporting both IPv4 and IPv6. It offers similar functionality to ip-range-check but with a different API.
FAQs
Check whether an IP(v4 or v6) is in an CIDR range
The npm package ip-range-check receives a total of 78,083 weekly downloads. As such, ip-range-check popularity was classified as popular.
We found that ip-range-check 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.