게임에 대한 wallhack을 감지하기위한 코드를 작성하려고합니다. 기본적으로 윈도우 에어로 투명한 창을 만드는 해킹이 존재하며,이 외부 창에 해킹을 그립니다. 따라서 게임 자체의 스크린 샷을 찍어서 탐지 할 수 없습니다. 1. 게임 윈도우의 화면을 캡처 - 순간스크린 샷 분석을 통한 게임 해킹 감지 C#
내 접근 방식이다. 2. 동일한 좌표에 대해 Windows 바탕 화면의 스크린 샷을 만듭니다. 3. 이미지 분석을 수행하여 스크린 샷 1과 스크린 샷 2를 비교하여 차이점이 있는지 확인하십시오.
내 문제는 스크린 (1)와 스크린 (2)이 동시에 수행되지 않도록 게임 새로운 프레임 영상을 비교할 때 가양 일으키는 두 스크린 사이에 그려 질 수 있다는 것이다.
나는 그들이 정확히 동시에 발생하므로 스크린 샷을 조정하는 방법이 있는지 알고 싶어? 또는 어떻게 든 내 스크린 샷이 완료 될 때까지 새로운 프레임을 그리는 화면을 멈추게할까요?
이
내가 스크린 샷을내어 사용하는 코드입니다. 참고로 두 개의 작업 항목을 대기열에 넣어서 2 개의 스크린 샷을 병렬로 처리하려고했습니다. 그러나 이렇게해도 정확히 같은 시간에 스크린 샷이 발생하지는 않습니다. 스크린 샷이 끝날 때까지 그래픽 카드의 화면을 더 이상 업데이트하지 못하게하는 방법이 있는지 궁금합니다. 아니면 내가 할 수있는 다른 방법? 그것으로, 렌더링 중지에 대한 당신은 그 모든 컴퓨터에서 작동하지 않습니다 즉, 일부 그래픽 accelarators에 자원하지 않는 한, 동시에 스크린 샷을 가질 수 될 수 없습니다public void DoBitBlt(IntPtr dest, int width, int height, IntPtr src)
{
GDI32.BitBlt(dest, 0, 0, width, height, src, 0, 0, GDI32.SRCCOPY);
}
public struct Windows
{
public Bitmap window;
public Bitmap desktop;
}
public Windows CaptureWindows(IntPtr window, IntPtr desktop, User32.RECT coords)
{
Windows rslt = new Windows();
// get te hDC of the target window
IntPtr hdcSrcWindow = User32.GetWindowDC(window);
IntPtr hdcSrcDesktop = User32.GetWindowDC(desktop);
// get the size
int width = coords.right - coords.left;
int height = coords.bottom - coords.top;
// create a device context we can copy to
IntPtr hdcDestWindow = GDI32.CreateCompatibleDC(hdcSrcWindow);
IntPtr hdcDestDesktop = GDI32.CreateCompatibleDC(hdcSrcDesktop);
// create a bitmap we can copy it to,
// using GetDeviceCaps to get the width/height
IntPtr hBitmapWindow = GDI32.CreateCompatibleBitmap(hdcSrcWindow, width, height);
IntPtr hBitmapDesktop = GDI32.CreateCompatibleBitmap(hdcSrcDesktop, width, height);
// select the bitmap object
IntPtr hOldWindow = GDI32.SelectObject(hdcDestWindow, hBitmapWindow);
IntPtr hOldDesktop = GDI32.SelectObject(hdcDestDesktop, hBitmapDesktop);
// bitblt over
var handle1 = new ManualResetEvent(false);
var handle2 = new ManualResetEvent(false);
Action actionWindow =() => { try { DoBitBlt(hdcDestWindow, width, height, hdcSrcWindow); } finally { handle1.Set(); } };
Action actionDesktop =() => { try { DoBitBlt(hdcDestDesktop, width, height, hdcSrcDesktop); } finally { handle2.Set(); } };
ThreadPool.QueueUserWorkItem(x => actionWindow());
ThreadPool.QueueUserWorkItem(x => actionDesktop());
WaitHandle.WaitAll(new WaitHandle[] { handle1, handle2 });
rslt.window = Bitmap.FromHbitmap(hBitmapWindow);
rslt.desktop = Bitmap.FromHbitmap(hBitmapDesktop);
// restore selection
GDI32.SelectObject(hdcDestWindow, hOldWindow);
GDI32.SelectObject(hdcDestDesktop, hOldDesktop);
// clean up
GDI32.DeleteDC(hdcDestWindow);
GDI32.DeleteDC(hdcDestDesktop);
User32.ReleaseDC(window, hdcSrcWindow);
User32.ReleaseDC(desktop, hdcSrcDesktop);
// free up the Bitmap object
GDI32.DeleteObject(hBitmapWindow);
GDI32.DeleteObject(hBitmapDesktop);
return rslt;
}
나는 당신이하고있는 것이 윤리적이라고 믿지 않는다. 'wallhack'감지기가 사용자가 누설하기를 원치 않는 정보를 수집합니다. 왜 사용자가 게임을하는 동안 데스크톱 캡처 화면을 가져 오는 데 동의합니까? 구현하려는 동작은 트로이 목마 분류에 따라 결정됩니다. 물론 당신이 당신 프로그램의 목적에 대해 거짓말을하지 않는다면 말입니다. –
이것은 ['Parallel.Foreach']의 적절한 사용 일 수 있습니다 (http://msdn.microsoft.com/en-us/library/system.threading.tasks.parallel.foreach.aspx). 'ThreadPool'은 병렬 처리를 보장하지 않습니다. – Romoku
게임을 창에서 열어 놓은 다음 그 창을 통해 웹 브라우저를 열어 (google something | 내 은행 계좌 확인 | Facebook 탐색 | 불법 행위) 스크린 샷을 찍습니다.불필요한 것을 기록 할 것입니다. 그렇지 않을 때 제가 속이고 있습니다. 증명/검증을 위해 "위조 된"스크린 샷을 업로드해야한다고 결정하면 실수로 내 개인 정보를 캡처 할 수 있습니다. –