Antiidlebot

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
14
Реакции
1
Ошибка
L 10/16/2021 - 03:55:40: Start of error session.
L 10/16/2021 - 03:55:40: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20211016.log")
L 10/16/2021 - 03:55:40: [ReAPI] RegisterHookChain: function with id (5) doesn't exist in current API version.
L 10/16/2021 - 03:55:40: [AMXX] Displaying debug trace (plugin "antiindlebot.amxx", version "1.1.0-fm")
L 10/16/2021 - 03:55:40: [AMXX] Run time error 10: native error (native "RegisterHookChain")
L 10/16/2021 - 03:55:40: [AMXX] [0] antiindlebot.sma::init_memory (line 114)
L 10/16/2021 - 03:55:40: [AMXX] [1] antiindlebot.sma::plugin_precache (line 95)
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5271 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 24 2020 13:53:30
Built from: https://github.com/alliedmodders/amxmodx/commit/5eea3e5
Build ID: 5271:5eea3e5
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.10.0.761-dev
Build date: 14:03:01 Jul 25 2021 (2661)
Build from: https://github.com/dreamstalker/rehlds/commit/aaffe43
ReGamedll
ReGameDLL version: 5.21.0.534-dev
Build date: 18:28:48 Sep 02 2021
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/9233f85
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.92d ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5271 ini Start ANY
[ 4] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[ 5] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[ 6] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[ 7] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[ 8] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[ 9] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[10] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[11] ReAPI RUN - reapi_amxx_i386.so v5.20.0.236-dev pl3 ANY Never
11 plugins, 11 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.9.0.5271 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5271 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5271 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5271 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5271 AMXX Dev Team multilingual.am running
[ 6] Menus Front-End 1.9.0.5271 AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.9.0.5271 AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.9.0.5271 AMXX Dev Team plmenu.amxx running
[ 9] Teleport Menu 1.9.0.5271 AMXX Dev Team telemenu.amxx running
[ 10] Maps Menu 1.9.0.5271 AMXX Dev Team mapsmenu.amxx running
[ 11] Plugin Menu 1.9.0.5271 AMXX Dev Team pluginmenu.amxx running
[ 12] Admin Chat 1.9.0.5271 AMXX Dev Team adminchat.amxx running
[ 13] Anti Flood 1.9.0.5271 AMXX Dev Team antiflood.amxx running
X[ 14] Scrolling Message 1.9.0.5271 AMXX Dev Team scrollmsg.amxx running [ 15] Info. Messages 1.9.0.5271 AMXX Dev Team imessage.amxx running
[ 16] Admin Votes 1.9.0.5271 AMXX Dev Team adminvote.amxx running
[ 17] NextMap 1.9.0.5271 AMXX Dev Team nextmap.amxx running
[ 18] Nextmap Chooser 1.9.0.5271 AMXX Dev Team mapchooser.amxx running
[ 19] TimeLeft 1.9.0.5271 AMXX Dev Team timeleft.amxx running
[ 20] Pause Plugins 1.9.0.5271 AMXX Dev Team pausecfg.amxx running
[ 21] Stats Configuration 1.9.0.5271 AMXX Dev Team statscfg.amxx running
[ 22] StatsX 1.9.0.5271 AMXX Dev Team statsx.amxx running
[ 23] AntiIdleBot 1.1.0-fm mx?! antiindlebot.am debug
23 plugins, 23 running
Код:
#include <amxmodx>
#include <fakemeta>
#include <reapi>

// Automatically create config in 'configs/plugins', and execute it?
#define AUTO_CFG

// General log in 'amxmodx/logs'
new const LOG_WARNS[] = "AntiIdleBot.log"
// Debug log in 'amxmodx/logs'
new const LOG_DEBUG[] = "AntiIdleBot_Debug.log"

#define MAX_IP_LENGTH 16

enum _:CVAR_ENUM {
    Float:CVAR_F__AUTH_TIME,
    CVAR__MAX_WARNS,
    CVAR__BAN_MINUTES,
    CVAR__FORCE_WRITEIP,
    CVAR__EXEC_LISTIP_CFG,
    CVAR__DEBUG_MODE
}

enum _:CHECK_DATA_STRUCT {
    CHECK_DATA__TASKID,
    Float:CHECK_DATA_F__TIME
}

enum {
    WARN_TYPE__DELAYED,
    WARN_TYPE__RECONNECT
}

new g_eCheckData[CHECK_DATA_STRUCT]
new g_eCvar[CVAR_ENUM]
new Trie:g_tIpWarns
new Trie:g_tIpsInCheck

