Linux Netcat 命令


  netcat用於調試和檢查網絡,能通過TCP和UDP在網絡中讀寫數據。netcat是在兩臺電腦之間建立鏈接並返回兩個數據流,可以建立一個服務器,傳輸文件,與朋友聊天,傳輸流媒體或者用它作爲其它協議的獨立客戶端。

 

0x01、端口掃描

ncat-v -n 192.168.1.1 80

-v:顯示詳細信息

-n:使用純數字ip地址,不用DNS來解析ip地址

-w 1 :設置超時時間爲1

-u:掃描UDP端口,默認TCP

-z:使用0IO,連接成功後立即關閉連接, 不進行數據交換

-l:連接和收聽到來的連接

-e:執行傳遞的命令行

-k:接受多個聽模式的連接

0x02、聊天服務

Server

在10086端口啓動一個tcp服務器

ncat -l 10086

Client

在機器上Clent上輸入,Server會顯示出來

ncat localhost 10086

0x03、文件傳輸

服務器向客戶端傳輸文件

Server

ncat-l 10086 < test.txt

Client

ncat -n 127.0.0.1 10086 > test.txt

客戶端向服務器傳輸文件

Server

touch test.txt

ncat -l 10086 > test.txt

Clinet

cat test.txt | ncat localhost 10086

0x04、目錄傳輸

Server

tar -czvf - python |  ncat -l10086

Clinet

ncat -n 127.0.0.1 10086 | tar -xvf -

0x05、克隆一個設備

Server

ddif=/dev/sda | nc -l 10086

Clinet

ncat -n 127.0.0.1 10086 | dd of=/dev/sda

0x06、打開一個shell

Server

ncat -l 10086 -e /bin/bash -i

Client

ncat -l 192.168.1.1 10086

反向shell

Server

ncat -l 10086

Cliet

ncat 127.0.0.1 10086 -e /bin/bash

        

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章