Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
is-port-reachable
Advanced tools
The is-port-reachable npm package is used to check if a port is reachable on a given host. It is useful for network diagnostics and monitoring, allowing developers to programmatically verify if services are accessible over the network.
Check port reachability
This feature allows you to check if a specific port on a host is reachable. The function returns a boolean indicating whether the port is open or not.
const isPortReachable = require('is-port-reachable');
(async () => {
const reachable = await isPortReachable(80, {host: 'example.com'});
console.log(reachable); // true or false
})();
The portscanner package is similar to is-port-reachable and provides more comprehensive functionality for scanning ports, including checking a range of ports and providing detailed status for each port.
tcp-ping allows you to perform TCP pings to a server, which includes checking if a port is open. It provides additional information such as latency measurements, which is-port-reachable does not offer.
wait-for-port is another package that can be used to wait for a port on a host to become available. It is useful for scenarios where you need to wait for a service to start up before performing actions that depend on that service.
Check if a local or remote port is reachable
npm install is-port-reachable
import isPortReachable from 'is-port-reachable';
console.log(await isPortReachable(80, {host: 'google.com'}));
//=> true
Returns Promise<boolean>
for whether the port is reachable.
Type: number
The port to check.
Type: object
Required
Type: string
Example: 'localhost'
The host to check.
Can be a domain (optionally, with a sub-domain) or an IP address.
Type: number
Default: 1000
The time to wait in milliseconds before giving up.
FAQs
Check if a local or remote port is reachable
The npm package is-port-reachable receives a total of 1,000,067 weekly downloads. As such, is-port-reachable popularity was classified as popular.
We found that is-port-reachable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.