SkillAgentSearch skills...

Pync

arbitrary TCP and UDP connections and listens (Netcat for Python).

Install / Use

/learn @bw0rth/Pync

README

<h1 align="left"> <a href="https://github.com/bw0rth/pync"><img src="identicon.png" alt="pync" width=50></a> pync </h1> <p align="left"> <a href="https://www.python.org/"> <img src="https://img.shields.io/badge/Made%20with-Python-1f425f.svg"> </a> <a href="https://gitHub.com/bw0rth/pync/stargazers/"> <img src="https://badgen.net/github/stars/bw0rth/pync"> </a> <a href="https://gitHub.com/bw0rth/pync/network/members"> <img src="https://badgen.net/github/forks/bw0rth/pync"> </a> </br> <a href="https://github.com/bw0rth/pync/actions/workflows/python-package.yml"> <img src="https://github.com/bw0rth/pync/actions/workflows/python-package.yml/badge.svg"> </a> <a href="https://readthedocs.org/projects/pync/"> <img src="https://readthedocs.org/projects/pync/badge/?version=latest"> </a> </br> <a href="https://github.com/bw0rth/pync/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/bw0rth/pync"> </a> </p>

Name

pync - arbitrary TCP and UDP connections and listens (Netcat for Python).

Synopsis

<details open> <summary>Unix</summary>
pync [-46bCDdhklnruvz] [-c string] [-e filename] [-I length]
     [-i interval] [-O length] [-P proxyuser] [-p source_port]
     [-q seconds] [-s source] [-T keyword] [-w timeout]
     [-X proto] [-x addr[:port]]
     [-Y pyfile] [-y pycode] [dest] [port]
</details> <details> <summary>Windows</summary>
py -m pync [-46bCDdhklnruvz] [-c string] [-e filename] [-I length]
           [-i interval] [-O length] [-P proxyuser] [-p source_port]
           [-q seconds] [-s source] [-T keyword] [-w timeout]
           [-X proto] [-x addr[:port]]
           [-Y pyfile] [-y pycode] [dest] [port]
</details> <details> <summary>Python</summary>
import pync
args = '''[-46bCDdhklnruvz] [-c string] [-e filename] [-I length]
          [-i interval] [-O length] [-P proxyuser] [-p source_port]
          [-q seconds] [-s source] [-T keyword] [-w timeout]
          [-X proto] [-x addr[:port]]
          [-Y pyfile] [-y pycode] [dest] [port]'''
pync.run(args, stdin, stdout, stderr)
</details>

Description

Inspired by the Black Hat Python book, the goal of pync is to create an easy to use library that provides Netcat-like functionality for Python developers.</br>

Common uses include:

Installation

pync should work on any system with Python installed (version 2.7 or higher).

Use Python's pip command to install pync straight from github:

<details open> <summary>Unix</summary>
python -m pip install https://github.com/bw0rth/pync/archive/main.zip
</details> <details> <summary>Windows</summary>
py -m pip install https://github.com/bw0rth/pync/archive/main.zip
</details>

Usage

Options

| Option | Description | :------------- | :---------- | -4 | Use IPv4 addresses only | -6 | Use IPv6 addresses only | -b | Allow broadcast | -C | Send CRLF as line-ending | -c string | specify shell commands to exec after connect (use with caution). | -D | Enable the debug socket option | -d | Detach from stdin | -e filename | specify filename to exec after connect (use with caution). | -h, --help | show available options and exit. | -I length | TCP receive buffer length | -i secs | Delay interval for lines sent, ports scanned | -k | Keep inbound sockets open for multiple connects | -l | Listen mode, for inbound connects | -n | Suppress name/port resolutions | -O length | TCP send buffer length | -P proxy_username | Username for proxy authentication | -p source_port | Specify local port for remote connects | -q seconds | quit after EOF on stdin and delay of seconds | -r | Randomize remote ports | -s source | Local source address | -T toskeyword | Set IP Type of Service | -u | UDP mode [default: TCP] | -v | Verbose | -w secs | Timeout for connects and final net reads | -X proxy_protocol | Proxy protocol: "4", "5" (SOCKS) or "connect" | -x proxy_address[:port] | Specify proxy address and port | -Y pyfile | specify python file to exec after connect (use with caution). | -y pycode | specify python code to exec after connect (use with caution). | -z | Zero-I/O mode [used for scanning] | dest | The destination host name or ip to connect or bind to | port | The port number to connect or bind to

API Reference

Examples

| Example | Description | :------ | :---------- | chat.py | Simple chat protocol with a custom username | upload.py | Simple file upload (use with caution). | download.py | Simple file download (use with caution). | echo.py | Echo client/server | proxy.py | Simple TCP proxy server | pyshell.py | Reverse or bind python interpreter shell (use with caution). | scan.py | Simple TCP connect port scanner | shell.py | Reverse or bind remote system shell (use with caution). | sock.py | Using sockets with pync

See Also

Caveats

UDP port scans will always succeed (i.e report the port as open), rendering the -uz combination of flags relatively useless.

Related Skills

View on GitHub
GitHub Stars100
CategoryDevelopment
Updated5mo ago
Forks9

Languages

Python

Security Score

97/100

Audited on Oct 22, 2025

No findings