[Tool/Web/Other] bAnticheat [C# Client]

Started by SA:MP, May 10, 2023, 02:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SA:MP

[Tool/Web/Other] bAnticheat [C# Client]




bAnticheat




HOW DOES IT WORK?



If a server is protected by bAnticheat, a player will only be able to play on it if it has the anticheat client opened in his computer. When a player connects to the server, he will need to input a code that was on the client for authentication purposes. That code will automatically be copied to the player clipboard. After connected, if the player closes the client, uses cheats, or whatever, it will be kicked by the server.



When a player is banned, it's banned through hardware id, meaning it will only be able to join the server if it changes the hardware on the PC. This method can be improved.





SCHEMA CONFIGURATION



The first step is to understand the schema that the anticheat uses. When a player connects the anticheat to the server, the server will return a URL that will hold the schema. In this version, it's possible to detect altered game files (via checksum), forbidden files, forbidden directories and forbidden process. This is a simple scheme that I created so you can understand better:




PHP Code:




{

  
"gtaRunning"true,

  
"sampRunning"true,

  
"monitorProcessesConstantly"true,

  
"validationFiles": [

    {

      
"path""gta_sa.exe",

      
"hash""a559aa772fd136379155efa71f00c47aad34bbfeae6196b0fe1047d0645cbd26",

      
"action""PREVENT_CONNECT"

    
},

    {

      
"path""newton.dll",

      
"hash""5a62625396abcd729d37c969de60b6ff72c36fe8bda4f1ad96a5b97f2e96040b",

      
"action""PREVENT_CONNECT"

    
},

    {

      
"path""data/weapon.dat",

      
"hash""033b3db45a00464fd95cb28870c97b45b0712f0ac53f3e8c586c88aaa0a420f8",

      
"action""PREVENT_CONNECT"

    
}

  ],

  
"forbiddenFiles": [

    {

      
"path""vorbisHooked.dll",

      
"action""PREVENT_CONNECT"

    
}

  ],

  
"forbiddenDirectories": [

    {

      
"path""modloader",

      
"action""PREVENT_CONNECT"

    
}

  ],

  
"forbiddenProcesses": [

    {

      
"name""cheatengine",

      
"action""PREVENT_CONNECT"

    
},

    {

      
"name""samphack",

      
"action""NONE"

    
}

  ]








This is a JSON object that holds the instructions that the anticheat will understand and execute. Gonna explain every field:



gtaRunning - if true, the AC will be constantly monitoring if GTA is running and also if the running GTA instance is the same that was analysed by the anticheat. This will previne that a player can have multiple installs of GTA, one with cheats and the other one without, and will be always forced to use the clean install. Not having the GTA running or not having the GTA running from the "oficial" location, will result in a kick.



sampRunning - if true, the AC will be constantly monitoring if SAMP is running. It probably can be useful for someone, or in future versions.



monitorProcessesConstantly - if true, the AC will be constantly monitoring the running processes in the player computer. If it founds a forbidden one, he will be kicked.



validationFiles - array of files. The AC will compare the checksums of the player files with the checksum you enter in the schema. If the checksums are different, the AC will execute the action defined for that specific file. At this time, there is only one action avaliable, that is PREVENT_CONNECT, that will prevent the AC to connect to the server. In future versions will be more.



forbiddenFiles - array of files. The AC will verify if any of the forbidden files exist in the GTA directory. If it does, the action for that specific file will be executed.



forbiddenDirectories - array of directories. The AC will verify if any of the forbidden directory exist in the GTA directory. If it does, the action for that specific file will be executed.



forbiddenProcesses - array of processes. The AC will check if any forbidden process is being executed. If it does, the action for that specific process will be executed.



For those who are not familiarized with JSON, you can use this site to try to visualize it better:

https://jsoneditoronline.org



Site to check files checksum (sha256):

https://md5file.com/calculator





CONFIGURE FILTERSCRIPT



First, you will need to create a folder named bac inside the filterscripts. In that folder, create an empty file named uids.txt.



Change the define SECURITY_CODE to the client checksum (compile the client, go to the site above and get the sha256 checksum), if you done any code changes in the client project.



Change the define SCHEMA_URL to the schema created by you. You will need to host it in some place, I recommend pastebin (raw).



Compile.



HOW TO CONNECT THE ANTICHEAT



Open the client, enter the server IP and click connect. If you have done everything right, you will now see the message: Validated. Waiting for player to join. You will also see a 5 digit code near the button. That code will need to be introduced in the server. (Just CTRL+V, it's already in your clipboard)





PRINTSCREENS



Interface





Altered file alert





Banned player





Introduce the join code





If you try to enter without the Anticheat





DEPENDENCIES



strlib

zcmd

sscanf

socket [0.1b] with fixes



ADMIN COMMANDS



/bacban - permanently bans a player

/bacinfo - displays some information about a player



DOWNLOADS



CLIENT

SOURCE (CLIENT + FILTERSCRIPT)

REPOSITORY






Source: [Tool/Web/Other] bAnticheat [C# Client]