AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] Rcon Hooks 1.0 (https://forums.alliedmods.net/showthread.php?t=147294)

Samantha 01-07-2011 18:29

[EXTENSION] Rcon Hooks 1.0
 
RCON Hooks

What?
Rhooks is an extension that allows you to hook 2 major rcon functions, allowing you to change the result. I thought it would be very useful for servers in which admins get rcon access, because you can assign separate passwords per different admins based on ip, and it can also prevent brute force attacks, because you can deny access from anywhere other than your ip!

This is derived from gmsv_rcon from gmod. Contains lots of code from that project.

Compatibility
This currently works on orange box games, on windows only. However im gonna be making a Linux version as soon as i learn how to do it and eventually make versions for l4d.

Forwards
Code:

**
 * Called when an auth message is sent to the engine.
 * Return Plugin_Continue to allow the auth to be handled by the engine.
 * Else the value in AllowAccess is used.
 *
 * Note: AllowAccess contains whether the engine wants to deny or give access
 *        to the rcon message.
 *
 * @param Password        Password sent in the query.
 * @param AllowAccess    Bool that shows whether the password is valid or invalid.
 * @param Ip            Ip Address of the origin on the message.
 * @param Port            Port of the origin on the message.
 * @return                Plugin_Continue to allow the engine to handle it, else it uses the bool
 *                        AllowAccess to allow/deny access.
 */

forward Action:OnRconCheckPassword( String:Password[], &bool:AllowAccess, String:Ip[], Port );

/**
 * Called when a data request is sent to the server.
 * Return Plugin_Continue to allow the request to be handled by the engine.
 * Else it is blocked.
 *
 * Note: AllowAccess contains whether the engine wants to deny or give access
 *        to the rcon message.
 *
 * @param Id            Id of the rcon message.
 * @param Request        Request type of the message, ( 2 = Command ), (3 = Auth )
 * @param Data            String the contains the rcon message sent from the Ip.
 * @param Ip            Ip Address of the origin on the message.
 * @param Port            Port of the origin on the message.
 * @return                Plugin_Continue to allow the engine to proccess and preform the message
 *                        otherwise it will be denied.
 */
forward Action:OnWriteDataRequest( Id, Request, String:Data[], String:Ip[], Port );

Info
- Request is the type of rcon message. 2 or 3 are valid types, 2 is used to send commands and 3 is used for authentication. Other types are not used.
- Id is simply the order of commands sent from one source, per session.
- IP format includes the seperaters ( dont know the name of them lol ).

Why?
I've always wanted a more secure rcon method and i saw gmsv_rcon, on facepuch and i've always wanted it in sourcemod. Therefore a few days i wanted to learn C++ cause i was bored so i though why not convert it to work in sourcemod!

Credits
Long list here lol
- gmsv_rcon author chrisaster - most of this is derived from his code, how ever lots was recoded.
- asherkin for taking his time and teaching me how to fix my detour errors and learn more indepth about detours.
- psychonic for telling me to scrap the gmod detours and use the ones SM uses, and providing me with an example of how to use it.
- Drifter for helping me fix countless errors and helping me get started.
- Other people on IRC such as Matt and Kyle.

http://code.google.com/p/samanthas-work/downloads/list

Source Code

psychonic 01-07-2011 18:53

Re: [EXTENSION] Rcon Hooks 1.0
 
Nice job!

Seta00 01-07-2011 19:40

Re: [EXTENSION] Rcon Hooks 1.0
 
Whatever you say... JAMES!

xomp 01-07-2011 19:44

Re: [EXTENSION] Rcon Hooks 1.0
 
Awesome work! <3 asherkin & psychonic for being so helpful!

KyleS 01-08-2011 02:22

Re: [EXTENSION] Rcon Hooks 1.0
 
I can't for the life of me get this compiled on Linux.

PHP Code:

extension.cppIn function ânetadr_sListenerIDToAddress(CServerRemoteAccess*, unsigned int)â:
extension.cpp:66:2errorexpected â(â before â{â token
extension
.cpp:67:3errorâPUSHADâ was not declared in this scope
extension
.cpp:68:3errorexpected â;â before âMOVâ 

No doubt I'm doing something wrong. >.<

I hope nothing is specific to Windows.

asherkin 01-08-2011 02:59

Re: [EXTENSION] Rcon Hooks 1.0
 
Quote:

Originally Posted by Kyle12 (Post 1388650)
I can't for the life of me get this compiled on Linux.

You can't compile this for Linux straight off, thats a block of raw ASM opcodes :|.
That whole function should be rewritten.

KyleS 01-08-2011 04:01

Re: [EXTENSION] Rcon Hooks 1.0
 
Quote:

Originally Posted by asherkin (Post 1388662)
You can't compile this for Linux straight off, thats a block of raw ASM opcodes :|.
That whole function should be rewritten.

Ah, shoot.

-=Leb=- 11-11-2011 11:12

Re: [EXTENSION] Rcon Hooks 1.0
 
how do you load this extension? does it still work? i installed it and restart the server but it never loads.

asherkin 11-11-2011 12:27

Re: [EXTENSION] Rcon Hooks 1.0
 
https://forums.alliedmods.net/showthread.php?t=168403

urban_ninja 01-16-2015 11:36

Re: [EXTENSION] Rcon Hooks 1.0
 
Quote:

<FAILED> file "rconhooks.ext.dll": Could not read rconhacks.txt: Section beginning without a matching ending
Why is this file release broken?


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

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