LINUX 網絡工具中的“瑞士軍刀” nc 命令

LINUX 網絡工具中的“瑞士軍刀” nc 命令

LINUX 網絡工具中的“瑞士軍刀” nc 命令


資料來源:https://mp.weixin.qq.com/s?__biz=MzI4MDEwNzAzNg==&mid=2649445749&idx=1&sn=936328fabf30e2b44794cd3c96a9533f&chksm=f3a27406c4d5fd10450e5129c8f381a4e154f01a3640e1ec167660174bd6d657fbd34f06054e&scene=0&xtrack=1&key=858dee57b55a82bad5ea70d0ae676e7f9092d10a5720c599627c9fa8abc7f978a48ce82aab69857e7067cfd55529a10c6ff810f2b64ed089fe780adc051ad8017be67b4364f1e0f374a9a506dbd99dbf&ascene=1&uin=MjIwODk2NDgxNw%3D%3D&devicetype=Windows+10&version=62060833&lang=zh_TW&pass_ticket=jd0FmLamz5BWbjuX02VQ0wh2VlZDY8vdrMRYlNT58KfcgD9rDEvmVZnZHBNhZyJD


查看端口是否被佔用

$ nc -l 6379
nc: Address already in use


端口掃描

$ nc  -n 127.0.0.1 -z 1230-1234 -v
nc: connect to 127.0.0.1 port 1230 (tcp) failed: Connection refused
nc: connect to 127.0.0.1 port 1231 (tcp) failed: Connection refused
nc: connect to 127.0.0.1 port 1232 (tcp) failed: Connection refused
nc: connect to 127.0.0.1 port 1233 (tcp) failed: Connection refused
Connection to 127.0.0.1 1234 port [tcp/*] succeeded!


TCP/UDP連接測試

$ nc 127.0.0.1 1234
hello 编程珠玑


HTTP連接測試

$ nc  google.com 80


數據傳輸

$ nc 127.0.0.1 1234 < in.txt


2 thoughts on “LINUX 網絡工具中的“瑞士軍刀” nc 命令

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *