Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Anti-Cheat Toolkit: stop cheaters easily!

Discussion in 'Assets and Asset Store' started by codestage, Aug 20, 2013.

  1. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey everyone, 1.6.4 update is now available at the Asset Store!

    First of all, I'd like to say thank you to all my customers and to everyone who write reviews, send bug reports and leave any other feedback, I'm so glad to have so much customers and help them on the daily basis.

    This Anti-Cheat Toolkit update celebrates 5 years of free updates with new features and fixes!
    I'm very proud of how my work helps other developers and how ACTk evolved since its first release in far 2013.

    It was an exciting 5 years and I'm not going to stop here, there are lots of new features and improvements ahead and I'll be glad to keep working on ACTk.

    And to make it possible, I'm thinking about introducing paid upgrade to the ACTk in some near future, with one of the next updates, with some increase in the price. Existing customers will be able to get the upgrade with a big price cut.

    It will allow me to keep making free updates for few more years and spend more time on the plugin development.

    Now, back to the current update. Here are the most important highlights:
    • Package Manager integration preparation started, files and folders refactoring introduced
    • TimeCheatingDetector got new core, compatible with WebGL and UWP .NET (some API breaking changes were made), now it able to detect both wrong time and actual time cheating (still requires Internet connection though)
    • all obscured types got the static FromEncrypted() method for easier initialization:
    Code (CSharp):
    1. // old way
    2. ObscuredInt oldObscured = 0;
    3. oldObscured.SetEncrypted(encrypted);
    4.  
    5. // new way
    6. var newObscured = ObscuredInt.FromEncrypted(encrypted);
    • lots of other improvements and fixes across different parts and features (see full change log for details)
    - celebrating 5 years of free updates! \o/
    - file names and structure refactored - please remove previous version completely!
    - TimeCheatingDetector got more attention again (breaks existing APIs):
    * core rewritten and now works with WebGL and UWP .NET (thank you Vincent!)
    * logic to exclude false positives when user just has wrong time
    * now detects both wrong time and actual time cheating with separate thresholds
    * few old events deprecated in favor of new more generic CheatChecked event
    * fixed possible Sockets errors
    * fixed incorrect check interval calculation after resuming unity player​
    - add static method FromEncrypted() to all obscured variable types
    - added new detectors prefab with another layout (each detector on separate object)
    - improved UI of settings window
    - added few new conditional symbols options for better debug and compatibility
    - updated InjectionDetector whitelist to match Unity 2018.3.0b2
    - detectors inspector UI updated to make it easier to read settings
    - fixed obscured values initialization in inspector was inconsistent in some cases
    - fixed warnings when KeepAlive detectors were started from nested objects
    - readme got list of contents with hyperlinks for quicker navigation
    - some legacy redundant code removed
    - other minor fixes and improvements
     
  2. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    SweatyChair and hopeful like this.
  3. SweatyChair

    SweatyChair

    Joined:
    Feb 15, 2016
    Posts:
    140
    Just a very minor bug in example scene:
    ActTesterGui.cs not match the class name "ExamplesGUI", making it not working in the scene.

    And it's 1000 lines and pretty hard to read and understand, I suggest to split in into parts.

    Or, simply split the example into 3 examples...
     
    codestage and AthrunVLokiz like this.
  4. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Thank you, @SweatyChair

    I appreciate reporting this issue.
    But it looks like you just have something cached or didn't remove previous version before importing a new one.
    File name should be correct in the currently released version:
    upload_2018-10-25_10-55-48.png

    Also thanks for your suggestion on splitting up an example code.
    You're totally right here and it will be done in nearest updates!
     
  5. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    New tiny update is already live at the store!

    This time InjectionDetector got some fixes and improvements, also example code was updated and refactored to make it easier to read and inspect ^^

    - ObscuredPrefs actions refactored to events to properly allow multiple listeners
    - example code refactored and updated
    - add support for dynamic assemblies to InjectionDetector (thx Michal)
    - fix InjectionDetector whitelist had no some .NET Core assemblies (thx Michal)
    - fix InjectionDetector crash when user whitelist has incorrect chars (thx Michal)
     
  6. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    903
    Broken in il2cpp builds :(

    (Windows standalone x64, il2cpp, .NET 4.x, Unity 2018.2)

    upload_2018-11-4_21-43-47.png
     
  7. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey, @i42-Xblade

    No worries, this is totally fine, IL2CPP builds can't have injections, so detector is automatically disabled there.
     
    MrLucid72 likes this.
  8. auroxi

    auroxi

    Joined:
    Dec 31, 2012
    Posts:
    85
    Hi Dmitriy,

    I used to use the TimeCheatingDetector.GetOnlineTime("pool.ntp.org") but that has now been deprecated.

    Could you provide a simple example to achieve that with the new TimeCheatingDetector.GetOnlineTimeCoroutine() ?

    Thanks :)
     
  9. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey, @auroxi

    That API was sync and could freeze your main thread so it was deprecated in favor of new async APIs:
    IEnumerator GetOnlineTimeCoroutine()
    and
    Task<OnlineTimeResult> GetOnlineTimeTask()
    (for new .NET)

    Here is how you can use them:

    Code (CSharp):
    1.  
    2. // Coroutine version for old .NET 3.5 or WebGL (which does not support real threads so far)
    3. private void Start()
    4. {
    5.     StartCoroutine(TimeCheatingDetector.GetOnlineTimeCoroutine("http://google.com", OnOnlineTime));
    6. }
    7.  
    8. private void OnOnlineTime(TimeCheatingDetector.OnlineTimeResult result)
    9. {
    10.     if (result.success)
    11.     {
    12.         Debug.Log(result.onlineSecondsUtc);
    13.     }
    14. }
    15.  
    16. // Task version for new .NET 4.x
    17. private async void Start()
    18. {
    19.     var result = await TimeCheatingDetector.GetOnlineTimeTask("http://google.com");
    20.     if (result.success)
    21.     {
    22.         Debug.Log(result.onlineSecondsUtc);
    23.     }
    24. }
    25.  
     
  10. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    903
    Whoa... that's pretty cool.
     
  11. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Hey Dmitriy, thanks for the wonderful asset. I got it specifically for the time cheat feature - which works really nicely in the editor but I'm seeing errors only on Android devices:

    Code (CSharp):
    1.  E  [20286] Unity    java.io.EOFException
    2. E  [20286] Unity
    3. E  [20286] Unity    (Filename: /Users/builduser/buildslave/unity/build/Platforms/Android/Modules/UnityWebRequest/Transports/TransportAndroid.cpp Line: 433)
    4. E  [20286] Unity
    5. I  [20286] Unity    [ACTk] Time Cheating Detector: Online Time Retrieve error:
    6. I  [20286] Unity    Error response code: 0
    7. I  [20286] Unity    Error: Unknown Error
    8. I  [20286] Unity    UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    9. I  [20286] Unity    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    10. I  [20286] Unity    UnityEngine.Logger:Log(LogType, Object)
    11. I  [20286] Unity    UnityEngine.Debug:Log(Object)
    12. I  [20286] Unity    CodeStage.AntiCheat.Detectors.TimeCheatingDetector:FillRequestResult(UnityWebRequest, OnlineTimeResult&) (at C:\Users\colinmacleod\Work\Assets\Plugins\CodeStage\AntiCheatToolkit\Runtime\Scripts\Detectors\TimeCheatingDetector.cs:701)
    13. I  [20286] Unity    CodeStage.AntiCheat.Detectors.<GetOnlineTimeCoroutine>c__Iterator1:MoveNext() (at C:\Users\colinmacleod\Work\Assets\Plugins\CodeStage\AntiCheatToolkit\Runtime\Scripts\Detectors\TimeCheatingDetector.cs:540)
    14. I  [20286] Unity    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    I'm using Unity 2018.2.4f1 and the latest version of Anti Cheat Toolkit, 1.6.5
     
  12. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
  13. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey @copycat-LOL

    Thank you for reporting this issue. Seems to look like a Unity bug.

    chunkedTransfer will not help here since it affects requests which send data to server (e.g. POST), but detector does not send any data to server.

    Could you please provide a bit more information on your case?
    - did you tried to change the host or request method in detector settings?
    - are you building to the Android Mono or IL2CPP?
    - did you tried to switch between Mono\IL2CPP?
    - did you tried to reproduce it on latest 2018.2.16 version?

    Thanks!
     
    Last edited: Nov 16, 2018
  14. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    I tired changing the host to http://www.google.com (was https:// that also failed on Android) - I can try another one shortly.
    We using mono and are in the final stages of testing so I probably won't be able to change build method to IL2CPP for this project, but I can see if that works and whether it might be an option.
     
    codestage likes this.
  15. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Thanks, @copycat-LOL

    Your feedback helps a lot, knowing if it fails on other hosts and in IL2CPP would help a lot too.
     
  16. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Issue appears to be exactly the same on Unity 2018.2.16.
    Trying IL2CPP now
    Also, I changed the webserver to one I own but that made no difference
     
    codestage likes this.
  17. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Thanks, one more question popped up - what Android version you have on your target device?
     
  18. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    4.4.2
     
    codestage likes this.
  19. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    @copycat-LOL oh, that's pretty rare nowadays to meet a device with such Android version.

    I've just tried to reproduce the issue in Unity 2018.2.16 and Unity 2018.2.0 on 3 Android devices, with Android 6.0.1, Android 8 and Android 9 - no success in all cases, still working without this exception =\

    I have no real device with 4.4.2 version, but I'm going to setup virtual device with this version and try reproducing it there.
     
  20. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Sure - OK. It's just my test device (I'm an iOS guy)
     
  21. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    @copycat-LOL

    Meh, it does not reproduces on the virtual device with Android 4.4 either =(

    upload_2018-11-16_16-16-9.png

    upload_2018-11-16_16-16-57.png

    I'm afraid it even can't be properly reported to Unity at this point, since I have no proper reproduction steps and can't reproduce it so far myself =\

    Does it reproduces for you even in new empty project?
     
  22. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    > Does it reproduces for you even in new empty project?

    Not sure. I'll try to make a small test case but it will be later on
     
    codestage likes this.
  23. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Thanks for all your help - and responding so quickly!
     
  24. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    @copycat-LOL thanks for all information about this case, hope I'll manage to catch it and all the data you provided will help to fix / workaround it or make a better bug report to Unity.
     
  25. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Right - it seems to be device-specific.

    A colleague built our main app on some more recent devices and didn't have those issues.
    I created a blank project just now and deployed app to my Samsung Galaxy Tab4 (running 4.4.2).

    All the app had was a single button that invokes

    Code (CSharp):
    1. TimeCheatingDetector.Instance.ForceCheck();
    Same error as before. Using SSL, I get:

    Code (CSharp):
    1. I  [10588] Unity    [ACTk] Time Cheating Detector: Online Time Retrieve error:
    2. I  [10588] Unity    Error response code: 0
    3. I  [10588] Unity    Error: Unable to complete SSL connection
    4. I  [10588] Unity
    5. I  [10588] Unity    (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    6.  
    without SSL, same as before:

    Code (CSharp):
    1. E  [11250] Unity    java.io.EOFException
    2. E  [11250] Unity
    3. E  [11250] Unity    (Filename:  Line: 432)
    4. E  [11250] Unity
    5. I  [11250] Unity    [ACTk] Time Cheating Detector: Online Time Retrieve error:
    6. I  [11250] Unity    Error response code: 0
    7. I  [11250] Unity    Error: Unknown Error
    8. I  [11250] Unity
    9. I  [11250] Unity    (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    10.  
    I can share the sample project with you and my logcat output if you like. PM me your email address and I'll send it to you
     
    codestage likes this.
  26. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Thank you, Colin, I can't start a PM conversation with you for some reason (perhaps you do not allow PMs from unknown persons here). But I sent you a message using contact form on your website.

    I'm going to submit a bugreport to Unity with all that information and logs you kindly provide.

    Also I'm glad you confirm it does works on other devices for you.
     
    Colin_MacLeod likes this.
  27. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Thanks for that! Sent you a reply just now.
     
    codestage likes this.
  28. xuanhr

    xuanhr

    Joined:
    Mar 24, 2017
    Posts:
    3
    Hey Dmitriy, i want use DefaultValue Attribute to set the property value.
    I need to ignore them in Newtonsoft deserialize,what should I do?
     
  29. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey @UDN_6d321f3a-da12-4a7c-8015-bcf01c80b57c

    Not sure I got your question correctly =\
    Are you have any trouble using DefaultValue attribute for obscured types?

    Did you tried implementing converters for obscured types (here is an example)?
     
  30. xuanhr

    xuanhr

    Joined:
    Mar 24, 2017
    Posts:
    3
    Thank u reply.
    Sample code like this:
    Code (CSharp):
    1.         [DefaultValue(0)]
    2.         [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
    3.         public ObscuredInt hp;
    If the obscured types is the default .
    I want to ignore them when writing JSON files.
    But they don't work.
     
  31. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Thanks for additional details!
    DefaultValue attribute is not supported at this moment. Please use default value initializers instead (i.e. public ObscuredInt hp = 10).

    Also to implement desired behaviour I'd suggest implementing ISerializable and just make a manual check for default value before returning data from ISerializable.GetObjectData()
     
  32. xuanhr

    xuanhr

    Joined:
    Mar 24, 2017
    Posts:
    3
    Thank you Dmitriy,this class is inher from a base class ,and some class inherits from this class.
    Another this class data is so long, use ISerializable is too verbose.
    Maybe I created some new classes designed to save. I use ObscuredTypes in memory and save the new class to the json file.
    Thanks for all your help~ :)
     
    codestage likes this.
  33. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    37
    we're having an emergency problem with time cheat detector. we wrote a support message through the website, can you return back?
     
  34. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    @hard_rocker hey, jost got a notification email from forum.
    Please check your email inbox, a reply was sent to you 46 minutes ago, should be on your end already.
    Also please let me know if you didn't receive a reply.
     
  35. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    37
  36. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    @hard_rocker oh, I'm sorry, that's really strange =\
    Just sent you a PM here.
     
  37. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    37
    I encountered the same problem and getting the same errors, I'm using Unity 5.6.6f2 and tested with Samsung Galaxy Tab3 (running 4.2.2). I think it's not about unity, new update (actk) does not work in any of the older version androids.
     
  38. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey,

    Thanks for reporting this as well!
    This is pretty sad, and it's exactly about Unity, unfortunately, since new ACTk version uses UnityWebRequest instead of Mono sockets to cover more platforms (sockets didn't work in WebGL and in UWP) but looks like UnityWebRequest implementation has some problems with old Android versions.

    This bug was reported a while ago, but did not get any reply from QA so far.
    I'll add your report to the Issue I reported earlier to Unity.

    Also, please try changing request method from HEAD to GET at the detector settings, just in case this problem happens only with HEAD requests.
     
  39. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    37
    Thank you, the problem has gone when i changed request method to Get
     
    codestage and Colin_MacLeod like this.
  40. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    This is very good to know, @hard_rocker, thank you.
    I will make an additional note to the bug report, hopefully it will help Unity QA to pinpoint the problem.
    Also, I'm adding new note to the Readme's Troubleshooting section about this bug for the future reference.
     
  41. hugopok

    hugopok

    Joined:
    Mar 30, 2016
    Posts:
    46
    Hi,

    i am here because i want to buy this plugin for my multiplayer game, but i want to know if it support console, especially nintendo switch, i know that works great on standalone builds

    Thank you for your time
     
  42. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey, @hugopok

    It should work there just fine, but I had no chance yet to completely test it on that platform to be sure for 100%

    Just let me know if you'll have any issues and I'll try to help as much as I can.
     
  43. hugopok

    hugopok

    Joined:
    Mar 30, 2016
    Posts:
    46
    Thanks for your fast reply,

    Ok i will be happy to help you to improve your plugin
     
    codestage likes this.
  44. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    @hard_rocker @Colin_MacLeod

    Good news, Unity QA (mr. Tomas K.) confirmed reproduction of the "Error response code: 0" bug:

    We have been able to reproduce this bug and have sent it for resolution with our developers.
    Hopefully it will be fixed in future Unity versions.
    Thanks for your help in catching this bug!
     
  45. RetroStyleGames

    RetroStyleGames

    Joined:
    Oct 7, 2015
    Posts:
    12
    Hey, any ideas why that can happen to Unity's UI after Anti-cheat usage?
     

    Attached Files:

  46. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey @RetroStyleGames

    Please take a look at your email inbox, I've sent a reply to your support request.
     
  47. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    hi trying to migrate from 1.5.4 to 1.6.5

    before migrate vector3 values are 0 2 2

    after plugin update 1.954518e-38 6.650879 6.650879

    after migrate tools-> migrate they are 0 6.650879 6.650879

    btw floats/integers not need migrate? because they didn't change after update

    ps. why upgrate is needed is there security issue with 1.5.4?

    using unity 2018.2.16f1

    log:[ACTk] Migrated obscured types on 8 objects in opened scene(s).
     
    Last edited: Nov 28, 2018
    codestage likes this.
  48. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Hey @friuns3

    Thank you for reporting this issue.
    I've sent you a PM with possible fix to try out.
     
    friuns3 likes this.
  49. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    Hi thanks your fix did work! but i have still 2 questions remaining :)

     

    Attached Files:

  50. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,914
    Ah, sorry, missed your questions somehow.

    Only obscured floats, doubles and obscured Unity types based on them (like ObscuredVector3) are need to be migrated when updating from ACTk prior to 1.6.0.
    Floats are auto-migrating when you look at them in inspector (might be not obvious and not my best decision to do this actually).

    Yes, obscured float / double vulnerability was fixed in 1.6.0 which could be used to compromise obscured values in memory in rare cases. ObscuredCheatingDetector still would be able to detect cheating though so it's not a something disastrous.
     
    friuns3 likes this.