System Anti-CheatPack System

saw792

Is known to say things. That is all.
Reaction score
280
Anti-CheatPack System
by saw792

Using this system will report any modification to the map script. Combined with map optimisation it will effectively stop people from using a modified version of your map, as it disables all GUI trigger functionality and all JASS triggers (with the exception of libraries, for technical reasons) on detection of modification.

It is recommended that all functioning vJASS code is writeen within scopes (with the exception of systems) in order for them to be disabled on modification detection.

The Code:
AntiCP:
JASS:
scope AntiCP initializer Init
//****************************************************************************************
//
//    | Anti-CheatPack System v1.00                                       by saw792 |
//
//    Using this system will report any modification to the map script. Combined with map
//    optimisation it will effectively stop people from using a modified version of your
//    map, as it disables all GUI trigger functionality and all JASS triggers (with the
//    exception of libraries, for technical reasons) on detection of modification.
//
//    It is recommended that all functioning vJASS code is writeen within scopes (with the
//    exception of systems) in order for them to be disabled on modification detection.
//
//
//    Implementation Instructions:
//       
//     1. Create a blank disabled trigger named AntiCPConfig, convert to custom text
//     2. Copy/Paste the AntiCPConfig library into the blank trigger
//     3. Click the name of your map in the left-hand panel in the trigger editor
//     4. Copy/Paste the AntiCP scope into the Custom Text section
//        NB: The scope MUST be at the VERY top of the custom text section, and
//            NOT in a blank trigger
//     5. Follow the instructions in the AntiCPConfig library
//     6. Set the HANDLE_COUNT variable below to the output of the library
//     7. Configure other constants below
//     8. Set ENABLED = true
//     9. Save your map and enjoy
//
//        NB: Every time you save a final version run the AntiCPConfig library again
//            as the handle count has probably changed
//        NB: When modifying your map set ENABLED = false, and set it to true again
//            when a final version is saved
//
//****************************************************************************************
  globals
    //Output of AntiCPConfig library
    private constant integer HANDLE_COUNT = 0
    //System enabled or disabled
    private constant boolean ENABLED = false
    //Disable triggers initializers on detection?
    private constant boolean TRIGGER_DISABLE = false
    //Show a message to players if modification is detected?
    private constant boolean SHOW_TEXT = true
    //Text to display when SHOW_TEXT = true
    //If SHOW_TEXT = false it is recommended that this string be emptied (i.e. = "")
    private constant string DISP_TEXT = "This map has been modified. Please delete it and redownload from a trusted source."
  endglobals

  private function T2I takes trigger t returns integer
    return t
    return 0
  endfunction
  
  private function Init takes nothing returns nothing
    local integer i
    local trigger t = CreateTrigger()
    if (T2I(t) - 1048584) != HANDLE_COUNT and ENABLED then
      if SHOW_TEXT then
        call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, DISP_TEXT)
      endif
      if TRIGGER_DISABLE then
        set i = i
      endif
    endif
    call DestroyTrigger(t)
    set t = null
  endfunction
  
endscope

AntiCPConfig:
JASS:
library AntiCPConfig initializer Init //requires
//****************************************************************************
//
//    | Anti-CheatPack Configuration Functions                    by saw792 |
//
//    Configuration Instructions:
//   
//     1. Uncomment the 'requires' line above these instructions
//     2. Add in the name of every library in your map separated by ,
//       NB: If you have no vJASS libraries in your map ignore these two steps
//     3. Enable this trigger
//     4. Save your map
//     5. Click 'Test Map' and write down the number that is displayed
//        once the game starts (Handle Count: ...)
//     6. Exit the game
//     7. Disable this library
//     8. Keep this library within your map
//     9. Repeat these instruction every time you save a final version
//
//****************************************************************************
  private function T2I takes trigger t returns integer
    return t
    return 0
  endfunction
  
  private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call BJDebugMsg("Handle Count: " + I2S(T2I(t) - 1048584))
    call DestroyTrigger(t)
  endfunction
  
endlibrary

Instructions are within the code header.

