Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
portscanner
Advanced tools
The portscanner npm package is a utility for scanning and checking the status of ports on a given host. It can be used to find open ports, check if a specific port is open, and find the first open port within a range.
Check if a specific port is open
This feature allows you to check if a specific port on a given host is open or closed. The code sample demonstrates how to check the status of port 3000 on localhost.
const portscanner = require('portscanner');
portscanner.checkPortStatus(3000, '127.0.0.1', (error, status) => {
if (error) throw error;
console.log(`Port 3000 is ${status}`); // 'open' or 'closed'
});
Find the first open port in a range
This feature allows you to find the first open port within a specified range on a given host. The code sample demonstrates how to find the first open port between 3000 and 3010 on localhost.
const portscanner = require('portscanner');
portscanner.findAPortNotInUse(3000, 3010, '127.0.0.1', (error, port) => {
if (error) throw error;
console.log(`First open port is ${port}`);
});
Find the first port in use in a range
This feature allows you to find the first port that is in use within a specified range on a given host. The code sample demonstrates how to find the first port in use between 3000 and 3010 on localhost.
const portscanner = require('portscanner');
portscanner.findAPortInUse(3000, 3010, '127.0.0.1', (error, port) => {
if (error) throw error;
console.log(`First port in use is ${port}`);
});
net-ping is a package that provides network utilities including ping and port scanning. While it offers more comprehensive network diagnostic tools, its port scanning capabilities are similar to those of portscanner. It can be used to check the status of ports and find open ports on a host.
The portscanner module is an asynchronous JavaScript port scanner for Node.js.
Portscanner can check a port, or range of ports, for 'open' or 'closed' statuses.
npm install portscanner
A brief example:
var portscanner = require('portscanner')
// Checks the status of a single port
portscanner.checkPortStatus(3000, 'localhost', function(error, status) {
// Status is 'open' if currently in use or 'closed' if available
console.log(status)
})
// Find the first available port. Asynchronously checks, so first port
// determined as available is returned.
portscanner.findAPortNotInUse(3000, 3010, 'localhost', function(error, port) {
console.log('AVAILABLE PORT AT: ' + port)
})
// Find the first port in use or blocked. Asynchronously checks, so first port
// to respond is returned.
portscanner.findAPortInUse(3000, 3010, 'localhost', function(error, port) {
console.log('PORT IN USE AT: ' + port)
})
The example directory contains a more detailed example.
Bleh. I am a fan of testing, but currently looking into an easier way to test several HTTP connections. If any ideas, please message me.
Please create issues, or better yet, pull requests, for port scanning related features you'd like to see included.
Released under the MIT license. See the LICENSE file for the complete wording.
FAQs
Asynchronous port scanner for Node.js
The npm package portscanner receives a total of 521,587 weekly downloads. As such, portscanner popularity was classified as popular.
We found that portscanner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.