Raised This Month: $ Target: $400
 0% 

uq_jumpstats v2.42


Post New Thread Reply   
 
Thread Tools Display Modes
edgaras85
Senior Member
Join Date: Mar 2010
Location: Lithuania
Old 11-13-2010 , 16:48   Re: uq_jumpstats
Reply With Quote #51

Quote:
Originally Posted by borjomi View Post
you anti kzh check prefix of cvar? like kzh_ or vip_? if its true its sux, cause i (or some guy who have little knowledge in Hex Editor) can change prefix in few seconds like blabla_
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <celltrie>
#include <sqlx>

#define PLUGIN "Universal Anti KzHack"
#define VERSION "1.7"
#define AUTHOR "hunter"

//Credits: ConnorMcLeod
//Idea: wext

#define KZH_NUM 2

new const g_kzh_cmds[2][] = // You can to add here kzh commands
{
    
"kzh_exec",
    
"zhy_exec"
}

enum {
    
KICK 1,
    
BAN
}

enum {
    
AUTHID 1,
    
IP
}

enum {
    
AMX_BAN_AUTO,
    
AMX_BAN_OLD,
    
AMX_BAN_NEW,
    
AMX_BAN_DEFAULT
}

enum {
    
AMXBANS_NO,
    
AMXBANS_5,
    
AMXBANS_6
}


new 
p_punishtype // 1 - kick(default), 2 - ban
new p_ban_type // 1 - authid(default), 2 - ip
new p_amxban_type 
// 0 - automatic determine type of amx_ban (recomended)
// 1 - old amx_ban ( amx_ban <time_in_minutes> <nickname|steamid|IP> <reason> )
// 2 - new amx_ban ( amx_ban <nickname|steamid|IP> <time_in_minutes> <reason> )
// 3 - amxmodx amx_ban ( amx_ban <nickname|userid> <time_in_minutes> <reason>)

new p_bantime // ban time in minutes
new p_reason // reason of kick/ban
new p_notify_players // 1 - notify players, 0 - not notify

new gs_response_cmd[10]
new 
g_responsed_num[33]

new 
bool:g_kzh_checked[33][KZH_NUM]
new 
bool:g_kzh_rechecked[33]
new 
Trie:g_kzh_trie

new g_installed_amxbans AMXBANS_NO
new gp_amxbans_use_newbancmd

new g_msgSayText

new logs_path[64]
new 
kzh_logs_path[128]


new 
g_CvarHostg_CvarUserg_CvarPasswordg_CvarDBg_CvarPrefix
new Handle:g_SQL_ConnectionHandle:g_SQL_Tuple

new g_prefix[10]

enum Color
{
    
YELLOW 1
    
GREEN,
    
TEAM_COLOR,
    
GREY,
    
RED,
    
BLUE,
}

new 
TeamInfo;
new 
SayText;
new 
MaxSlots;

new 
TeamName[][] = 
{
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}



public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
p_punishtype register_cvar("kzh_punishtype""2")
    
p_ban_type register_cvar("kzh_ban_type""2")
    
p_amxban_type register_cvar("kzh_amxban_type""0")
    
p_bantime register_cvar("kzh_ban_time""10080")
    
p_reason register_cvar("kzh_reason""KzHack")
    
p_notify_players register_cvar("kzh_notify_players""1")    
    
    
g_msgSayText get_user_msgid("SayText")
    
    
// Generates command for checking the response of a player    
    
for (new 09i++)
    {
        
gs_response_cmd[i] = random_num('a''z')
    }    
        
    
// Create and Fill Trie
    
g_kzh_trie TrieCreate()
    for (new 
0KZH_NUMi++) TrieSetCell(g_kzh_trieg_kzh_cmds[i], i+1)
    
