2
[造轮子]端口扫描器 tcp-port-scaner
source link: https://www.v2ex.com/t/816369
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
nodejs 实现的端口扫描器,还请大佬们 review 和指正
https://github.com/DragonCat1/tcp-port-scaner
受限于 nodejs ,不能实现 SYN 的扫描方式,效能上肯定不及那些成熟的工具,不过轻量使用完全够
做这个也就一时兴起,仅供娱乐,注意安全😈
相比其他工具,除了 cli 用法,还可以直接编程化使用,可以说是很方便加入后续处理逻辑了
最后,手留 star ,手有余香
↓↓README↓↓
TCP-PORT-SCANER
A Multi Thread TCP Port Scaner
Install
npm i tcp-port-scaner -g
Usage
1. Single target
portscan --target 127.0.0.1 --ports 80
2. Multi target
portscan --target 192.168.1.1 192.168.1.2 --ports 80
3. IP range target
portscan --target 192.168.1.1-192.168.1.254 --ports 80
4. CIDR range target
portscan --target 192.168.1.1/24 --ports 80
5. Target from iplist file
portscan -f iplist.list --ports 80
6. Multi Ports
portscan --target 127.0.0.1 --ports 80 81 2000-3000
For More Options
portscan -h
Programme
const Scaner = require('tcp-port-scaner')
const scaner = new Scaner()
scaner.init({
targets: ['192.168.1.1/24', '192.168.2.1-192.168.2.254'],
ports: [80, 81, '1000-2000'],
thread: 100,
timeout: 5000,
callback({ host, port, open }) {
if (open) {
console.log(`${host}:${port} is open`)
}
},
})
scaner.run()
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK