[GH-ISSUE #641] Server used Mirror driver can significantly improve remote monitoring performance #393

Open
opened 2026-02-27 15:50:11 +03:00 by kerem · 6 comments
Owner

Originally created by @hucya on GitHub (Jan 20, 2018).
Original GitHub issue: https://github.com/quasar/Quasar/issues/641

I made some changes to Screenhelper -> CaptureScreen on the Client side of the software using the Mirror Driver technology to achieve software remote monitoring performance of 45fps,
It must used dfmirage-setup-2.0.301 Driver and Restart your computer;

 static ScreenHelper()
    {
        desktopMirror = new DesktopMirror();
        try
        {
            desktopMirror.Load();
            fastMode = desktopMirror.Connected;
        }
        catch
        {
            fastMode = false;
            desktopMirror.Dispose();
        }
    }


public static Bitmap CaptureScreen(int screenNumber)
    {
        if (fastMode)
        {
            return desktopMirror.GetScreen();
        }
        else
        {
            Rectangle bounds = GetBounds(screenNumber);
            Bitmap screen = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppPArgb);
            return screen;
        }
    }

ResourceLib.zip

Originally created by @hucya on GitHub (Jan 20, 2018). Original GitHub issue: https://github.com/quasar/Quasar/issues/641 **I made some changes to Screenhelper -> CaptureScreen on the Client side of the software using the Mirror Driver technology to achieve software remote monitoring performance of 45fps,** *It must used dfmirage-setup-2.0.301 Driver and Restart your computer;* static ScreenHelper() { desktopMirror = new DesktopMirror(); try { desktopMirror.Load(); fastMode = desktopMirror.Connected; } catch { fastMode = false; desktopMirror.Dispose(); } } public static Bitmap CaptureScreen(int screenNumber) { if (fastMode) { return desktopMirror.GetScreen(); } else { Rectangle bounds = GetBounds(screenNumber); Bitmap screen = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppPArgb); return screen; } } [ResourceLib.zip](https://github.com/quasar/QuasarRAT/files/1648646/ResourceLib.zip)
Author
Owner

@cyclo-techtwister commented on GitHub (Jan 20, 2018):

Please explain a little more in detail on replacing server side dll. Where does one edit or get this new file (ILSY)?

<!-- gh-comment-id:359158913 --> @cyclo-techtwister commented on GitHub (Jan 20, 2018): Please explain a little more in detail on replacing server side dll. Where does one edit or get this new file (ILSY)?
Author
Owner

@hucya commented on GitHub (Jan 20, 2018):

  1. Download this ResourceLib.zip and extract

  2. Install dfmirage-setup-2.0.301.exe and restart the computer;

  3. Open the source Clinet project in the Client.Core.Helper directory to join the DesktopMirror.cs file

  4. Copy the following code to ScreenHelper.cs file

     using System;
     using System.Drawing;
     using System.Drawing.Imaging;
     using System.Windows.Forms;
     using xClient.Core.Utilities;
    
     namespace xClient.Core.Helper
     {
         public static class ScreenHelper
         {
             private const int SRCCOPY = 0x00CC0020;
             private static DesktopMirror desktopMirror;
             private static bool fastMode = true;
    
             static ScreenHelper()
             {
                 desktopMirror = new DesktopMirror();
                 try
                 {
                     desktopMirror.Load();
                     fastMode = desktopMirror.Connected;
                 }
                 catch
                 {
                     fastMode = false;
                     desktopMirror.Dispose();
                 }
             }
    
             public static Bitmap CaptureScreen(int screenNumber)
             {
                 if (fastMode)
                 {
                     return desktopMirror.CaptureScreen();
                 }
                 else
                 {
                     Rectangle bounds = GetBounds(screenNumber);
                     Bitmap screen = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppPArgb);
                     using (Graphics g = Graphics.FromImage(screen))
                     {
                         g.CopyFromScreen(0, 0, 0, 0, new Size(bounds.Width, bounds.Height),CopyPixelOperation.SourceCopy);
                         //IntPtr destDeviceContext = g.GetHdc();
                         //IntPtr srcDeviceContext = NativeMethods.CreateDC("DISPLAY", null, null, IntPtr.Zero);
                         //NativeMethods.BitBlt(destDeviceContext, 0, 0, bounds.Width, bounds.Height, srcDeviceContext, bounds.X,bounds.Y, SRCCOPY);
                         //NativeMethods.DeleteDC(srcDeviceContext);
                         //g.ReleaseHdc(destDeviceContext);
                     }
                     return screen;
                 }
             }
    
             public static System.Drawing.Rectangle GetBounds(int screenNumber)
             {
                 return Screen.AllScreens[screenNumber].Bounds;
             }
    
         }
     }
    