// thanks juice for this method
new g_net_from;

enum _:netadr_t
{
  NETADR_type = 0,
  NETADR_ip[4] = 4,
  NETADR_ipx[10],
  NETADR_port[2]
};

#define RH_ClientConnected (RH_SV_WriteFullClientUpdate + (EngineFunc: 1))

public plugin_precache() {
    register_plugin("AntiIdleBot", "1.1.0-fm", "mx?!") // just code. antibot method by Ragamafona

    bind_pcvar_float( create_cvar( "aib_auth_time", "3.0",
        .description = "Time to auth client (do not change it if you don't exactly know what you are doing!)"),
        g_eCvar[CVAR_F__AUTH_TIME]
    );

    bind_pcvar_num( create_cvar( "aib_max_warns", "3",
        .description = "Max warns per IP to ban it (warns resets every mapchange)",
        .has_min = true, .min_val = 1.0 ),
        g_eCvar[CVAR__MAX_WARNS]
    );

    bind_pcvar_num( create_cvar( "aib_ban_minutes", "120",
        .description = "Ban time in minutes (0 = permanent)",
        .has_min = true, .min_val = 0.0 ),
        g_eCvar[CVAR__BAN_MINUTES]
    );

    bind_pcvar_num( create_cvar( "aib_force_writeip", "1",
        .description = "Force 'writeip' command to store permanent bans to listip.cfg?" ),
        g_eCvar[CVAR__FORCE_WRITEIP]
    );

    bind_pcvar_num( create_cvar( "aib_exec_listip_cfg", "0",
        .description = "Execute listip.cfg to restore permanent bans after restarting the server?" ),
        g_eCvar[CVAR__EXEC_LISTIP_CFG]
    );

    bind_pcvar_num( create_cvar( "aib_debug_mode", "0",
        .description = "Enable debug mode to test plugin or solve problems?" ),
        g_eCvar[CVAR__DEBUG_MODE] );

#if defined AUTO_CFG
    AutoExecConfig()
#endif

    set_task(5.0, "task_Init")

    g_tIpWarns = TrieCreate()
    g_tIpsInCheck = TrieCreate()

    init_memory();
}

init_memory() {
    new GameConfig:gameConfig = LoadGameConfigFile("net_from");

    if (!gameConfig) {
        set_fail_state("gameConfig error");
    }

    new address = GameConfGetAddress(gameConfig, "net_from");
    CloseGameConfigFile(gameConfig);

    if (!address) {
        set_fail_state("address error");
    }

    g_net_from = is_linux_server() ? address : get_tr2(address, TR_AllSolid);

    RegisterHookChain(RH_ClientConnected, "RH_ClientConnected_Pre");
}

public task_Init() {
    if(g_eCvar[CVAR__EXEC_LISTIP_CFG]) {
        server_cmd("exec listip.cfg")
    }
}

public RH_ClientConnected_Pre() {
    new address = get_tr2(g_net_from + NETADR_ip, TR_AllSolid);

    new szIP[MAX_IP_LENGTH]

    formatex( szIP, charsmax(szIP), "%d.%d.%d.%d", address & 0xFF,
        (address >>> 8) & 0xFF,    (address >>> 16) & 0xFF, (address >>> 24) & 0xFF );

    if(TrieGetArray(g_tIpsInCheck, szIP, g_eCheckData, sizeof(g_eCheckData))) { // reconnect while ip is still checking
        if(g_eCvar[CVAR__DEBUG_MODE]) {
            log_to_file( LOG_DEBUG, "[AIB DEBUG] RH_ClientConnected_Pre(): reconnect %s (old taskid: %i)",
                szIP, g_eCheckData[CHECK_DATA__TASKID] );
        }

        remove_task(g_eCheckData[CHECK_DATA__TASKID])

        if(func_WarnIP(szIP, g_eCheckData, WARN_TYPE__RECONNECT)) { // force delayed warn
            return // ip banned, stop here
        }
    }

    new iTaskID

    do {
        iTaskID = random_num(0, 99999)
    }
    while(task_exists(iTaskID))

    if(g_eCvar[CVAR__DEBUG_MODE]) {
        log_to_file(LOG_DEBUG, "[AIB DEBUG] RH_ClientConnected_Pre(): %s (taskid: %i)", szIP, iTaskID)
    }

    g_eCheckData[CHECK_DATA__TASKID] = iTaskID
    g_eCheckData[CHECK_DATA_F__TIME] = get_gametime()

    TrieSetArray(g_tIpsInCheck, szIP, g_eCheckData, sizeof(g_eCheckData))

    if(g_eCvar[CVAR__DEBUG_MODE] && g_eCvar[CVAR_F__AUTH_TIME] < 0.1) { // emulate detection by normal client ;)
        task_WarnIP(szIP)
        return
    }

    set_task(floatmax(0.1, g_eCvar[CVAR_F__AUTH_TIME]), "task_WarnIP", iTaskID, szIP, sizeof(szIP))
}