TrieSetCell(g_kzh_triegs_response_cmd0)
    
    
    if ((
g_CvarHost get_cvar_pointer("players_host")))
    {
        
g_CvarDB get_cvar_pointer("player_db")
        
g_CvarUser get_cvar_pointer("player_user")
        
g_CvarPassword get_cvar_pointer("players_password")
        
g_CvarPrefix get_cvar_pointer("player_prefix")
    }
    else
    {
        
g_CvarHost register_cvar("players_host""193.46.83.7")
        
g_CvarDB register_cvar("player_db""edgarass_drbans")
        
g_CvarUser register_cvar("player_user""edgarass_drbans")
        
g_CvarPassword register_cvar("players_password""grybas")
        
g_CvarPrefix register_cvar("player_prefix""")
    }
    
    
register_clcmd("say""cmdSay")
    
    
    
TeamInfo get_user_msgid("TeamInfo")
    
SayText get_user_msgid("SayText")
    
MaxSlots get_maxplayers()
}

public 
plugin_cfg()
{
    
// Determine type of amx_ban 
    
if ( is_plugin_loaded("AMXBans Main") != -// AMXBANS 6
    
{
        
g_installed_amxbans AMXBANS_6
        gp_amxbans_use_newbancmd 
get_cvar_pointer("amxbans_use_newbancmd")    
    }
    else if ( 
is_plugin_loaded("AMXBans") != -g_installed_amxbans AMXBANS_5    // AMXBANS 5
    
    
get_localinfo("amxx_logs"logs_path64)
    
formatex(kzh_logs_path127"%s\!!!KZHackers.txt"logs_path)
    
    
    new 
cfgdir[32]
    
get_localinfo("amxx_configsdir"cfgdircharsmax(cfgdir))
    
server_cmd("exec %s/sql.cfg"cfgdir)
    
server_exec()
    
    new 
host[32], db[32], user[32], password[32]
    
get_pcvar_string(g_CvarHosthost31)
    
get_pcvar_string(g_CvarDBdb31)
    
get_pcvar_string(g_CvarUseruser31)
    
get_pcvar_string(g_CvarPasswordpassword31)
    
    
get_pcvar_string(g_CvarPrefixg_prefix9)
    
    
g_SQL_Tuple SQL_MakeDbTuple(host,user,password,db)
    
    new 
errerror[256]
    
g_SQL_Connection SQL_Connect(g_SQL_Tupleerrerrorcharsmax(error))
    
    if(
g_SQL_Connection)
        
log_amx("Conected to db")
    else
        
log_amx("Connect error %d (%s)"errerror)
    
    
}

public 
cmdSay(id)
{
    new 
args[64]
    
read_args(args63)
    
remove_quotes(args)
    
    new 
name[32]
    
parse(argsargs63name31)
    
    if (!
equal(args"/kzh"))
        return 
PLUGIN_CONTINUE
    
    
new target
    
if ((target cmd_target(idnameCMDTARGET_ALLOW_SELF)))
    {
        
get_user_name(targetname31)
        new 
authid[35]
        
        
get_user_authid(targetauthid34)
        
        new 
quotedName[64]
        
SQL_QuoteString(g_SQL_ConnectionquotedName63name)
        new 
Handle:SQL_PrepareQuery(g_SQL_Connection
            
"SELECT `kz_hacks` FROM `%s_players` \
            WHERE `steam` = '%s' OR `name` = '%s'"
g_prefixauthidquotedName)
        
        new 
count
        SQL_Execute
(q)
        if (
SQL_NumResults(q))
            
count SQL_ReadResult(q0)
        
SQL_FreeHandle(q)
        
        
ColorChat(0GREY"^x03[Noptor-group] ^x04%s^x03 cought for ^x01%d^x03 time with ^x01kzh^x03!"
            
namecount)
    }
    else
        
ColorChat(0GREY"^x03[Noptor-group] Player ^x04%s^x03 not in the server!"
            
name)
    return 
PLUGIN_HANDLED
}

public 
client_putinserver(id)
{
    if ( 
is_user_bot(id) || is_user_hltv(id) ) return PLUGIN_CONTINUE
    
    g_kzh_rechecked
[id] = false
    set_send_tasks
(id)
    
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
remove_task(id)
}

public 
set_send_tasks(id)
{
    
// Clear variables
    
for (new 0KZH_NUMi++) g_kzh_checked[id][i] = false    
    g_responsed_num
[id] = 0    
    
    
// UDP - unreliable protocol. I did this to prevent casual punish
    
set_task(2.0"send_kzh_exec"id)
    
set_task(3.0"send_kzh_exec"id)
    
set_task(4.0"send_kzh_exec"id)    
    
    
set_task(7.0"check_and_punish"id)
}

public 
send_kzh_exec(id)
{
    for (new 
0KZH_NUMi++) client_cmd(idg_kzh_cmds[i])
    
client_cmd(idgs_response_cmd)
}

public 
check_and_punish(id)
{
    for (new 
0KZH_NUMi++)
    {
        if (!
g_kzh_checked[id][i])
        {
            if (
g_responsed_num[id] == 3// depends on number of set_task for send_kzh_exec
            
{
                new 
reason[128]
                
get_pcvar_string(p_reasonreason127)
                
                new 
username[33]
                
get_user_name(idusername32)
                
                switch ( 
get_pcvar_num(p_punishtype) )
                {
                    case 
KICK:
                    {
                        new 
userid get_user_userid(id)
                        
server_cmd("kick #%i ^"%s^""useridreason)
                        
                        if ( 
get_pcvar_num(p_notify_players) )
                            
ColorMsgToAll("^3%s ^4has been kicked for ^3%s ^4!!!"usernamereason)
                    }
                    case 
BAN:
                    {
                        new 
bantime get_pcvar_num(p_bantime)
                        
                        new 
amx_ban_type get_pcvar_num(p_amxban_type)
                        if (
amx_ban_type == AMX_BAN_AUTO)
                        {
                            switch (
g_installed_amxbans)
                            {
                                case 
AMXBANS_5:
                                {
                                    
amx_ban_type AMX_BAN_OLD                                    
                                
}
                                case 
AMXBANS_6:
                                {
                                    if ( 
get_pcvar_num(gp_amxbans_use_newbancmd) ) amx_ban_type AMX_BAN_NEW
                                    
else amx_ban_type AMX_BAN_OLD                                    
                                
}
                                default:
                                    
amx_ban_type AMX_BAN_DEFAULT
                            
}
                        }                        
                        
                        switch ( 
amx_ban_type )
                        {
                            case 
AMX_BAN_NEW:
                            {
                                switch ( 
get_pcvar_num(p_ban_type) )
                                {
                                    case 
AUTHID:
                                    {
                                        new 
authid[32]
                                        
get_user_authid(idauthid31)
                                        
server_cmd("amx_ban %s %i ^"%s^""authidbantimereason)
                                    }
                                    case 
IP:
                                    {
                                        new 
userip[16]
                                        
get_user_ip(iduserip151)
                                        
server_cmd("amx_ban %s %i ^"%s^""useripbantimereason)
                                    }
                                }
                            }
                            case 
AMX_BAN_OLD:
                            {
                                switch ( 
get_pcvar_num(p_ban_type) )
                                {
                                    case 
AUTHID:
                                    {
                                        new 
authid[32]
                                        
get_user_authid(idauthid31)
                                        
server_cmd("amx_ban %i %s ^"%s^""bantimeauthidreason)
                                    }
                                    case 
IP:
                                    {
                                        new 
userip[16]
                                        
get_user_ip(iduserip151)
                                        
server_cmd("amx_ban %i %s ^"%s^""bantimeuseripreason)
                                    }
                                }
                            }
                            case 
AMX_BAN_DEFAULT:
                            {
                                new 
userid get_user_userid(id)
                                
server_cmd("amx_ban #%i %i ^"%s^""useridbantimereason)
                            }
                        }                        
                        if ( 
get_pcvar_num(p_notify_players) )
                            
ColorMsgToAll("^3%s ^4has been banned for ^3%s ^4!!!"usernamereason)
                    }
                }
                
                
LogKZH(id)
            }
            else {
                if ( !
g_kzh_rechecked[id] ) {
                    
g_kzh_rechecked[id] = true                    
                    set_send_tasks
(id)
                } else {
                    new 
userid get_user_userid(id)
                    
server_cmd("kick #%i ^"SorryPing timeout^""userid)
                }
            }
            return
        }
    }
}

public 
client_command(id)
{
    new 
cmd[16]
    
read_argv(0cmd15)
    
    new 
value
    
if ( TrieGetCell(g_kzh_triecmdvalue) )
    {
        if (
value == 0) { // gs_response_cmd            
            
g_responsed_num[id]++
            return 
PLUGIN_HANDLED
        
} else { // kzh zhy
            
g_kzh_checked[id][value-1] = true
            
return PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
ColorMsgToAll(const sFormat[], ...)
{
    new 
sMessage[192];
    
vformat(sMessage191sFormat2);
    
    
message_begin(MSG_ALLg_msgSayText_0);
    
write_byte(1);
    
write_string(sMessage);
    
message_end();
}

public 
LogKZH(id)
{
    new 
Date[20]
    
get_time("%m/%d/%y %H:%M:%S"Date20)    
    new 
username[33]
    
get_user_name(idusername32)
    new 
userip[16]
    
get_user_ip(iduserip151)
    new 
authid[35]
    
get_user_authid(idauthid34)
    new 
main_text[128], punish_text[64], bantime    
    
    
new quotedName[64]
    
SQL_QuoteString(g_SQL_ConnectionquotedName63username)
    new 
Handle:SQL_PrepareQuery(g_SQL_Connection
        
"SELECT `id` FROM `%s_players` \
        WHERE `steam` = '%s' OR `name` = '%s'"
g_prefixauthidquotedName)
    
    
SQL_Execute(q)
    
    new 
dbId 0
    
if (SQL_NumResults(q))
        
dbId SQL_ReadResult(q0)
    
    
SQL_FreeHandle(q)
    
    if (!
dbId)
    {
        
SQL_PrepareQuery(g_SQL_Connection
            
"INSERT INTO `%s_players` (`name`, `steam`) \
                VALUES ('%s', '%s')"
g_prefixquotedNameauthid)
        
SQL_Execute(q)
        
        
dbId SQL_GetInsertId(q)
    }
    
    
SQL_QueryAndIgnore(g_SQL_Connection
        
"UPDATE `%s_players` SET `kz_hacks` = `kz_hacks` + 1 WHERE `id` = %d",
            
g_prefixdbId)
    
    switch (
get_pcvar_num(p_punishtype))
    {
        case 
KICK:
            
formatex(punish_text63"Kick")
        case 
BAN:
        {
            
bantime get_pcvar_num(p_bantime)
            if (
bantime == 0formatex(punish_text63"Permanent Ban")
            else 
formatex(punish_text63"Ban (%d minutes)"bantime)
        }            
    }    
    
formatex(main_text127"%s |%-32s|%-34s|%-15s|%s"Dateusernameauthiduserippunish_text)
    
write_file(kzh_logs_pathmain_text, -1)
}

public 
plugin_end()
{
    
TrieDestroy(g_kzh_trie)
    
    if (
g_SQL_Tuple)
        
SQL_FreeHandle(g_SQL_Tuple)
    if (
g_SQL_Connection)
        
SQL_FreeHandle(g_SQL_Connection)
}


public 
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256];

    switch(
type)
    {
        case 
YELLOW:
        {
            
message[0] = 0x01
        
}
        case 
GREEN
        {
            
message[0] = 0x04
        
}
        default:
        {
            
message[0] = 0x03
        
}
    }

    
vformat(message[1], 251msg4);

    
message[192] = '^0'

    
new teamColorChangeindexMSG_Type
    
    
if(!id)
    {
        
index FindPlayer()
        
MSG_Type MSG_ALL
    
    
} else {
        
MSG_Type MSG_ONE
        index 
id
    
}
    
    
team get_user_team(index);    
    
ColorChange ColorSelection(indexMSG_Typetype)

    
ShowColorMessage(indexMSG_Typemessage)
        
    if(
ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team])
    }
}

ShowColorMessage(idtypemessage[])
{
    
message_begin(typeSayText_id)
    
write_byte(id)        
    
write_string(message)
    
message_end()
}

Team_Info(idtypeteam[])
{
    
message_begin(typeTeamInfo_id)
    
write_byte(id)
    
write_string(team)
    
message_end()

    return 
1
}

ColorSelection(indextypeColor:Type)
{
    switch(
Type)
    {
        case 
RED:
        {
            return 
Team_Info(indextypeTeamName[1])
        }
        case 
BLUE:
        {
            return 
Team_Info(indextypeTeamName[2])
        }
        case 
GREY:
        {
            return 
Team_Info(indextypeTeamName[0])
        }
    }

    return 
0
}

FindPlayer()
{
    new 
= -1;

    while(
<= MaxSlots)
    {
        if(
is_user_connected(++i))
        {
            return 
i
        
}
    }

    return -
1

Its good or bad?
Write me in PM
__________________
edgaras85 is offline
borjomi
Senior Member
Join Date: May 2010
Location: Russia, Novosibirsk
Old 11-13-2010 , 16:49   Re: uq_jumpstats
Reply With Quote #52

its standart antikzh) and he check only prefix as i said)
borjomi is offline
Send a message via ICQ to borjomi
edgaras85
Senior Member
Join Date: Mar 2010
Location: Lithuania
Old 11-13-2010 , 16:50   Re: uq_jumpstats
Reply With Quote #53

Quote:
Originally Posted by borjomi View Post
its standart antikzh) and he check only prefix as i said)
Is there better kzh?
__________________
edgaras85 is offline
borjomi
Senior Member
Join Date: May 2010
Location: Russia, Novosibirsk
Old 11-13-2010 , 17:00   Re: uq_jumpstats
Reply With Quote #54

i know one check method, but he not stable... and plugin with this method not public, but there's a Hack Detector By Exolent, but plug doesnt have open source, so i dont know how he detect kzh) but i think he check all possible variants with 3 symbols (238329 variants)

Last edited by borjomi; 11-13-2010 at 17:11.
borjomi is offline
Send a message via ICQ to borjomi
NucL3ra
Veteran Member
Join Date: Sep 2008
Location: Bucuresti , Romania
Old 11-13-2010 , 20:33   Re: uq_jumpstats
Reply With Quote #55

I though at that too, but checking 238k commands to every player will be overwhelming for HLDS and the servers will crash very often. Also the new kzh's can change to any prefix they want, so every kzh user will use a 4 digits prefix and they can use it again.
NucL3ra is offline
Send a message via Yahoo to NucL3ra
kielor
Senior Member
Join Date: Jan 2009
Location: Russia, Novosibirsk
Old 11-14-2010 , 00:35   Re: uq_jumpstats
Reply With Quote #56

use delay like 0.1 sec between checks and no crashes possible.. but if you set it to zzz_ you will be able to play a bit more ^^
__________________
try using +karma if i helped you...
kielor is offline
Send a message via ICQ to kielor Send a message via Skype™ to kielor
edgaras85
Senior Member
Join Date: Mar 2010
Location: Lithuania
Old 11-14-2010 , 02:54   Re: uq_jumpstats
Reply With Quote #57

borjomi still errors like i posted above in lines 5xxx
__________________
edgaras85 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-14-2010 , 02:56   Re: uq_jumpstats
Reply With Quote #58

Loop a query_client_cvar shouldn't hurt, delay would be player ping.
Anyway, this is a ljstats plugin thread, such a plugin should be a standalone plugin.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
only4fun
Junior Member
Join Date: Oct 2009
Location: In your mind
Old 11-14-2010 , 07:23   Re: uq_jumpstats
Reply With Quote #59

borjomi, could you use same register in sma and in php file, m?
p.s it`s about names of tables in mysql.
__________________
Just do it
Yeah, i`m fucking Russian
only4fun is offline
Send a message via ICQ to only4fun
borjomi
Senior Member
Join Date: May 2010
Location: Russia, Novosibirsk
Old 11-14-2010 , 08:03   Re: uq_jumpstats
Reply With Quote #60

the problem is that, I actually was confused in registers in sma and php)) but i think its not big problem to change register itself if necessary, it took few minutes)
borjomi is offline
Send a message via ICQ to borjomi
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode