Skip to content

Remote command shell application written in C# targeting the .NET 9.0 runtime.

License

Notifications You must be signed in to change notification settings

vandavey/DotnetCat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

DotnetCat

csharp-13-badge license-badge contributors-badge pull-requests-badge

Remote command shell application written in C# targeting the .NET 9.0 runtime.


Overview

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 deadlock issues occurring.

Features

  • Bind command shells
  • Reverse command shells
  • Remote file uploads and downloads
  • Connection probing
  • User-defined data transmission

Basic Usage

Linux Systems

dncat [OPTIONS] TARGET

Windows Systems

dncat.exe [OPTIONS] TARGET

Command-Line Options

All available DotnetCat command-line arguments are listed below:

Argument Type Description Default
TARGET Required Host to use for the connection N/A or 0.0.0.0
-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
-h/-?, --help Optional Display the app help menu and exit False

See the Usage Examples section for more information.


Installation

DotnetCat can be automatically configured and installed or updated using the installers in the tools directory.

It can be installed manually by building from source or using the precompiled standalone executables in the Zips directory.

Linux Systems

Download and execute the dncat-install.sh installer script using Bash:

curl -sLS "https://raw.githubusercontent.com/vandavey/DotnetCat/master/tools/dncat-install.sh" | bash
dncat-install.sh only supports ARM64 and x64 architectures and is dependent on 7-Zip and curl.

Windows Systems

Download and execute the dncat-install.ps1 installer script using PowerShell:

irm -d "https://raw.githubusercontent.com/vandavey/DotnetCat/master/tools/dncat-install.ps1" | powershell -

dncat-install.ps1 only supports x64 and x86 architectures and must be executed as an administrator.

Manual Setup

DotnetCat can be manually installed using the following precompiled standalone executables:

It can be built from source by publishing DotnetCat.csproj using the publish profiles in the PublishProfiles directory.


Uninstallation

DotnetCat can be uninstalled automatically using the uninstallers in the tools directory.

It can be uninstalled manually by deleting the install directory and removing it from the local environment path.

Linux Systems

Execute the dncat-uninstall.sh uninstaller script using Bash:

source /opt/dncat/bin/dncat-uninstall.sh

dncat-uninstall.sh only supports ARM64 and x64 architectures.

Windows Systems

Execute the dncat-uninstall.ps1 uninstaller script using PowerShell:

gc "${env:ProgramFiles}\DotnetCat\dncat-uninstall.ps1" | powershell -

dncat-uninstall.ps1 only supports x64 and x86 architectures and must be executed as an administrator.


Usage Examples

Basic Operations

Print 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

TARGET defaults to 0.0.0.0 when the -l or --listen flag is specified.

Determine whether localhost is accepting connections on port 22:

dncat -z localhost -p 22

Command Shells

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

Data Transfer

Transmit string payload Hello world! to remote endpoint fake.addr.com:80:

dncat -vt "Hello world!" fake.addr.com -p 80

File Transfer

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 target Joe-Mama:

dncat --send /home/user/profit.json Joe-Mama

Remarks

  • This application only supports Linux and Windows operating systems.
  • Please use discretion as this application is still in development.

Copyright & Licensing

DotnetCat is licensed under the MIT license and officially hosted in this repository.