<!-- gh-comment-id:359159955 --> @hucya commented on GitHub (Jan 20, 2018): 1. Download this ResourceLib.zip and extract 2. Install dfmirage-setup-2.0.301.exe and restart the computer; 3. Open the source Clinet project in the Client.Core.Helper directory to join the DesktopMirror.cs file 4. Copy the following code to ScreenHelper.cs file using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; using xClient.Core.Utilities; namespace xClient.Core.Helper { public static class ScreenHelper { private const int SRCCOPY = 0x00CC0020; private static DesktopMirror desktopMirror; private static bool fastMode = true; static ScreenHelper() { desktopMirror = new DesktopMirror(); try { desktopMirror.Load(); fastMode = desktopMirror.Connected; } catch { fastMode = false; desktopMirror.Dispose(); } } public static Bitmap CaptureScreen(int screenNumber) { if (fastMode) { return desktopMirror.CaptureScreen(); } else { Rectangle bounds = GetBounds(screenNumber); Bitmap screen = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppPArgb); using (Graphics g = Graphics.FromImage(screen)) { g.CopyFromScreen(0, 0, 0, 0, new Size(bounds.Width, bounds.Height),CopyPixelOperation.SourceCopy); //IntPtr destDeviceContext = g.GetHdc(); //IntPtr srcDeviceContext = NativeMethods.CreateDC("DISPLAY", null, null, IntPtr.Zero); //NativeMethods.BitBlt(destDeviceContext, 0, 0, bounds.Width, bounds.Height, srcDeviceContext, bounds.X,bounds.Y, SRCCOPY); //NativeMethods.DeleteDC(srcDeviceContext); //g.ReleaseHdc(destDeviceContext); } return screen; } } public static System.Drawing.Rectangle GetBounds(int screenNumber) { return Screen.AllScreens[screenNumber].Bounds; } } }
Author
Owner

@cyclo-techtwister commented on GitHub (Jan 20, 2018):

OK, thank you. I will have to try this out.. Now this driver needs to be installed on both the compiling machine and the client side?

<!-- gh-comment-id:359161260 --> @cyclo-techtwister commented on GitHub (Jan 20, 2018): OK, thank you. I will have to try this out.. Now this driver needs to be installed on both the compiling machine and the client side?
Author
Owner

@hucya commented on GitHub (Jan 20, 2018):

install the client side, you can test it by debug mode in your computer。

<!-- gh-comment-id:359161438 --> @hucya commented on GitHub (Jan 20, 2018): install the client side, you can test it by debug mode in your computer。
Author
Owner

@cyclo-techtwister commented on GitHub (Jan 20, 2018):

OK, thank you for explaining....

<!-- gh-comment-id:359161516 --> @cyclo-techtwister commented on GitHub (Jan 20, 2018): OK, thank you for explaining....
Author
Owner

@ValonK commented on GitHub (Jan 20, 2018):

Why not create a pull request? if this actually improve things, this would help people

<!-- gh-comment-id:359208184 --> @ValonK commented on GitHub (Jan 20, 2018): Why not create a pull request? if this actually improve things, this would help people
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Quasar#393
No description provided.