Linux中存在一个特殊的设备文件/dev/tcp/<HOSTNAME>/<PORT>,该文件可以直接和目标建立TCP通信,利用这一特性可以进行端口检测。
zzh@ZZHPC:/dev$ lh | grep tcp zzh@ZZHPC:/dev$ echo > /dev/tcp/192.168.1.16/21 zzh@ZZHPC:/dev$ echo > /dev/tcp/192.168.1.16/22 bash: connect: Connection refused bash: /dev/tcp/192.168.1.16/22: Connection refused zzh@ZZHPC:/dev$ lh /dev/tcp/192.168.1.16/22 ls: cannot access '/dev/tcp/192.168.1.16/22': No such file or directory zzh@ZZHPC:/dev$ lh /dev/tcp/192.168.1.16/21 ls: cannot access '/dev/tcp/192.168.1.16/21': No such file or directory
没有输出表示端口是通的,有输出端口不通。
标签:1.16,ZZHPC,zzh,192.168,dev,Linux,tcp From: https://www.cnblogs.com/zhangzhihui/p/18078809