Socket
Socket
Sign inDemoInstall

portscanner

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

portscanner

Asynchronous port scanner for Node.js


Version published
Weekly downloads
1.2M
decreased by-1.66%
Maintainers
1
Weekly downloads
 
Created

What is portscanner?

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.

What are portscanner's main functionalities?

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}`);
});

Other packages similar to portscanner

Keywords

FAQs

Package last updated on 06 Feb 2014

Did you know?

Socket

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.

Install

Related posts

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