[Tutorial] Ban for Hardware ID

Page 1 of 5 12345 LastLast
Results 1 to 15 of 67
  1. #1
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    thumbs up [Tutorial] Ban for Hardware ID

    Tutorial for Hardware ID Ban by Yuri-BR


    Solution RSUpdate >
    WOLoginHelper.cpp
    Spoiler:

    Search for:
    PHP Code:
    #include "SteamHelper.h" 
    Add:
    PHP Code:
    #include "HWInfo.h" 
    Search for:
    PHP Code:
    SaveUserName(); 
    Add:
    PHP Code:
    LoadComputerToken(); 
    Search for:
    PHP Code:
    req.AddParam("password"passwd); 
    Add:
    PHP Code:
    req.AddParam("computerid"hardwareid); 
    Search for:
    PHP Code:
    bool CLoginHelper::LoadUserName()
    {
        
    // query for game registry node
        
    HKEY hKey;
        
    int hr;
        
    hr RegOpenKeyEx(HKEY_CURRENT_USER
            
    "Software\\Arktos Entertainment Group\\WarZ"
            
    0
            
    KEY_ALL_ACCESS
            &
    hKey);
        if(
    hr != ERROR_SUCCESS)
            return 
    true;

        
    DWORD size sizeof(username);
        
    hr RegQueryValueEx(hKey"username"NULLNULL, (BYTE*)username, &size);
        
    RegCloseKey(hKey);

        return 
    true;

    Add:
    PHP Code:
    bool CLoginHelper::LoadComputerToken(){
        
    HKEY hKey;
        
    int hr;
        
    hr RegOpenKeyEx(HKEY_CURRENT_USER
            
    "Software\\House of Warrior Interactive\\WarZ"
            
    0
            
    KEY_ALL_ACCESS
            &
    hKey);
        if(
    hr != ERROR_SUCCESS)
        {
            
    CreateComputerToken();
            return 
    true;
        }

        
    DWORD size sizeof(hardwareid);
        
    hr RegQueryValueEx(hKey"hardwareid"NULLNULL, (BYTE*)hardwareid, &size);
        
    RegCloseKey(hKey);

        return 
    true;
    }

    void CLoginHelper::CreateComputerToken()
    {
        
    HKEY hKey;
        
    int hr;
        
    hr RegCreateKeyEx(HKEY_CURRENT_USER
            
    "Software\\House of Warrior Interactive\\WarZ"
            
    0
            
    NULL,
            
    REG_OPTION_NON_VOLATILE
            
    KEY_ALL_ACCESS,
            
    NULL,
            &
    hKey,
            
    NULL);
        if(
    hr == ERROR_SUCCESS)
        {
            
    CHWInfo g_HardwareInfo;
            
    g_HardwareInfo.Grab();
            
    sprintf(hardwareid"0x%I64x"g_HardwareInfo.uniqueId); // Hardware ID By Yuri-BR

            
    DWORD size strlen(hardwareid) + 1;

            
    hr RegSetValueEx(hKey"hardwareid"NULLREG_SZ, (BYTE*)hardwareidsize);
            
    RegCloseKey(hKey);
        }



    WOLoginHelper.h
    Spoiler:

    Search for:
    PHP Code:
    char        passwd[128]; 
    Add:
    PHP Code:
    char        hardwareid[50]; 
    Search for:
    PHP Code:
    bool        LoadUserName(); 
    Add:
    PHP Code:
    bool        LoadComputerToken();
    void        CreateComputerToken(); 


    Solution WZBackend-ASP.NET > api_login.aspx.cs
    Spoiler:

    Search for:
    PHP Code:
    string password web.Param("password"); 
    Add:
    PHP Code:
    string computerid web.Param("computerid"); 
    Search for:
    PHP Code:
    sqcmd.Parameters.AddWithValue("@in_Password"password); 
    Add:
    PHP Code:
    sqcmd.Parameters.AddWithValue("@in_HardwareID"computerid); 


    SQL Server 2008 > Run this script in the database
    Spoiler:

    HWID_Log
    PHP Code:
    USE [WarZ]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE 
    [dbo].[HWID_Log](
    [
    id] [intIDENTITY(1,1NOT NULL,
    [
    CustomerID] [intNOT NULL,
    [
    ip] [nvarchar](50NOT NULL,
    [
    HardwareID] [nvarchar](50NOT NULL,
    [
    time] [datetimeNOT NULL,
    CONSTRAINT [PK_LoginLogPRIMARY KEY CLUSTERED 
    (
    [
    idASC
    )WITH (PAD_INDEX OFFSTATISTICS_NORECOMPUTE OFFIGNORE_DUP_KEY OFFALLOW_ROW_LOCKS ONALLOW_PAGE_LOCKS ONON [PRIMARY]
    ON [PRIMARY]
    GO 
    HWID_Ban
    PHP Code:
    USE [WarZ]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE 
    [dbo].[HWID_Ban](
    [
    HardwareID] [nvarchar](50NOT NULL,
    [
    Reason] [nvarchar](200NOT NULL,
    CONSTRAINT [PK_MacBanPRIMARY KEY CLUSTERED 
    (
    [
    HardwareIDASC
    )WITH (PAD_INDEX OFFSTATISTICS_NORECOMPUTE OFFIGNORE_DUP_KEY OFFALLOW_ROW_LOCKS ONALLOW_PAGE_LOCKS ONON [PRIMARY]
    ON [PRIMARY]
    GO 


    Navicat > WarZ > dbo > function > WZ_ACCOUNT_LOGIN
    Spoiler:

    Search for:
    PHP Code:
    @in_EMail varchar(100), 
    Add:
    PHP Code:
    @in_HardwareID varchar(50), 
    Search for:
    PHP Code:
    exec WZ_ACCOUNT_LOGIN_EXEC @in_IP
    Add:
    PHP Code:
    @in_HardwareID


    WZ_ACCOUNT_LOGIN_EXEC
    Spoiler:

    Search for:
    PHP Code:
    @in_IP varchar(100), 
    Add:
    PHP Code:
    @in_HardwareID varchar(50), 
    Search for:
    PHP Code:
    -- check if game is still active or 90sec passed from last update (COPYPASTE_GAMECHECKsearch for others)
        if(@
    GameServerId and DATEDIFF(second,    [MENTION=1333422059]LASTGAME[/MENTION]dateGETDATE()) < 90begin
            select
                0 
    as LoginResult,
                   [
    MENTION=25895]Custom[/MENTION]erID as CustomerID,
                
    70 as AccountStatus,    -- game still active code
                0 
    as SessionID,
                
    as IsDeveloper
            
    return
        
    end 
    Add:
    PHP Code:
    -- Ban por Hardware ID by Yuri-BR
        
    IF (EXISTS(SELECT FROM HWID_Ban WHERE HardwareID = @in_HardwareID)) 
        
    BEGIN
            select
                3 
    as LoginResult,
                   [
    MENTION=25895]Custom[/MENTION]erID as CustomerID,
                
    200 as AccountStatus,
                
    as SessionID,
                
    as IsDeveloper
            
    return
        
    END 
    Search for:
    PHP Code:
    INSERT INTO Logins 
            
    (CustomerIDLoginTimeIPLoginSource
        
    VALUES 
                
    [MENTION=25895]Custom[/MENTION]erIDGETDATE(), @in_IP0
    Add:
    PHP Code:
    -- Insert to HWID_Log
        
    --if @in_HardwareID != ''
        
    --begin
            INSERT INTO HWID_Log 
    (CustomerIDipHardwareIDtimeVALUES     [MENTION=25895]Custom[/MENTION]erID,@in_IP,@in_HardwareID,GETDATE())
        --
    end 


    Add message for Ban Hardware ID and Fix

    LauncherConfig.cpp
    Spoiler:

    Search for:
    PHP Code:
    accountBannedMessage r3dReadCFG_S(configFilegroup"accountBannedMessage",
            
    "Your account has been permanently banned"); 
    Add:
    PHP Code:
    accountHWBannedMessage r3dReadCFG_S(configFilegroup"accountHWBannedMessage",
            
    "Your account has been banned by HardwareID"); 


    LauncherConfig.h
    Spoiler:

    Search for:
    PHP Code:
    std::string accountBannedMessage
    Add:
    PHP Code:
    std::string accountHWBannedMessage


    In Updater.cpp
    Spoiler:

    Search for:
    PHP Code:
    case CLoginHelper::ANS_Banned:
            
    loginErrMsg_ "Your account has been permanently banned";
            
    MessageBox(NULLgLauncherConfig.accountBannedMessage.c_str(), "Login"MB_OK MB_ICONSTOP);
            break; 
    Add:
    PHP Code:
    case CLoginHelper::ANS_HWBanned:
            
    loginErrMsg_ "Your account has been banned by Hardware ID";
            
    MessageBox(NULLgLauncherConfig.accountHWBannedMessage.c_str(), "Login"MB_OK MB_ICONSTOP);
            break; 


    WOLoginHelper.cpp
    Spoiler:


    Search for:
    PHP Code:
    else if(AccountStatus == 201)
            
    loginAnswerCode ANS_Frozen
    Add:
    PHP Code:
    else if(AccountStatus == 202)
            
    loginAnswerCode ANS_HWBanned


    WOLoginHelper.h // Thanks for reminding me @DNC
    Spoiler:

    Search for:
    PHP Code:
    ANS_Banned
    Add:
    PHP Code:
    ANS_HWBanned


    Navicat > WarZ > dbo > function > WZ_ACCOUNT_LOGIN_EXEC
    Spoiler:

    Search for:
    PHP Code:
    if    [MENTION=1333383561]Accounts[/MENTION]tatus >= 200begin
            select
                3 
    as LoginResult,
                   [
    MENTION=25895]Custom[/MENTION]erID as CustomerID,
                  [
    MENTION=1333383561]Accounts[/MENTION]tatus as AccountStatus,
                
    as SessionID,
                
    as IsDeveloper
            
    return
        
    end 
    Add:
    PHP Code:
    if    [MENTION=1333383561]Accounts[/MENTION]tatus >= 202begin
            select
                3 
    as LoginResult,
                   [
    MENTION=25895]Custom[/MENTION]erID as CustomerID,
                  [
    MENTION=1333383561]Accounts[/MENTION]tatus as AccountStatus,
                
    as SessionID,
                
    as IsDeveloper
            
    return
        
    end 
    Search for:
    PHP Code:
    -- Ban por Hardware ID by Yuri-BR
        
    IF (EXISTS(SELECT FROM HWID_Ban WHERE HardwareID = @in_HardwareID)) 
        
    BEGIN
            select
                3 
    as LoginResult,
                   [
    MENTION=25895]Custom[/MENTION]erID as CustomerID,
                
    200 as AccountStatus,
                
    as SessionID,
                
    as IsDeveloper
            
    return
        
    END 
    Replace for:
    PHP Code:
    -- Ban por Hardware ID by Yuri-BR
        
    IF (EXISTS(SELECT FROM HWID_Ban WHERE HardwareID = @in_HardwareID)) 
        
    BEGIN
            update UsersData set AccountStatus
    =202 WHERE CustomerID    [MENTION=25895]Custom[/MENTION]erID
            select
                3 
    as LoginResult,
                   [
    MENTION=25895]Custom[/MENTION]erID as CustomerID,
                
    202 as AccountStatus,
                
    as SessionID,
                
    as IsDeveloper
            
    return
        
    END 


    To ban a player, you need to add the Hardware id of player in table HWID_Ban



    Credits:
    @aomsin2526 for base code
    @Yuri BR for Tutorial and alterations
    Last edited by Yuri-BR; 29-02-16 at 11:28 PM.


  2. #2
    Titan Guard Dev iTzTonyR703 is offline
    MemberRank
    Apr 2013 Join Date
    US, STL.Location
    296Posts

    Re: [Release] Ban for Hardware ID

    Now, for the replacing (I know this sounds retarded by im learning the ropes of coding again). Do I just search and replace it? Or add under that line.

  3. #3
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by iTzServer View Post
    Now, for the replacing (I know this sounds retarded by im learning the ropes of coding again). Do I just search and replace it? Or add under that line.
    in add is for you add the line

  4. #4
    Titan Guard Dev iTzTonyR703 is offline
    MemberRank
    Apr 2013 Join Date
    US, STL.Location
    296Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by Yuri BR View Post
    Sorry, I do not understand your question
    You say. "Search for" then "Add". So, Im guessing out of common sense that I just replace it? >.<

  5. #5
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by iTzServer View Post
    You say. "Search for" then "Add". So, Im guessing out of common sense that I just replace it? >.<
    add below :D

  6. #6
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,493Posts

    Re: [Release] Ban for Hardware ID

    @Yuri BR
    Nice post brother
    Yes, this is exactly what was in the code you sent me.

    <3 much appreciated and great release

  7. #7
    Member MRsrac is offline
    MemberRank
    Nov 2013 Join Date
    Da caveLocation
    82Posts

    Re: [Release] Ban for Hardware ID

    Lol, nice!
    Less work for me.

    Need some work still, can be bypassed/spoofed really easily.

  8. #8
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by MRsrac View Post
    Lol, nice!
    Less work for me.

    Need some work still, can be bypassed/spoofed really easily.
    Yes you can, but I do not care about it

    I have a new system for HWID ban not use records

    - - - Updated - - -

    but if I let the public, will be very easy to find a bypass :(
    Last edited by Yuri-BR; 24-05-14 at 01:50 PM.

  9. #9
    Account Upgraded | Title Enabled! AlexRedd is offline
    MemberRank
    Jan 2014 Join Date
    310Posts

    Re: [Release] Ban for Hardware ID

    In New Community Edition, this function is ready?




    Thanks for release!

  10. #10
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by AlexRedd View Post
    In New Community Edition, this function is ready?




    Thanks for release!
    Yes, here's the fix :D

  11. #11
    French Guy :D skyone is offline
    MemberRank
    Nov 2013 Join Date
    254Posts

    Re: [Release] Ban for Hardware ID

    What is :"HWID_Log" ?

  12. #12
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by skyone View Post
    What is :"HWID_Log" ?
    to you get the hardware id logged in account ;D

  13. #13
    French Guy :D skyone is offline
    MemberRank
    Nov 2013 Join Date
    254Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by Yuri BR View Post
    to you get the hardware id logged in account ;D
    I have nothing in this table :/

  14. #14
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,040Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by skyone View Post
    I have nothing in this table :/
    he will show the hardware id that was logged into the account every time you log into the launcher

  15. #15
    French Guy :D skyone is offline
    MemberRank
    Nov 2013 Join Date
    254Posts

    Re: [Release] Ban for Hardware ID

    Quote Originally Posted by Yuri BR View Post
    he will show the hardware id that was logged into the account every time you log into the launcher
    in "LoginLog" table i have the HWID but no in HWID_Log

    Edit : in LoginLog i have the "MAC" but no the HWID.



Page 1 of 5 12345 LastLast

Advertisement