No screenshots (wouldn't show anything).

For a more 'secure' method of generating the error message:
http://www.thehelper.net/forums/showpost.php?p=929456&postcount=30
 

Attachments

  • Anti-CheatPack v1.00.w3x
    18.1 KB · Views: 403
Reaction score
341
Really nice idea. Though hackers will find some way past it. It's only a matter of time. +rep


All they need to do is find

JASS:
This map has been modified. Please delete it and redownload from a trusted source.


and remove it
 

saw792

Is known to say things. That is all.
Reaction score
280
That's why I recommend clearing the string, depending on how discrete you want to be.
Removing that line won't do much. It will just stop the map from running at all.

People who add cheatpacks to maps don't know what they are doing 99% of the time. They just follow instructions. Obviously it is simple to circumvent if you DO know what you are doing.

Thanks for the comments.
 

saw792

Is known to say things. That is all.
Reaction score
280
It stops the current thread, which in this case will be the 'main' function. InitGlobals(), InitCustomTrigger(), and any triggers set to run on map init will thus not be executed, meaning that no GUI triggers will work. By placing the scope at the very top of the custom script section it ensures that no scopes will have their initialisers called before the initialiser of the AntiCP scope, thus they will also not be executed. Library initialisers are executed before scopes and thus will be executed regardless.
 
Reaction score
333
I'm guessing they will simply notice and disable it.. Assuming that their "cheatpack" triggers the system in the first place.
 

saw792

Is known to say things. That is all.
Reaction score
280
The idea is that the map is also protected, so they can't open it in WE and disable the trigger.

Much like map protection, this is not designed to stop the people who made the cheatpacks. As I said before, 99% of the people who put cheats into maps don't know what they are doing, and are just following explicit instructions from a web page.

And I have tested the system with a number of different cheatpacks. It certainly does trigger it.
 
Reaction score
333
The idea is that the map is also protected, so they can't open it in WE and disable the trigger.

If they have access to the map script, they shouldn't have too much trouble disabling it.

Much like map protection, this is not designed to stop the people who made the cheatpacks. As I said before, 99% of the people who put cheats into maps don't know what they are doing, and are just following explicit instructions from a web page.

I hear the 99% figure all the time, but I doubt it is valid. It's probably something closer to 60%. Even if the hacker in question is severely lacking in both intelligence and persistence, nothing will be preventing them from posting to a community website about the problems they have encountered.

And I have tested the system with a number of different cheatpacks. It certainly does trigger it.

Because the handles are created prior to the check. This can be easily circumvented by a few tweaks to the code.
 

saw792

Is known to say things. That is all.
Reaction score
280
TheDamien said:
I hear the 99% figure all the time, but I doubt it is valid. It's probably something closer to 60%. Even if the hacker in question is severely lacking in both intelligence and persistence, nothing will be preventing them from posting to a community website about the problems they have encountered.

The way I see it, any reduction in hacking instances is an improvement to me. So regardless of the exact figure, there WILL still be a reduction.

Complain all you want about how easy it is to circumvent, but if it stopped just one hacked version of my map from being played, I would add it in.
 

Strilanc

Veteran Scripter
Reaction score
42
The map you posted has a handle count of 84, so I enabled the system with that value. I tested and confirmed it worked for a naive insert-gold-trigger.

Then I actually tried.

Insert this at the top of any protected map script and re-save the map.
JASS:
library cheat initializer init
    private function gold takes nothing returns nothing
        call AdjustPlayerStateBJ(1, Player(0), PLAYER_STATE_RESOURCE_GOLD)
    endfunction
    public function init takes nothing returns nothing
        local trigger t
        call TriggerSleepAction(0.0) //gosh, let's create the trigger AFTER the check runs
        call DisplayTextToPlayer(Player(0), 0, 0, "Cheat inserted")
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), "-gold", true)
        call TriggerAddAction(t, function gold)
        set t = null
    endfunction
endlibrary


Of course an actual cheat pack insertion wouldn't need to resave the map or use vJass stuff. You would just insert an executefunc call in the init function yourself.

I highly recommend only showing a message, remove that set i=i line. No one really cares if their cheat pack triggers a message, but disable the map and they'll work around it.
 

saw792

Is known to say things. That is all.
Reaction score
280
You don't need the TriggerSleepAction in there anyway. Library initialisers run before scope initialisers in separate threads. Any code enclosed in a library would thus 'beat' the system.

