Remote command shell application written in C#, targeting the .NET 8 runtime.
DotnetCat is a multithreaded console application that can be used to spawn bind and reverse command shells, upload and download files, perform connection testing, and transmit user-defined payloads. This application uses Transmission Control Protocol (TCP) network sockets to perform network communications.
At its core, DotnetCat is built of unidirectional TCP socket pipelines, each responsible for asynchronously reading from or writing to a connected socket. This allows a single socket stream to be used by multiple pipelines simultaneously without thread lock issues occurring.
- Bind command shells
- Reverse command shells
- Remote file uploads and downloads
- Connection probing
- User-defined data transmission
-
Linux Systems
dncat [OPTIONS] TARGET
-
Windows Systems
dncat.exe [OPTIONS] TARGET
All available DotnetCat arguments are listed in the following table:
Argument | Type | Description | Default |
---|---|---|---|
TARGET |
Required | Host to use for the connection | N/A |
-p/--port PORT |
Optional | Port to use for the connection | 44444 |
-e/--exec EXEC |
Optional | Pipe executable I/O data (shell) | N/A |
-o/--output PATH |
Optional | Download a file from a remote host | N/A |
-s/--send PATH |
Optional | Send a local file to a remote host | N/A |
-t, --text |
Optional | Send a string to a remote host | False |
-l, --listen |
Optional | Listen for an inbound connection | False |
-z, --zero-io |
Optional | Determine if an endpoint is open | False |
-v, --verbose |
Optional | Enable verbose console output | False |
-d, --debug |
Optional | Enable verbose error output | False |
-h/-?, --help |
Optional | Display the app help menu and exit | False |
See the usage examples section for more information.
The tools directory contains Linux and Windows installer and uninstaller scripts.
The dncat-install.sh installer can be used to install DotnetCat on Linux systems.
The following code snippet can be executed in Bash to download and run the dncat-install.sh DotnetCat installer:
curl -sLS "https://raw.githubusercontent.com/vandavey/DotnetCat/master/tools/dncat-install.sh" | bash
DotnetCat can be uninstalled using the dncat-uninstall.sh uninstaller.
dncat-install.sh and dncat-uninstall.sh only support ARM64 and x64 Linux systems and requirecurl
andunzip
to be installed.
The dncat-install.ps1 installer can be used to install DotnetCat on Windows systems.
The following code snippet can be executed in PowerShell to download and run the dncat-install.ps1 DotnetCat installer:
$Uri = "https://raw.githubusercontent.com/vandavey/DotnetCat/master/tools/dncat-install.ps1"
(Invoke-WebRequest $Uri -DisableKeepAlive).Content | powershell.exe -
DotnetCat can be uninstalled using the dncat-uninstall.ps1 uninstaller.
dncat-install.ps1 and dncat-uninstall.ps1 only support x64 and x86 Windows systems and must be executed as an administrator.
The entire DotnetCat source code repository can be downloaded here.
To download a precompiled standalone executable, select one of the options below:
-
Display the application help menu, then exit:
dncat --help
-
Connect to remote endpoint
192.168.1.1:1524
:dncat "192.168.1.1" --port 1524
-
Listen for an inbound connection on any local Wi-Fi interface:
dncat --listen
When the
-l
or--listen
flag is specified,TARGET
defaults to0.0.0.0
. -
Determine if
localhost
is accepting connections on port22
:dncat -z localhost -p 22
-
Connect to remote endpoint
127.0.0.1:4444
to establish a bind shell:dncat "127.0.0.1" -p 4444
-
Listen for an inbound connection to establish a reverse
bash
shell:dncat -lv --exec bash
-
Transmit string payload Hello world! to remote endpoint
fake.addr.com:80
:dncat -dt "Hello world!" fake.addr.com -p 80
-
Listen for inbound file data and write the contents to path
C:\TestFile.txt
:dncat -lvo C:\TestFile.txt
-
Transmit the contents of file
/home/user/profit.json
to remote targetJoe-Mama
:dncat --send /home/user/profit.json Joe-Mama
-
This application is designed to be used as a multi-functional command-line networking tool, and should only be used on your own systems.
-
Please use discretion, as this application is still in development.
-
In no event shall the authors or copyright holders of this software be liable for any claim, damages or other liability arising from, out of or in connection with the software or the use or other dealings in the software.
For more information, click here to view the software's MIT license.
The DotnetCat application source code is available here and licensed under the MIT license.