Basic implementation of ncat in GO language.
___ ___ ___ ___ ___
/\__\ /\ \ /\ \ /\ \ /\ \
/:| _|_ /::\ \ \:\ \ /::\ \ /::\ \
/::|/\__\ /::\:\__\ /::\__\ /:/\:\__\ /:/\:\__\
\/|::/ / \:\:\/__/ /:/\/__/ \:\:\/__/ \:\/:/ /
|:/ / \:\/__/ \/__/ \::/ / \::/ /
\/__/ \/__/ \/__/ \/__/
| Flags | Implemented | Description |
|---|---|---|
-b, --broker |
No | Enable connection brokering mode |
-d <time>, --delay <time> |
No | Wait between read/writes |
-e <command>, --exec <command> |
Yes | Executes the given command |
-h, --help |
Yes | Display help screen |
-k, --keep-open |
Yes | Accept multiple connections in listen mode |
-l, --listen |
Yes | Bind and listen for incoming connections |
-m <number>, --max-conns <number> |
Yes | Maximum simultaneous connections (default: 50) |
-n, --nodns |
No | Do not resolve hostnames via DNS |
-u, --udp |
No | Use UDP instead of default TCP |
-v, --verbose |
No | Set verbosity level |
-w, --wait <time> |
No | Connect timeout |
-x <proxy>, --proxy <proxy> |
Yes | Specify address of http or socks5 host to proxy through (HTTP proxy works only with CONNECT method) |
--send |
Yes | Only send data, ignoring received and quit on EOF (Print md5 checksum) |
--recv |
Yes | Only receive data, never send anything and quit on EOF (Print md5 checksum) |
--tls |
Yes | Connect or listen with TLS |
--tls-cert |
Yes | Specify TLS certificate file (PEM) for listening |
--tls-key |
Yes | Specify TLS private key (PEM) for listening |
--version |
Yes | Display version information and exit |
-
Get the project:
git clone [email protected]:WhatTheSlime/NetGo.git cd NetGo
-
Compile the project:
-
For Linux and Windows:
make
-
For Linux:
make linux
-
For Windows:
make windows
-
For MacOS:
make darwin
-
-
(Optional) Package binaries using upx
upx --best build/* -
Use it:
cd build ./netgo -h
Consider following network configuration:
+--------+ +--------+ +--------+
| Host 1 | | Host 2 | | Host 3 |
|--------| --> |--------| --> |--------|
| Start | | Jump | | Target |
+--------+ +--------+ +--------+
Connect from host1 to host3 using host2:
Equivalent to
ssh -J host2:2000 host3 -p 3000
-
Start listener on host3:
./netgo -l 3000 -e /bin/bash
-
Start port forwarder on host2:
./netgo -l 2000 -e './netgo host3 3000' -
Connect to host2 from host1:
./netgo host2 2000
Consider following network configuration:
+--------+ +--------------------+
| Host 1 | One way | Host 2 |
|--------| -- connection --> |--------------------|
| Client | | Local HTTP service |
+--------+ +--------------------+
Forward local port host1:8001 to the host2:8002 HTTP service:
Equivalent to
ssh host2 -p 1337 -NL 127.0.0.1:8001:127.0.0.1:8002
-
Start a local HTTP service on host2:
python3 -m http.server -b 127.0.0.1 8002
-
Start listener + forwarder on host2:
./netgo -l 1337 -e './netgo 127.0.0.1 8002' -
Start listener + forwarder on host1:
./netgo -l 8001 -e './netgo host2 1337' -
Access to host2 local HTTP service from host1:
curl http://127.0.0.1:8001
Consider following network configuration:
+--------------------+ +--------+
| Host 1 | One way | Host 2 |
|--------------------| -- connection --> |--------|
| Local HTTP service | | Client |
+--------------------+ +--------+
Forward a remote port host2:8002 to the host1:8001 HTTP service:
Equivalent to
ssh host2 -p 1337 -NR 127.0.0.1:8002:127.0.0.1:8001
-
Start an HTTP service on host1:
python3 -m http.server -b 127.0.0.1 8001
-
Start forwarder + listener on host2:
./netgo -l 1337 -e './netgo -l 127.0.0.1 8002' -
Start client + forwarder on host1:
./netgo host2 1337 -e './netgo 127.0.0.1 8001' -
Access to host1 local HTTP service from host2:
curl http://127.0.0.1:8002