Guest User

Untitled

a guest
Jun 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "ProcessSpy.h"
  3. #include <Windows.h>
  4.  
  5. const int Processes = 4;
  6. char* illegalProcesses[Processes] = {"cheatengine", "olly", "winject", "wpe pro"};
  7.  
  8.  
  9. void ProcessSpy::terminate(){
  10. MessageBox(0,"[BinaryX Shield] Hacking tool detected!", "Terminating..", 0);
  11. ExitProcess(0);
  12. }
  13.  
  14. void ProcessSpy::checkProcesses(){
  15. HANDLE hProcessSnap;
  16. PROCESSENTRY32 pe32;
  17. char tempChar;
  18.  
  19. // Take a snapshot of all processes in the system.
  20. hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
  21. pe32.dwSize = sizeof(PROCESSENTRY32);
  22.  
  23. // On problems, kill the program
  24. if( !Process32First( hProcessSnap, &pe32)){
  25. CloseHandle( hProcessSnap );
  26. MessageBox(0,"[BinaryX Shield] ProcessSpy error - 1001", "Warning", 0);
  27. ExitProcess(0);
  28. }
  29.  
  30. // No problems so far? Then let's check for illegal stuff!
  31. // This do-loop will loop though all processes
  32. do{
  33. LPCSTR currentProcess = pe32.szExeFile;
  34. for(int i=0; i<Processes; i++){
  35. for(int p=0; p<sizeof(illegalProcesses[i]); p++){
  36. if(illegalProcesses[i][p] == pe32.szExeFile[p] || toupper(illegalProcesses[i][p]) == pe32.szExeFile[p]){
  37. if(p == sizeof(illegalProcesses[i])-1){
  38. //Process is illegal!
  39. terminate();
  40. }
  41. }else{
  42. //Process not illegal, move on to the next process!
  43. break;
  44. }
  45. }
  46. }
  47. }while(Process32Next( hProcessSnap, &pe32));
  48. CloseHandle( hProcessSnap );
  49. }
Add Comment
Please, Sign In to add comment