New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-port-scanner

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-port-scanner

Lean JavaScript port scanner for open/closed ports

latest
Source
npmnpm
Version
3.0.1
Version published
Weekly downloads
178
-16.04%
Maintainers
1
Weekly downloads
 
Created
Source

node-port-scanner

npm

node-port-scanner

Scans ports to see if they are open or closed.

After calling nodePortScanner, ports are checked in order one after the previous is completed.

Multiple calls can be made and will run in parallel.

Install

npm i node-port-scanner

Usage

npm run usage
const nodePortScanner = require('node-port-scanner');

// scan local common ports
nodePortScanner('127.0.0.1', [21, 22, 23, 25, 80, 110, 123, 443])
  .then(results => {  
    console.log(results);
  })
  .catch(error => {
    console.log(error);
  });

// scan remote common ports
nodePortScanner('github.com', [21, 22, 23, 25, 80, 110, 123, 443])
  .then(results => {  
    console.log(results);
  })
  .catch(error => {
    console.log(error);
  });

// scan all local ports - not recommended on remote hosts
async function checkLocalPorts () {
  
  const allPorts = nodePortScanner('127.0.0.1', []);
  console.log(await allPorts);
  
}
checkLocalPorts();

Sample Response

{
  host: 'github.com',
  ports: { 
    open: [ 22, 80, 443 ], 
    closed: [ 21, 23, 25, 110, 123 ] 
  }
}

Test (Jest)

npm test

License (MIT)

MIT

Keywords

portscanner

FAQs

Package last updated on 31 Mar 2021

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