Защита AI Guard for PTS-based servers

kick

Магистр Йода
Administrator
#1
AI Guard description
  • AIGuard allow script-developers make the NPC AI for specified game server only.
  • AI encryption use the hardware key of specified game server
  • AI cannot be decrypted on different hardware
AIGuard Decryptor installation
  • Copy AIGuardDec.dll to L2NPC directory
  • Copy AIGuard.ini to AdvExt64 Configurations directory (for AdvExt64 project) or NExtDev64 Configurations directory (for NExtDev64 project) or L2NPC directory (for C4/GF-PTS)
  • If you use different (nor AdvExt64 and NextDev64) PTS-solutions:
  • Copy ExpandImport.exe into directory with original L2NPC.exe
  • Copy AIGuardLoader_C4.dll or AIGuardLoader_GF.dll into directory with original L2NPC.exe
  • For C4-PTS run "ExpandImport.exe -e L2NPC.exe -d AIGuardLoader_C4.dll -f Dummy"
  • For GF-PTS run "ExpandImport.exe -e L2NPC.exe -d AIGuardLoader_GF.dll -f Dummy"
AIGuard Encryptor installation
- run "AIGuardEnc.exe -?" for help
Код:
Usage: AIGuardEnc.exe option:
-i <input file name> (default value "ai.obj")-o <output file name> (default value "ai.obj.enc")
        -e - enable handler encryption
        -z - enable optimization
        -c<c4|gf> - chronicle: c4(c4-pts based AI),gf(gf-pts based AI)
Код:
- AIGuardEnc.exe write errors and messages into directory log
- On first start AIGuardEnc.exe (except Demo version) create the file AIGuard.hwid. This file should be used for acquiring the Full License AIGuard.key. Place the AIGuard.key near the AIGuardEnc.exe.
- AIGuardEnc.exe use License.hwid (game-server HWID) from current directory for AI encryption.
- License.hwid can be acquired from game server administrator/owner (AIGuardDec.dll generate the file AIGuard.hwid, that can be renamed to License.hwid and send to script-developer)
- Encrypted AI.obj can be decrypted only by the game-server with specified License.hwid
- Encrypted Event handlers looks like this:
encrypted_handler 3 56
variable_begin
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end


kEWAoXpOEPx96bnRjOjJ+OaAOIFwCbv7vW7suWr8OLPKmhXFBTGPqYmrQWqwd62Z7lc3Nf0R
5x+fiy5/YtoBbMZ7wQ4zJ9W8BbDN8suLUuCpX2XsW6potbowv1i4gzyECu91OJ/PIJNng6T6
hmiitTMa6avd3WVHp5iEbCSACF0EI1RVlWuF4wbwpKdtov4sd1C6huffCiSCwsybJgdXl48i
iUKXpPi0zp/3iVTwqZvfaDqoM/vsoBVOax0pxP9I2Mi4OuG12yexV3OQKN9wTch8YjDsd7E9
orYMh5vJ2vQ/n87SpOpBQ//BM7t4rttrKk65E10Gh4gCwsw+F29IL9EAXcPxbkEQzsTe1Eg7
XRR4p65cJkxeYQjl8y0yYZtfnrqRP+BR
encrypted_handler_end
AIGuard Encryptor Demo version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AIGuard Encryptor Demo version have not restrictions for optimization
AIGuard Encryptor Demo version have restrictions for encryption:
- only TALKED Event handler can be encrypted
- only handlers with less than 300 operations can be encrypted
- only handlers without "call_super" can be encrypted


Using of AIGuard Decryptor is free. Just load AIGuardDec.dll and initialize properly.


AIGuardAPI.h
Код:
#pragma once


class CScriptTypeInfo;
class CScriptEventTypeInfo;
class CReloadableNPCEventHandler;


namespace AIGuard
{
    /*
        LoadNPCAI() should be called in case when CNPCAIManager::LoadNPCAI() was re-implemented
    */
    typedef bool (*tLoadNPCAI)(void);


    /*
        FindClass() should be called in case when CNPC::SetAI() & CNpcMakerEx::SetAI() was re-implemented
    */
    typedef CReloadableNPCEventHandler* (*tFindClass)(int nClassTypeId, const wchar_t* pwsClassName);


    /*
        OnAILoaded() is required and should be implemented!!!. You should create NPCs here (Tutorial_quest_npc, Dominion_quest_npc, ...)
        Example:
            g_pTutorial_quest_npc = new CNPC();
            g_pTutorial_quest_npc->Set(0,0);
            g_pTutorial_quest_npc->SetAI(L"tutorial_quest_npc");
    */
    typedef void (*tOnAILoaded)(void);


    /*
        GetTypeInfo() & GetEventTypeInfo() are required and should be implemented!!!
        This functions used by AIGuard to access AI-types information
    */
    typedef CScriptTypeInfo** (*tGetTypeInfo)(int nTypeId);
    typedef CScriptEventTypeInfo** (*tGetEventTypeInfo)(int nEventTypeId);


    /*
        AIGuardInit() should be called before NPCServer::Start()
    */
    typedef struct _InitData
    {
        _InitData()
            : m_nAIGuardRevision(0)
            , m_lpfLoadNPCAI(NULL)
            , m_lpfFindClass(NULL)
            , m_lpfOnAILoaded(NULL)
            , m_lpfGetTypeInfo(NULL)
            , m_lpfGetEventTypeInfo(NULL)
            , m_pszRevision_SharedFactory(NULL)
            , m_pszRevision_NpcH(NULL)
            , m_pszRevision_NASC(NULL)
            , m_pszRevision_NpcEvent(NULL)
        {}


        /*out*/    int m_nAIGuardRevision;
        /*out*/    tLoadNPCAI m_lpfLoadNPCAI;
        /*out*/    tFindClass m_lpfFindClass;
        /*in*/    tOnAILoaded m_lpfOnAILoaded;
        /*in*/    tGetTypeInfo m_lpfGetTypeInfo;
        /*in*/    tGetEventTypeInfo m_lpfGetEventTypeInfo;
        /*in*/    const char* m_pszRevision_SharedFactory;
        /*in*/    const char* m_pszRevision_NpcH;
        /*in*/    const char* m_pszRevision_NASC;
        /*in*/    const char* m_pszRevision_NpcEvent;
    } InitData;
    typedef BOOL (*tAIGuardInit)(InitData& initData);


}// namespace AIGuard


extern "C" BOOL AIGuardInit(AIGuard::InitData& initData);
 
Сверху Снизу