public client_connect(pPlayer) {
    new szIP[MAX_IP_WITH_PORT_LENGTH]
    get_user_ip(pPlayer, szIP, charsmax(szIP), .without_port = 1)

    if(!TrieGetArray(g_tIpsInCheck, szIP, g_eCheckData, sizeof(g_eCheckData))) {
        if(g_eCvar[CVAR__DEBUG_MODE]) {
            log_to_file(LOG_DEBUG, "[AIB DEBUG] client_connect(): %s (warned? taskid not found!)", szIP)
        }

        return
    }

    TrieDeleteKey(g_tIpsInCheck, szIP)
    remove_task(g_eCheckData[CHECK_DATA__TASKID])

    if(g_eCvar[CVAR__DEBUG_MODE]) {
        log_to_file(LOG_DEBUG, "[AIB DEBUG] client_connect(): %s (taskid: %i, elapsed %f)",
            szIP, g_eCheckData[CHECK_DATA__TASKID], get_gametime() - g_eCheckData[CHECK_DATA_F__TIME] );
    }
}

public task_WarnIP(const szIP[]) {
    if(!TrieGetArray(g_tIpsInCheck, szIP, g_eCheckData, sizeof(g_eCheckData))) {
        abort(AMX_ERR_GENERAL, "[Error] %s not found in trie!", szIP)
        return
    }

    func_WarnIP(szIP, g_eCheckData, WARN_TYPE__DELAYED)
}

bool:func_WarnIP(const szIP[], const eCheckData[CHECK_DATA_STRUCT], iWarnType) {
    TrieDeleteKey(g_tIpsInCheck, szIP)

    new iWarnCount
    TrieGetCell(g_tIpWarns, szIP, iWarnCount)
    iWarnCount++
    TrieSetCell(g_tIpWarns, szIP, iWarnCount)

    log_to_file(LOG_WARNS, "[AIB] %i/%i %s warn for %s (taskid: %i, elapsed %f)",
        iWarnCount, g_eCvar[CVAR__MAX_WARNS], (iWarnType == WARN_TYPE__DELAYED) ? "delayed" : "reconnect",
        szIP, eCheckData[CHECK_DATA__TASKID], get_gametime() - eCheckData[CHECK_DATA_F__TIME]
    );

    if(g_eCvar[CVAR__DEBUG_MODE]) {
        log_to_file(LOG_DEBUG, "[AIB DEBUG] %i/%i %s warn for %s (taskid: %i, elapsed %f)",
            iWarnCount, g_eCvar[CVAR__MAX_WARNS], (iWarnType == WARN_TYPE__DELAYED) ? "delayed" : "reconnect",
            szIP, eCheckData[CHECK_DATA__TASKID], get_gametime() - eCheckData[CHECK_DATA_F__TIME]
        );
    }

    if(iWarnCount >= g_eCvar[CVAR__MAX_WARNS]) {
        server_cmd("addip %i %s", g_eCvar[CVAR__BAN_MINUTES], szIP)

        if(!g_eCvar[CVAR__BAN_MINUTES] && g_eCvar[CVAR__FORCE_WRITEIP]) {
            server_cmd("writeip")
        }

        log_to_file(LOG_WARNS, "[AIB] %s banned for %i minute(s)", szIP, g_eCvar[CVAR__BAN_MINUTES])

        if(g_eCvar[CVAR__DEBUG_MODE]) {
            log_to_file(LOG_DEBUG, "[AIB DEBUG] %s banned for %i minute(s)", szIP, g_eCvar[CVAR__BAN_MINUTES])
        }

        return true
    }

    return false
}
 
В этой теме было размещено решение! Перейти к решению.

d3m37r4

111111
Сообщения
1,451
Реакции
1,177
Помог
10 раз(а)
elit59, переведи ошибку. Вернись в тему с плагином, перечитай ее и ты поймешь, что ты сделал не так.
 
  • Нравится
Реакции: Ayk
Сообщения
1,293
Реакции
2,293
Помог
57 раз(а)
elit59, реапи надо поставить с проброшенным ClientConnected, там же написано
 
  • Нравится
Реакции: Ayk
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу