Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
A simple TCP & UDP ping tool
Weekly downloads
Readme
A Simple TCP & UDP ping tool
npm i ping-port
ESM
import ping from 'ping-port';
// TCP ping localhost:80
ping('localhost')
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
CJS
const ping = require('ping-port').default;
// TCP ping localhost:80
ping('localhost')
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
{
"error": undefined,
"type": "ping/tcp",
"host": "localhost",
"ip": "127.0.0.1",
"ips": ["127.0.0.1"],
"port": 80,
"status": "open",
"name": "http",
"banner": "",
"time": 2
}
// TCP ping to ports of localhost
ping('localhost:22,80-90,443,3306')
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
{
"error": undefined,
"type": "ping/tcp/scan",
"host": "localhost",
"ip": "127.0.0.1",
"ips": ["127.0.0.1"],
"ports": [22, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 443, 3306],
"status": {
"open": [22, 80, 3306],
"reset": [],
"close": [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 443],
"filtered": [],
"error": []
},
"names": {
"22": "ssh",
"80": "http",
"81": "unknown",
"82": "xfer",
"83": "mit-ml-dev",
"84": "ctf",
"85": "mit-ml-dev",
"86": "mfcobol",
"87": "unknown",
"88": "kerberos",
"89": "su-mit-tg",
"90": "dnsix",
"443": "https",
"3306": "mysql"
},
"banners": { "22": "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3" },
"errors": {},
"time": 2005
}
// TCP ping to localhost:80
ping
.tcp('localhost', 80)
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
// UDP ping to localhost:68
ping
.udp('localhost', 68)
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
// TCP scan to ports of localhost
ping
.scan('localhost', [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 80, 443, 3306])
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
// UDP scan to ports of localhost
ping
.scan('localhost', [67, 68, 161, 162, 163, 164], {
protocol: 'udp',
})
.then((result) => {
console.log(result);
})
.catch((err) => {
throw err;
});
cd node_modules/ping-port
npm run query [host]:<port|ports> <...options>
options:
t
: use tcp (default)
u
: use udp
f
: full log output
d <dns>
: use specific dns server
Example
npm run query example.com:@ t d 8.8.8.8
Running ping-port at 2022-09-24T13:15:21.226Z
query : tcp/example.com:@
dns : 8.8.8.8
ip : 93.184.216.34
scan : 1024 ports
open : [80,443]
reset : []
close : [1119,1935]
filtered: 1020 ports
80 open http
443 open https
1119 close bnetgame
1935 close macromedia-fcs
ping(target, options);
target: string [host]:<port|ports>
target ports:
:80
: target port 80
:80,90,100
: target port 80, 90 and 100
:80-100
: target port in range 80 to 100
:22,80-100,443
: target port 22, port in range 80 to 100 and port 443
:@
: target most used 1024 ports
:*
: target all ports (same as :1-65535
)
options: Object
options.protocol: string <tcp|udp>
options.filterBogon: boolean
options.dnsServer: string <server>
ping.tcp(target, options);
ping.udp(host, port, options);
host: string [host]
port: number <port>
options: Object
options.timeout: number <miliseconds>
options.filterBogon: boolean
options.dnsServer: string <server>
ping.scan(host, ports, options);
host: string [host]
ports: Array <ports>
options: Object
options.timeout: number <miliseconds>
options.chunk: number <chunk>
options.protocol: string <tcp|udp>
options.filterBogon: boolean
options.dnsServer: string <server>
FAQs
A simple TCP & UDP ping tool
The npm package ping-ports receives a total of 0 weekly downloads. As such, ping-ports popularity was classified as not popular.
We found that ping-ports 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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.