Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
netstats
Advanced tools
Readme
Get the netstat activity on a given port.
$ npm install --save netstats
const netstats = require('netstats');
netstats(8017).then(results => {
console.log(results);
});
On a mac or linux, the output is the same output you would get from running lsof -i :<port>
[
'COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME',
'nc 20661 michael 3u IPv4 0x3b190d9d07c2c3db 0t0 TCP *:8017 (LISTEN)',
'nc 21145 michael 3u IPv4 0x3b190d9d054773db 0t0 TCP *:8017 (LISTEN)',
'Python 21221 michael 3u IPv4 0x3b190d9ceb8dfd7b 0t0 UDP localhost:8017'
];
On windows, the output is the same as running netstat.exe -a -n -o | findstr :<port>
[
'TCP 0.0.0.0:9000 0.0.0.0:0 LISTENING 5220',
'TCP 127.0.0.1:9000 127.0.0.1:62376 ESTABLISHED 5220',
'TCP 127.0.0.1:9000 127.0.0.1:62379 ESTABLISHED 5220',
'TCP 127.0.0.1:62288 127.0.0.1:9000 TIME_WAIT 0',
'TCP 127.0.0.1:62299 127.0.0.1:9000 TIME_WAIT 0',
'TCP 127.0.0.1:62376 127.0.0.1:9000 ESTABLISHED 7604',
'TCP 127.0.0.1:62378 127.0.0.1:9000 ESTABLISHED 7604',
'UDP 127.0.0.1:9000 *:* 1240',
];
Returns a promise carrying the output array of line items.
Type: number
Required
The port number you are enquiring about.
MIT © Michael Wuergler
FAQs
Get the netstat activity on a given port.
The npm package netstats receives a total of 7,644 weekly downloads. As such, netstats popularity was classified as popular.
We found that netstats 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.