AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: Fake Server Queries (https://forums.alliedmods.net/showthread.php?t=244450)

Shooting King 07-18-2014 11:22

Module: Fake Server Queries
 
7 Attachment(s)
Fake Server Queries v1.1 - 1/1/2017


In brief, This module gives you the ability to change Server Query fields. Thereby providing modified information to the client about the server. This module currently supports only some A2S_INFO Fields namely,
  • Server Name
  • Map Name
  • Game Name
  • Players (Online)
  • MaxPlayers
  • Bots

Others can be added on request.

Natives and Forwards :
PHP Code:

/* 
   Set Host Name on Sendto Quries
   MaxLen In SvBrowser - 63 + 1 (null)

   if an empty string ("") is passed, FL_SVNAME flag will be unset.  
*/
native fq_set_hostname( const szHostName[] );

/* 
   Set Map Name on Sendto Quries
   MaxLen In SvBrowser - 31 + 1 (null)

   if an empty string ("") is passed, FL_MAPNAME flag will be unset.
*/
native fq_set_mapname( const szMapName[] );

/* 
   Set Game Name on Sendto Quries
   MaxLen In SvBrowser - 63 + 1 (null)

   if an empty string ("") is passed, FL_GAMENAME flag will be unset.
*/
native fq_set_gamename( const szGameName[] );

/* 
   Set Players on Sendto Quries
   If iPlayers is less than 0 i.e a negative number
   Original playersnum will be set.
   if a Negative number is passed, FL_PLAYERS will be unset.

   returns 0 On Success and -1 on Failure ( Value is greater than 127 )
*/
native fq_set_players( const iPlayers );

/* 
   Set Hostname on Sendto Quries
   If iMaxPlayers is less than 0 i.e a negative number
   Original maxplayers will be set.
   if a Negative number is passed, FL_MAXPLAYERS will be unset.

   returns 0 On Success and -1 on Failure ( Value is greater than 127 )
*/
native fq_set_maxplayers( const iMaxPlayers );

/* 
   Set Hostname on Sendto Quries
   If iBotsNum is less than 0 i.e a negative number
   Original botsnum will be set.
   if a Negative number is passed, FL_BOTSNUM will be unset.

   returns 0 On Success and -1 on Failure ( Value is greater than 127 )
*/
native fq_set_botsnum( const iBotsNum );

enum FFlags(<<=1)
{
    
FL_SVNAME = ( 1<<),
    
FL_MAPNAME,
    
FL_GAMENAME,
    
FL_PLAYERS,
    
FL_MAXPLAYERS,
    
FL_BOTSNUM
}

/* 
   Set Hostname on Sendto Quries
   UnSet respective variables. You can even pass the bitsum of the above flags
   eg. fq_unset( FL_SVNAME | FL_BOTSNUM );

   returns 0 on Success and -1 on Failure
*/
native fq_unset( const FFlags:iFlags );

/*
   Called Before replying to a request.
   To block sending Response to an IP, return PLUGIN_HANDLED. 
   This will block call to SendTo fuction.

   Header is a part (till first \x00 encounter) of Actuall response which would be sent by the server.
*/
forward Server_SendTo( const szIP[], const szHeader[] ); 

Installation :
1. Download fakequeries_binary.zip from the attachments.
2. Extract it in your game directory.
3. Optional: Add "fake_queries" in your modules.ini (in amxmodx/configs dir).
Credits :
Arkshine aka noob :p and joropito (for CHooker class)
Examples :
1. fq_Basic:

PHP Code:

#include <amxmodx>
#include <fake_queries>

new const szHostName[] = "Shooting Kings Test Server";
new const 
szMapName[] = "sk_dust2";
new const 
szGameName[] = "AM Game";

new const 
iPlayers 12;
new const 
iMaxPlayers 64;
new const 
iBotsNum 0;

public 
plugin_init()
{
    
register_plugin"FakeQueries""1.0""Shooting King" );
    
    
fq_set_hostnameszHostName );
    
fq_set_mapnameszMapName );
    
fq_set_gamenameszGameName );

    if( !
fq_set_players(iPlayers) )
        
log_amx"Players Successfully Set." );
    else
        
log_amx"Players Failed to Set." );

    if( !
fq_set_maxplayers(iMaxPlayers) )
        
log_amx"MaxPlayers Successfully Set." );
    else
        
log_amx"MaxPlayers Failed to Set." );

    if( !
fq_set_botsnum(iBotsNum) )
        
log_amx"Bots Successfully Set." );
    else
        
log_amx"Bots Failed to Set." );


Result :

https://dl.dropboxusercontent.com/u/205125564/fq1.jpg
2. fq_BlockIP

PHP Code:

#include <amxmodx>
#include <fake_queries>

new szTestIP[] = "127.0.0.1";

public 
plugin_init()
{
    
register_plugin"FakeQueries : Block IP""1.0""Shooting King" );
}

public 
Server_SendTo( const szIP[], const szHeader[] )
{
    if( 
equal(szIPszTestIP) )
    {
        
log_amx"Blocked Connection from %s with header %s"szIPszHeader );
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;


Know Issues:
Code:

- None.
ChangeLog :
Code:


1.1v
- Fixed BotCount not being set on queries
- Changed technical name of the module to fake_queries, i.e, the name of module, library, include etc etc..
- Updated vs toolkit to vs110

1.0v
- Initial Release

Github: Link (https://github.com/ShootingKing-AM/FakeServerQueries)

Plugins and the module are tested on Windows and Linux (Ubuntu 14.04 LTS x64) with HLDS v6132.

v1.0 Download count - 27277

xxxperts 07-18-2014 11:38

Re: Module: Fake Server Queries
 
Good Job :fox:

bboygrun 07-18-2014 11:48

Re: Module: Fake Server Queries
 
Good job, but, isn't it illegal ?

hleV 07-18-2014 11:50

Re: Module: Fake Server Queries
 
For what purpose can this be used besides fooling players?

Shooting King 07-18-2014 11:55

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by hleV (Post 2169943)
For what purpose can this be used besides fooling players?

Quote:

Originally Posted by Arkshine (Post 1919180)
I would think it could be useful, if a player connects to the server, he may stay and it may lead to other players connection ; and eventually a server filled with only players. I see really no harm done. It's more a tool to motivate players to stay on the server and waiting for others players. If you want to blame someone, blame the admin who puts the module bots.

Quote:

Originally Posted by bboygrun (Post 2169942)
Good job, but, isn't it illegal ?

I don't think its illegal with HL1 games.

bboygrun 07-18-2014 12:06

Re: Module: Fake Server Queries
 
AFAIK it is, i have to retrieve the text i found from Valve about it.

Arkshine 07-18-2014 12:21

Re: Module: Fake Server Queries
 
Oh, don't quote me \o/.

Shooting King 07-18-2014 12:24

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Arkshine (Post 2169964)
Oh, don't quote me \o/.

:p

yokomo 07-18-2014 12:59

Re: Module: Fake Server Queries
 
Haha impressive!
Faster download all files before delete by moderatoz.

vlad_slick 07-18-2014 13:50

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by yokomo (Post 2169979)

Faster download all files before delete by moderatoz.

AHAHAHAH! That's the first thing I thought after seeing the thread title. :avast:

Shooting King 07-18-2014 13:53

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by yokomo (Post 2169979)

Faster download all files before delete by moderatoz.

It will not be deleted.

Kia 07-20-2014 01:48

Re: Module: Fake Server Queries
 
How is this module useful?
You can only fake information to players..

Shooting King 07-21-2014 09:00

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Kia (Post 2170688)
How is this module useful?
You can only fake information to players..

How are this, this and this useful ?

And please don't ask repeated (retarded) questions again and again. If it wasn't useful why would you think we will make it ? My intention is to make more players get into the server. If there is only one player on the server people will be refusing to join to the server. So we will use this module and show the wrong number, after a while all the player on the server will be real. And similarly isn't it interesting to give two names to the same server(and i am not forcing it) ? And why should server give its configuration (A2S_RULES) to others ? (I am talking about HL1 Games ONLY)

Kia 07-21-2014 11:32

Re: Module: Fake Server Queries
 
That was just my opinion, if I join a server thinking it is full, but then see it is not and realize it fakes that information, I would never ever join that server.
And why should you hide your configuration to others? There is no point in hiding that information.

Shooting King 07-21-2014 11:40

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Kia (Post 2171396)
That was just my opinion, if I join a server thinking it is full, but then see it is not and realize it fakes that information, I would never ever join that server.
And why should you hide your configuration to others? There is no point in hiding that information.

Why in the world will you set the iPlayers to 32. To dynamically change the iPlayers, use fq_set_players() in Server_SendTo() forward after checking its an A2S_Info query (i will post and example soon). Why to show our configuration to others ?? Blocking meaning less queries will lessen load on Server.

bibu 07-21-2014 16:49

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Kia (Post 2171396)
if I join a server thinking it is full, but then see it is not and realize it fakes that information, I would never ever join that server.

You can actually say that to any plugin running on a server...

Imagine HUD/sound/too much custom resources on a server? Immedietely -> leave :bacon: lol

joropito 07-25-2014 09:15

Re: Module: Fake Server Queries
 
I think this goes against Valve's Policy of Truth...

bboygrun 07-25-2014 09:30

Re: Module: Fake Server Queries
 
Yep, i think so too.

https://forums.alliedmods.net/showthread.php?t=173670
https://support.steampowered.com/kb_...FGJ-3513#truth

joropito 07-25-2014 09:38

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by joropito (Post 2173517)
I think this goes against Valve's Policy of Truth...

Also, some comments (not tested yet)

1- Hooking sendto isn't good. You can overload sendto calls under high traffic situations
2- I like you use chooker :)
3- It goes agains Valve's Policy of Truth so this should be deleted
4- There're better ways to achieve this (better in performance, but harder because responses are now handled by steamclient)

Shooting King 07-25-2014 11:21

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by joropito (Post 2173517)
I think this goes against Valve's Policy of Truth...

Any proofs regarding HL1 Games. Valve's Policy of truth makes sense only for TF.

Quote:

Originally Posted by joropito (Post 2173524)
4- There're better ways to achieve this (better in performance, but harder because responses are now handled by steamclient)

How ? :twisted:

joropito 07-25-2014 12:08

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Shooting King (Post 2173598)

How ? :twisted:

You have to fully implement A2S_* responses in your module and block steamclient calls for such calls.
I've already done in a private module while researching goldsrc engine :)

Voltron 07-26-2014 00:01

Re: Module: Fake Server Queries
 
If I tick the "has users playing" option in the server browser, will a server running this module show up?

Kia 07-26-2014 02:22

Re: Module: Fake Server Queries
 
How often do I need to say that another thread about faking information in CS 1.6 was trashed because of Valve's Policy of Truth?

It is not only for TF!

Shooting King 07-26-2014 04:39

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by joropito (Post 2173638)
You have to fully implement A2S_* responses in your module and block steamclient calls for such calls.

What do you mean by 'fully implement' ??

Quote:

Originally Posted by Voltron (Post 2173973)
If I tick the "has users playing" option in the server browser, will a server running this module show up?

Yes.

Neeeeeeeeeel.- 07-26-2014 17:57

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Shooting King (Post 2174050)
What do you mean by 'fully implement' ??

He meant that you have to re-code all of them in your module.

Voltron 07-26-2014 23:43

Re: Module: Fake Server Queries
 
[QUOTE=Yes.[/QUOTE]

I tested it on an empty server. It doesn't show up on either the in-game server browser or the steam one when you have 'has users playing' option ticked.

Kakarotto 07-28-2014 00:09

Re: Module: Fake Server Queries
 
doesn't work ! game crashed .

i did as you sayed !

PS : i am using Linux Centos 7 .... instaled amxmodx 1.8.3 + metamod v1.21p37

Shooting King 07-28-2014 08:00

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Voltron (Post 2174425)
I tested it on an empty server. It doesn't show up on either the in-game server browser or the steam one when you have 'has users playing' option ticked.

Here.

Quote:

Originally Posted by Kakarotto (Post 2174892)
doesn't work ! game crashed .

i did as you sayed !

PS : i am using Linux Centos 7 .... instaled amxmodx 1.8.3 + metamod v1.21p37

What plugins are you using ?

bibu 07-28-2014 08:53

Re: Module: Fake Server Queries
 
Well favorites tab acts actually works different than the internet tab.

Shooting King 07-28-2014 09:01

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by bibu (Post 2175074)
Well favorites tab acts actually works different than the internet tab.

Sorry, i didn't observe it properly. I think we have to even Fake A2S_Players for that thing :mrgreen: This will be fixed in next release hopefully.

bibu 07-28-2014 09:13

Re: Module: Fake Server Queries
 
I only remember joining a random dproto running server. As always it's full of them. The funny thing is, the player amount is somehow differently handled. I'll try to explain:

There are actually 10 players on a server.
The same server on the internet browser shows 5 players.
Because 5 of them are valid steam players and 5 of them not.
I add them on my favourites, and I see 10 of them in my favorites browser.

No idea, maybe there are also some more situations where such thing happens. But I think it's a good hint for everyone.

Neeeeeeeeeel.- 07-28-2014 12:12

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by bibu (Post 2175084)
I only remember joining a random dproto running server. As always it's full of them. The funny thing is, the player amount is somehow differently handled. I'll try to explain:

There are actually 10 players on a server.
The same server on the internet browser shows 5 players.
Because 5 of them are valid steam players and 5 of them not.
I add them on my favourites, and I see 10 of them in my favorites browser.

No idea, maybe there are also some more situations where such thing happens. But I think it's a good hint for everyone.

The favorites tabs uses fakeable A2S_* queries, but the Internet Tab is validated by Steam using Steam_NotifyClientConnect function. It would be hard to bypass... btw it's ilegal.

bibu 07-28-2014 12:47

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 2175177)
It would be hard to bypass... btw it's ilegal.

Yet 99% of the servers in internet tab are non-steam servers. I really wonder how they appear in the offical browser... This should be clearly since years be elimated from Valve.

Neeeeeeeeeel.- 07-28-2014 14:28

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by bibu (Post 2175199)
Yet 99% of the servers in internet tab are non-steam servers. I really wonder how they appear in the offical browser... This should be clearly since years be elimated from Valve.

They are steam servers allowing older protocols... Valve doesn't check if older protocols are allowed or not.

.Dare Devil. 07-28-2014 18:51

Re: Module: Fake Server Queries
 
Pretty useful for me. Im not sure yet for what but i'll find something...
Thanks for sharing.

Kakarotto 07-29-2014 00:08

Re: Module: Fake Server Queries
 
i am not using any plugin i just installed a new server !

Shooting King 07-29-2014 01:29

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 2175177)
The favorites tabs uses fakeable A2S_* queries, but the Internet Tab is validated by Steam using Steam_NotifyClientConnect function. It would be hard to bypass... btw it's ilegal.

Whats illegal in this ?

Voltron 07-29-2014 04:47

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by bibu (Post 2175199)
Yet 99% of the servers in internet tab are non-steam servers. I really wonder how they appear in the offical browser... This should be clearly since years be elimated from Valve.

Do you have "has users playing" ticked when browsing for servers?

bibu 07-29-2014 09:16

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Voltron (Post 2175580)
Do you have "has users playing" ticked when browsing for servers?

Of course, that's why they show up, because there are low amount of steamers on that server. I see 3/32, if I right click and make server info, I see the server almost full lol.

Neeeeeeeeeel.- 07-29-2014 09:42

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Shooting King (Post 2175521)
Whats illegal in this ?

Are you asking why would be ilegal to bypass Steam_NotifyClientConnect? Maybe because you would be faking information in Valve's backend...


All times are GMT -4. The time now is 13:43.

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