AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Orpheu] SV_ClientConnect & Con_Printf (https://forums.alliedmods.net/showthread.php?t=188834)

Neeeeeeeeeel.- 06-30-2012 20:40

[Orpheu] SV_ClientConnect & Con_Printf
 
I have this: (Code is not mine)
PHP Code:

public OrpheuHookReturn:OnSV_ConnectClientPre( )
{
    
handlePrintf OrpheuRegisterHookOrpheuGetFunction"Con_Printf" ), "Con_Printf" OrpheuHookPre );

    return 
OrpheuIgnored;
}

public 
OrpheuHookReturn:Con_Printf( const a[ ], const message[ ] )
{
    if( 
containimessage,"^" connectedaddress ^"" ) != -)
    {
        static 
len
        len 
255;
        
        static 
str_right256 ], str_left256 ], ip256 ], Msg256 ];
        
        
formatexMsg,charsmaxMsg ),"%s"message );
        
        
splitMsgstr_leftlenstr_rightlen"^" connectedaddress ^"" );
        
strtokstr_rightiplenstr_rightlen':' );
        
        
log_amx"IP: %s"ip );
    }
    
    return 
OrpheuIgnored;


Can I get SteamID and player name where I take client IP ?

Neeeeeeeeeel.- 07-01-2012 02:48

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
When that hook it is called the player has not steamid or index so I can't get them, thanks meTaLiCroSS.

meTaLiCroSS 07-01-2012 03:13

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
I can't confirm that exactly (the index thing), wait for someone's answers.

Arkshine 07-01-2012 03:40

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
If you know the IP, you could use find_player with the IP to get the player's id, then using get_user_authid/get_user_name.

Neeeeeeeeeel.- 07-02-2012 11:18

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
Well, I tried your code but now I have other problem.
I'm trying to fix a new hlfill exploit... When I tried the first time it works, but not now... is it something wrong?

Here is full code:
PHP Code:

#include <amxmodx>
#include <orpheu>

#define PLUGIN "Anti Fake Bot"
#define VERSION "1.0"
#define AUTHOR "kanagava"

new ip_old256 ], ip_warn256 ], Msg256 ];

new 
OrpheuHook:handlePrintf

new time_last_connwarnold_timeregistered;

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
OrpheuRegisterHookOrpheuGetFunction"SV_ConnectClient" ),"OnSV_ConnectClientPre"OrpheuHookPre );
    
OrpheuRegisterHookOrpheuGetFunction"SV_ConnectClient" ),"OnSV_ConnectClientPost"OrpheuHookPost );
}

public 
OrpheuHookReturn:OnSV_ConnectClientPre( )
{
    
registered 0;
    
    if( 
get_systime( ) - old_time <= )
    {
        
handlePrintf OrpheuRegisterHookOrpheuGetFunction"Con_Printf" ), "Con_Printf" OrpheuHookPre );
        
registered 1;
    }
    
    
old_time get_systime( );
    
    return 
OrpheuIgnored;
}

public 
OrpheuHookReturn:OnSV_ConnectClientPost( )
{
    if( 
registered )
        
OrpheuUnregisterHookhandlePrintf );

    return 
OrpheuIgnored;
}

public 
OrpheuHookReturn:Con_Printf( const a[ ], const message[ ] )
{
    
registered 1;

    if( 
containimessage,"^" connectedaddress ^"" ) != -)
    {
        new 
len 255;
        new 
temp_right256 ], temp_left256 ], conn_ip256 ];
        
        
formatexMsg,charsmaxMsg ),"%s"message );
        
        
splitMsgtemp_leftlentemp_rightlen"^" connectedaddress ^"" );
        
strtoktemp_rightconn_iplentemp_rightlen':' );
        
        if( 
equalconn_ip,ip_old ) && !equalconn_ip,"" ) && ( ( get_systime( ) - time_last_conn ) < ) )
        {
            
warn warn 1;
            
            if( 
warn && equalconn_ipip_warn ) )
            {
                
/*static id;
                id = find_player( "d", ip_old );
                
                static szName[ 32 ], szSteamID[ 64 ];
                
                get_user_name( id, szName, charsmax( szName ) );
                get_user_authid( id,szSteamID, charsmax( szSteamID ) );*/
                
                
                
log_to_file"orpheu_bot_block.txt""[Fake Bot Flood] Flood stopped from: %s - Name: \
                 - SteamID:  - Tipo: "
ip_old/*, szName, szSteamID, is_user_bot( id ) ? "BOT" : "PLAYER"*/ );
                
                
server_cmd"addip 120.0 %s"ip_old );
            }
            
            
ip_warn conn_ip;
        }
        
        else
            
warn 0;
        
        
ip_old conn_ip;
        
time_last_conn get_systime( );
    }
    
    return 
OrpheuIgnored;


HTML Code:

{
    "name" : "SV_ConnectClient",
    "library" : "engine",
    "identifiers" :
    [
        {
            "os" : "windows",
            "value" : [0x55,0x8B,0xEC,0x81,"*","*","*","*","*",0x53,0x56,0x57,0xB9,0x05,0x00,0x00,0x00,0xBE,"*","*","*","*",0x8D,"*","*",0x33,0xDB,0x68,"*","*","*","*"]
        },
        {
            "os" : "linux",
            "value" : "SV_ConnectClient"
        }
    ]
}

HTML Code:

{
    "name"      : "Con_Printf",
    "library"  : "engine",
    "arguments" :
    [
        {
            "type" : "char *"
        },
        {
            "type" : "char *"
        }
    ],
    "identifiers" :
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : [0x55,0x8B,0xEC,0xB8,"*","*","*","*",0xE8,"*","*","*","*",0x8B,"*","*",0x8D,"*","*",0x50,0x51,0x8D,0x95,"*","*","*","*",0x68,"*","*","*","*",0x52,0xE8,"*","*","*","*",0x8D,0x85,"*","*","*","*",0x50]
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : "Con_Printf"
        }
    ]
}


Arkshine 07-02-2012 12:29

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
What problem you're talking about ? What exploit ?

Neeeeeeeeeel.- 07-02-2012 12:48

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
Quote:

Originally Posted by Arkshine (Post 1741278)
What problem you're talking about ? What exploit ?

It sents bots to my server and every time a bot disconnected the server gets lag, but it is not the common hlfill because I've a metamod plugin that fixs it.
I put a log on client connect & disconnect but nothing apperas, but clients console shows that '%botname% dropped'

I tried first time with that plugin and it banned the ip. But now I tried again and it is not working.

Backstabnoob 07-02-2012 15:09

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
Quote:

Originally Posted by Arkshine (Post 1740231)
If you know the IP, you could use find_player with the IP to get the player's id, then using get_user_authid/get_user_name.

Isn't it possible for the client to not be authorized yet?

mazdan 07-29-2012 12:02

Re: [Orpheu] SV_ClientConnect & Con_Printf
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1740092)
I have this: (Code is not mine)

Yes, it's my code :D
What do you want to do? May be I can help you :)
You can't use get_user_authid() - this is to early to use it.
Quote:

What problem you're talking about ? What exploit ?
Oh, this is only for non-steam servers :grrr: But may be soon it be possible to use it on steam servers.

Neeeeeeeeeel.-, This code is really bad, I would not want to have my code quoted.
Such pawn and Orpheu Guru as Arkshine will be bad when they see it :oops:

UPD: now it's not working because new flooder using proxy. But new version of noflood.amxx is working ok :)
p.s. Sorry for my bad English.


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

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