AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION][Any?] PointDetour (https://forums.alliedmods.net/showthread.php?t=184270)

KyleS 05-03-2012 01:11

[EXTENSION][Any?] PointDetour
 
5 Attachment(s)
This would not have been possible at all without Dr!fter (Or Dr. !fter, as I'm sure no one calls him).

What is this?

This is a simple detour of PointServerCommand::InsertCommand, which allows you to block, modify or listen to point_servercommand entities firing (and get the command they're running).

Why would you write this?
Well, I've been wanting to do this for a while for VIPMod (L. Duke used convars instead of the actual brush entities :(). But recently it was made clear to my community by a mapper that they're ultimately in control. How? Through the use of this one horrible entity called point_servercommand. With this, they can change your server rcon password, set a server password, change the map, change timeleft, do whatever they want. The same can be done with clients using point_clientcommand, and that's coming to this extension Soon™. Voogru warned people in the past about randomly running maps (or so I vaguely recall), but it still happens often so that's why this is here.

What does this do?
See What is this?. But if you're an end user, this allows for plugin developers to hook the firing of point_servercommand.

THIS CRASHES MY WINDOWS SERVER.
Welp, Sorry. Since Valve doesn't release Symbols for Windows, I can't ever support it. With this being said, thanks to Dr!fter, there's a untested Windows Build, and gamedata to go with it. If it works, great! I can't ever support this, though.

THIS CRASHES MY LINUX SERVER :(
Oh no! Tragic! Please post a stack trace in the thread.

Special Thanks to:
Drifter
- Holding my hand through a lot of this.
Psychonic - Suggesting a Hack, then providing a less hacky way :P

Asherkin - I learned a lot from ZombieFix, which appears to be based off of SDKHooks.
Sammy-ROCK! - Learned about Forwards from CSS Speed Mod.

KyleS 05-03-2012 01:17

Re: [EXTENSION][Any?] PointDetour
 
Example:

PHP Code:

#pragma semicolon 1
#include <sourcemod>
#include <pscd>

public Action:PointServerCommandForward(const String:sCommand[])
{
    
PrintToServer("DetourCalled!!!!!");
    
PrintToServer("Command Trying to be Called: %s"sCommand);
    return 
Plugin_Continue;


Quote:

Originally Posted by Server
DetourCalled!!!!!
Command Trying to be Called: vip_escapezone2 2080 50 -115 2400 280 -17
DetourCalled!!!!!
Command Trying to be Called: vip_escapezone 2100 -825 32 2515 -378 308
Unknown command "vip_escapezone2"
Unknown command "vip_escapezone"


GoD-Tony 05-03-2012 02:11

Re: [EXTENSION][Any?] PointDetour
 
Nice job! I always thought these entities needed some kind of whitelist for their commands. This will do nicely.

Quote:

Originally Posted by KyleS (Post 1700933)
The same can be done with clients using point_clientcommand, and that's coming to this extension Soon™.

Am I mistaken or is this already functional in the ext/gamedata but missing from the include file?

asherkin 05-03-2012 05:04

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by KyleS (Post 1700933)
I want to execute my own commands using this!
Ok there hot shot. I should warn you that if you write over the max length, you're treading into unknown waters. Besides that though, I've yet to crash using this (Writing within the boundaries), so by all means go right ahead!

You should probably just const-qualify that param and not invoke the copyback stuff.
It's slow, and the ServerCommand native exists for that purpose.

KyleS 05-03-2012 09:51

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by GoD-Tony (Post 1700947)
Am I mistaken or is this already functional in the ext/gamedata but missing from the include file?

I haven't tested it :wink:

Dr!fter 05-03-2012 12:16

Re: [EXTENSION][Any?] PointDetour
 
I tested windows it works fine :). Only problem you should add the block to the include that forces the extension to load :P I had to create an autoload file or else it wouldnt load (You can look for this in dhooks include or sdkhooks include). But after it loaded it worked, and nice job!

Also, ventrilo used to call me "Doctor Fter" Until i added a phonetic :P

Edit: as for the "ANY?" Im almost 100% positive that any orangebox-valve game yes. After that its very likely the others work too, but not as sure :P. I doubt that function changes much if at all between games.

Blowst 05-03-2012 12:20

Re: [EXTENSION][Any?] PointDetour
 
I appreciate your job.

Thx!

KyleS 05-03-2012 12:59

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by asherkin (Post 1700972)
You should probably just const-qualify that param and not invoke the copyback stuff.
It's slow, and the ServerCommand native exists for that purpose.

There's no detour for ServerCommand :P Alright though, I'll kill it.

The include is going to change!

Plugin_Stop = Don't fire.
Plugin_Handled = Null the String, the output will still fire.
Plugin_Changed <= Continue.

Quote:

Originally Posted by Dr!fter (Post 1701229)
I tested windows it works fine :). Only problem you should add the block to the include that forces the extension to load :P I had to create an autoload file or else it wouldnt load (You can look for this in dhooks include or sdkhooks include). But after it loaded it worked, and nice job!

Awesome! and :oops: Oops! Will fix when I get home.

Dr!fter 05-03-2012 13:13

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by KyleS (Post 1701265)
There's no detour for ServerCommand :P Alright though, I'll kill it.

The include is going to change!

Plugin_Stop = Don't fire.
Plugin_Handled = Null the String, the output will still fire.
Plugin_Changed <= Continue.


Awesome! and :oops: Oops! Will fix when I get home.

It makes sense to remove the copyback since if you really needed to change it you could just use (I didnt think of this heh) ServerCommand native and block it the function from calling.

I would just make Continue fire else block. Since Nulling it wont make any difference since it would just pass an empty string to ServerCommand :P

KyleS 05-03-2012 13:39

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by Dr!fter (Post 1701271)
It makes sense to remove the copyback since if you really needed to change it you could just use (I didnt think of this heh) ServerCommand native and block it the function from calling.

I would just make Continue fire else block. Since Nulling it wont make any difference since it would just pass an empty string to ServerCommand :P

That does indeed make more sense :wink: I don't know what I was thinking before rukia

const it is!

KyleS 05-03-2012 21:00

Re: [EXTENSION][Any?] PointDetour
 
Updated OP with a proper inc and changed back to const.

Return > Plugin_Continue to block the ServerCommand.

Huge thanks again to Dr!fter for the Windows build!

Impact123 05-04-2012 06:02

Re: [EXTENSION][Any?] PointDetour
 
This will definitely be useful at some point, thank you for this :bacon!:
Yours sincerely
Impact

GoD-Tony 05-04-2012 15:40

Re: [EXTENSION][Any?] PointDetour
 
Out of curiousity, can multiple commands be executed from the same entity at the same time?

Example:
Code:

point_servercommand -> say Enjoy the map!;say Haha;quit

KyleS 05-04-2012 15:47

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by GoD-Tony (Post 1702175)
Out of curiousity, can multiple commands be executed from the same entity at the same time?

Example:
Code:

point_servercommand -> say Enjoy the map!;say Haha;quit

I'd expect that to work, but I can't say for certain.

Dr!fter 05-04-2012 19:00

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by GoD-Tony (Post 1702175)
Out of curiousity, can multiple commands be executed from the same entity at the same time?

Example:
Code:

point_servercommand -> say Enjoy the map!;say Haha;quit

Quote:

Originally Posted by KyleS (Post 1702177)
I'd expect that to work, but I can't say for certain.

Id think so. All it does is engine->ServerCommand. You can easily test to make sure with sourcemods ServerCommand since afaik that's the same.

GoD-Tony 05-05-2012 02:56

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by KyleS (Post 1702177)
I'd expect that to work, but I can't say for certain.

Quote:

Originally Posted by Dr!fter (Post 1702265)
Id think so. All it does is engine->ServerCommand. You can easily test to make sure with sourcemods ServerCommand since afaik that's the same.

It works with ServerCommand so I'll assume that map authors could be doing the same.

lovely 12-15-2012 03:15

Re: [EXTENSION][Any?] PointDetour
 
Unable to load extension "PointDetour" what's wrong?

KyleS 12-15-2012 04:13

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by lovely (Post 1854053)
Unable to load extension "PointDetour" what's wrong?

Probably a lot of things, which engine/game/OS?

GoD-Tony 01-11-2013 09:44

Re: [EXTENSION][Any?] PointDetour
 
Unfortunately this extension requires a specific Windows sig for every game. Would you be willing to take a different approach to achieve the same thing?

This method borrows gamedata from SDK Tools to hook AcceptInput for every point_*command entity that gets created: http://pastebin.com/JWUAYWmh

I'm not sure yet if it'll require separate engine builds, but you wouldn't have to do much updating (if any) after the first release.

berni 01-11-2013 11:38

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by GoD-Tony (Post 1871518)
Unfortunately this extension requires a specific Windows sig for every game. Would you be willing to take a different approach to achieve the same thing?

This method borrows gamedata from SDK Tools to hook AcceptInput for every point_*command entity that gets created: http://pastebin.com/JWUAYWmh

I'm not sure yet if it'll require separate engine builds, but you wouldn't have to do much updating (if any) after the first release.

I think you shouldn't rely on core gamedata files, as they can change at anytime.

Peace-Maker 01-30-2014 12:48

Re: [EXTENSION][Any?] PointDetour
 
I needed this one for a short test. The windows signatures are outdated. at least in css.
Code:

"Games"
{
    "#default"
    {
        "Signatures"
        {
            "PointServerCommand"
            {
                "windows"    "\x56\x8B\x74\x2A\x2A\x83\xC6\x2A\x83\x2A\x2A\x2A\x75"
                "linux"            "@_ZN19CPointServerCommand12InputCommandER11inputdata_t"
            }
           
            "PointClientCommand"
            {
                "windows"    "\x53\x8B\x5C\x2A\x2A\x83\x7B\x2A\x2A\x57\x8D\x2A\x08\x75\x2A\x8B\x2A\x85\xC0"
                "linux"            "@_ZN19CPointClientCommand12InputCommandER11inputdata_t"
            }
        }
    }
  "cstrike"
    {
        "Signatures"
        {
            "PointServerCommand"
            {
                "windows"    "\x55\x8B\xEC\x56\x8B\x2A\x2A\x83\x7E\x2A\x02\x75\x2A\x8B"
                "linux"            "@_ZN19CPointServerCommand12InputCommandER11inputdata_t"
            }
           
            "PointClientCommand"
            {
                "windows"    "\x55\x8B\xEC\x53\x8B\x2A\x2A\x83\x7B\x18\x02\x57\x75\x2A\x8B"
                "linux"            "@_ZN19CPointClientCommand12InputCommandER11inputdata_t"
            }
        }
    }
}


friagram 02-01-2014 05:26

Re: [EXTENSION][Any?] PointDetour
 
Y u not use global filter in stripper source and nuke all point servercommands?
I suppose they could always create one with an entity maker/template. Could filter that too.

Honestly, it is stupid that valve refuses to make a startup switch or even a cvar to disable them.

Pan32 08-21-2014 21:48

Re: [EXTENSION][Any?] PointDetour
 
Could anyone provide a updated signature for csgo?

El Diablo War3Evo 11-24-2014 12:06

Re: [EXTENSION][Any?] PointDetour
 
] sm_rcon sm exts list
[SM] Displaying 15 extensions:
[01] Automatic Updater (1.6.3-dev+4588): Updates SourceMod gamedata files
[02] Webternet (1.6.3-dev+4588): Extension for interacting with URLs
[03] TF2Items (1.5.3): TF2 Item Modifier
[04] TF2 Tools (1.6.3-dev+4588): TF2 extended functionality
[05] BinTools (1.6.3-dev+4588): Low-level C/C++ Calling API
[06] SDK Hooks (1.6.3-dev+4588): Source SDK Hooks
[07] SDK Tools (1.6.3-dev+4588): Source SDK Tools
[08] Regex (1.6.3-dev+4588): Provides regex natives for plugins
[09] Socket (3.0.1): Socket extension for SourceMod
[10] Top Menus (1.6.3-dev+4588): Creates sorted nested menus
[11] Client Preferences (1.6.3-dev+4588): Saves client preference settings
[12] MySQL-DBI (1.6.3-dev+4588): MySQL driver implementation for DBI
[13] SteamTools (0.8.3): SteamWorks for SourceMod.
[14] SQLite (1.6.3-dev+4588): SQLite Driver
[15] <FAILED> file "PointDetour.ext.so": /lib/i386-linux-gnu/i686/cmov/libm.so.6: version `GLIBC_2.15' not found (required by bin/libvstdlib.so)


:(

Weird though.. I'm sure i have at least GLIBC_2.15 or higher, otherwise i couldn't run this server


FIXED / SOLVED

i copied a version of libm.so.6 that it would accept to the directory where srcds_* is located, then i hard restarted the server.

psychonic 11-24-2014 13:05

Re: [EXTENSION][Any?] PointDetour
 
Quote:

Originally Posted by El Diablo War3Evo (Post 2227857)
] sm_rcon sm exts list
[SM] Displaying 15 extensions:
[01] Automatic Updater (1.6.3-dev+4588): Updates SourceMod gamedata files
[02] Webternet (1.6.3-dev+4588): Extension for interacting with URLs
[03] TF2Items (1.5.3): TF2 Item Modifier
[04] TF2 Tools (1.6.3-dev+4588): TF2 extended functionality
[05] BinTools (1.6.3-dev+4588): Low-level C/C++ Calling API
[06] SDK Hooks (1.6.3-dev+4588): Source SDK Hooks
[07] SDK Tools (1.6.3-dev+4588): Source SDK Tools
[08] Regex (1.6.3-dev+4588): Provides regex natives for plugins
[09] Socket (3.0.1): Socket extension for SourceMod
[10] Top Menus (1.6.3-dev+4588): Creates sorted nested menus
[11] Client Preferences (1.6.3-dev+4588): Saves client preference settings
[12] MySQL-DBI (1.6.3-dev+4588): MySQL driver implementation for DBI
[13] SteamTools (0.8.3): SteamWorks for SourceMod.
[14] SQLite (1.6.3-dev+4588): SQLite Driver
[15] <FAILED> file "PointDetour.ext.so": /lib/i386-linux-gnu/i686/cmov/libm.so.6: version `GLIBC_2.15' not found (required by bin/libvstdlib.so)


:(

Weird though.. I'm sure i have at least GLIBC_2.15 or higher, otherwise i couldn't run this server


FIXED / SOLVED

i copied a version of libm.so.6 that it would accept to the directory where srcds_* is located, then i hard restarted the server.

The extension is linked against libvstdlib.so, which is now the name of the linux client binary. It shouldn't even be shipped with the dedicated server install, but they never removed it. The linux client has a higher GLIBC requirement. The proper fix is to recompile, linking to the server's libvstdlib_srv.so.

bottiger 03-15-2021 00:25

Re: [EXTENSION][Any?] PointDetour
 
1 Attachment(s)
This extension crashes the server if point_servercommand is sent a Command with no parameter.

Edit: Added fixed version with compiled version for TF2 linux.

cravenge 04-04-2021 02:54

Re: [EXTENSION][Any?] PointDetour
 
If someone decides to add support and recompile this extension for L4D2, here's the gamedata:
PHP Code:

"Games"
{
    
"#default"
    
{
        
"Signatures"
        
{
            
"PointServerCommand"
            
{
                
"library"    "server"
                "linux"        "@_ZN19CPointServerCommand12InputCommandER11inputdata_t"
            
}
            
"PointClientCommand"
            
{
                
"library"    "server"
                "linux"        "@_ZN19CPointClientCommand12InputCommandER11inputdata_t"
            
}
        }
    }
    
    
"#default"
    
{
        
"#supported"
        
{
            
"engine"    "cstrike"
            "engine"    "left4dead2"
        
}
        
        
"Signatures"
        
{
            
"PointServerCommand"
            
{
                
"library"    "server"
                "windows"    "\x55\x8B\xEC\x56\x8B\x2A\x2A\x83\x7E\x2A\x02\x75\x2A\x8B"
                
/* 55 8B EC 56 8B ? ? 83 7E ? 02 75 ? 8B */
                /* Look for string: "InputCommand". Second xref */
            
}
            
"PointClientCommand"
            
{
                
"library"    "server"
                "windows"    "\x55\x8B\xEC\x53\x8B\x2A\x2A\x83\x7B\x18\x02\x57\x75\x2A\x8B"
                
/* 55 8B EC 53 8B ? ? 83 7B 18 02 57 75 ? 8B */
                /* Look for string: "InputCommand". First xref */
            
}
        }
    }




All times are GMT -4. The time now is 00:12.

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