I think a lot of people seem to be missing the point of this. The assumption is that you will be protecting the map as well as using this, so vJASS syntax is out then.

The cheatpacks that are available on wc3edit.net and the like all work the same way. They insert a stack of globals into the war3map.j script (most of which are initialised to a handle, I noticed when I checked them out), insert a stack of functions below the globals, and add in triggerregisters... in the main function (not ExecuteFuncs, as it were).

This is to circumvent people who follow those instructions, not for people that wrote them. Just like map protection, it is easily circumventable for those that know how. For those that don't, well they would make up the majority, thus making my system a valid detterant.
 

Strilanc

Veteran Scripter
Reaction score
42
I already said that you wouldn't actually need to resave the map. A program could open the map and modify the war3map.j file automatically.

You're not competing against morons, you're dealing with people who work together and know how to insert cheat packs into protected maps. It only takes one person to hack a map and post it to wc3edit.net.

At best someone will post a pack protected map to wc3edit.net, then a cheat pack that beats it will be released [probably within a day or less], the rest of the cheat packs update as well, and you're back to square one.
 

saw792

Is known to say things. That is all.
Reaction score
280
Strilanc said:
I already said that you wouldn't actually need to resave the map. A program could open the map and modify the war3map.j file automatically.
Then why use the example of a library, that I stated in the documentation would not be affected by the system? The only cheatpacks I am dealing with are the ones that modify war3map.j.

Uhh... no. They are not the people I am competing against at all. Obviously if this becomes widespread it is useless.

I could ask you why you put messages into Power Towers that are displayed when the map is modified. Isn't that as futile as this system?

This system would also have the effect of increasing the popularity of a map anyway. If some pathetic individual tries to insert a regular cheatpack and asks for help, then suddenly more people try to hack it and the name spreads a little.

I find your opposition to be misplaced. You seem to have a problem with the fact that this is easily bypassable if you know what you are doing. Well so is everything. What do you want me to say.

(NB: The generic cheatpacks on wc3edit.net are updated extremely rarely).

EDIT: Just saw your edit to add in only the message. I shall make that configurable, if that is what you recommend.
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
I like the way you are doing it and I've been thinking about writing my own system like this. +rep for doing my work xD

But I think that you should extend the system a bit more to cover more ways of detecting if the map is cheated.

Also, you could make so you are able to call the Init functions from other functions to prevent the hacker from just deleting your code. But I'm not sure if this would work with the way you do it and the library requirements.
 

gameman

It's been a long, long time.
Reaction score
96
But I think that you should extend the system a bit more to cover more ways of detecting hacks.

easy way of doing it is: before starting the game create a unit with "corrupted model" in the source of the players view, any body with a visibility hack will crash.
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
You know, I didn't mean another AMHS system that is easily bypassed by all public MH's out.

I meant something like detecting chat commands and then preventing their effect from happening.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
I'm sorry but MPQ editors can get past this so easily.... And I'm pretty sure that if you have a set handle count that if their map leaks... If I interpreted it right, that it would think you hack when it's leaking...
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
No it doesn't since it checks the handle amount on start up, not 5 mins into the game.

The handle count at startup should always be the same.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Good point, but doesn't preloading increase handle count?
 

saw792

Is known to say things. That is all.
Reaction score
280
The handle count at startup (not really at startup, just by the time the Init function of the system's scope is called) is different for every map. That is why you need to run the config library first to find out what the handle count SHOULD be for your individual map at the time the system's Init runs.


>MPQ editors can get through this so easily

Methods to 'beat' this system:

1. Delete the code from the map through WE (hmm... then why use the system at all if you don't mind people modifying your map)

2. (For people who know what they are doing, i.e. the minority of people that attempt to hack maps and who are not the targets of this system) If the map is protected, open it with an MPQ editor and delete the code. Oh wait, you don't even know it exists yet, since you wouldn't delete it first time. Once you found out that your cheatpack wasn't working, you would find the source of the problem and delete it.

2. (For the majority of people that just paste code into war3map.j) Wonder why cheatpack isn't working. Whinge on some forum. Be inconvenienced (and, for some/many, give up).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top