Raised This Month: $12 Target: $400
 3% 

[ANY] Admin RegAdminCmd Logging (version 1.3) 10 Nov 2014


Post New Thread Reply   
 
Thread Tools Display Modes
Author
El Diablo War3Evo
Veteran Member
Join Date: Jun 2013
Plugin ID:
4410
Plugin Version:
1.3
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    3 
    Plugin Description:
    Logs all admin commands by hooking RegAdminCmd and creates a log file format: admin_SteamID_AdminName.log for easy look up
    Old 11-07-2014 , 12:41   [ANY] Admin RegAdminCmd Logging (version 1.3) 10 Nov 2014
    Reply With Quote #1

    Pretty simple plug-in that hooks all RegAdminCmd commands via their own default flags, and logs every time it is used.

    A Sample file name format created by this plugin:

    admin_STEAM_0-1-35173666_W3EElDiablo.log

    It will put the command between brackets [] and the whole command after the brackets.

    It also records the date and time in the log.


    Hopefully this plug-in will help you know if any admins are using commands they shouldn't be allowed to use.


    When I first created this, I found that I actually have 326 hooked commands! OMG.. 326??? So yeah.. if you check your log file, this plug-in will also tell you how many hooked RegAdminCmds that it has hooked.


    Let me know if this plug-in has helped you or if you have any problems or suggestions for it


    Changelog

    version - description

    1.0 - inital

    1.1 - bug fixes
    - fixed handle leak CommandIterator
    - fixed capturing all commands (now only captures admin commands greater than ADMFLAG_RESERVATION)
    - now using a while command like PowerLord described
    - removed hard coded client name array
    - now uses AddCommandListener instead of RegAdminCmd for hooking

    1.2 - more bug fixes (24 views)
    - includes a IgnoreCommands list which filters commands via ADMFLAG_ROOT check, because for some reason if a command registers via RegConsoleCmd without any flags, it is considered ADMFLAG_ROOT when checked using (flags & ADMFLAG_ROOT)??
    - added CheckCommandAccess on callback just for extra security against logging a wrong admin command.

    1.3 - If you find a that your "missing" hooked commands, then you may want to download this updated copy. It will allow you to "add" commands. Currently it is setup to "add" war3source commands as an example. Like if the command is war3_givegold, or war3_something.... you can just use "war3" to allow all war3 commands to be included in the hooking of commands.


    Known bugs:
    - may log some commands that are not assoicated with any flags at all ?? If you find any of these, just add to the IgnoreCommands list inside the sourcecode and recompile.
    Attached Files
    File Type: sp Get Plugin or Get Source (admin_regadmincmd_logging.sp - 1278 views - 5.4 KB)
    __________________

    Last edited by El Diablo War3Evo; 11-14-2014 at 20:29. Reason: updated s
    El Diablo War3Evo is offline
    ocwoody
    AlliedModders Donor
    Join Date: Nov 2010
    Location: huh
    Old 11-07-2014 , 13:39   Re: [ANY] Admin RegAdminCmd Logging
    Reply With Quote #2

    MYSQL support.
    __________________

    ocwoody is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 11-07-2014 , 14:02   Re: [ANY] Admin RegAdminCmd Logging
    Reply With Quote #3

    A few issues I can see just from glancing at it:
    1. This leaks a handle because you never close the CommandIterator handle. GetCommandIterator's docs even warns you about this.
    2. It captures all commands, not just admin commands. To avoid this, you need to check the Flags argument to see if any flags are set on the command.
    3. As far as I can tell, this loops from 0 to MaxRegAdminComands no matter how many commands actually exist. Consider using a while loop to avoid this (such as while(ReadCommandIterator(CmdIter, Name, sizeof(Name), Flags, Desc, sizeof(Desc))
    4. 32 is being hard-coded instead of using the MAX_NAME_LENGTH constant.

    I'm too lazy to produce a more complete list as I'm trying to get some other work1 done.

    1At least that's what my coworkers are supposed to think. I'm actually working on SM stuff... including possibly converting core stuff to 1.7 syntax.
    __________________
    Not currently working on SourceMod plugin development.

    Last edited by Powerlord; 11-07-2014 at 14:03.
    Powerlord is offline
    El Diablo War3Evo
    Veteran Member
    Join Date: Jun 2013
    Old 11-07-2014 , 16:31   Re: [ANY] Admin RegAdminCmd Logging
    Reply With Quote #4

    Quote:
    Originally Posted by Powerlord View Post
    A few issues I can see just from glancing at it:
    1. This leaks a handle because you never close the CommandIterator handle. GetCommandIterator's docs even warns you about this.
    2. It captures all commands, not just admin commands. To avoid this, you need to check the Flags argument to see if any flags are set on the command.
    3. As far as I can tell, this loops from 0 to MaxRegAdminComands no matter how many commands actually exist. Consider using a while loop to avoid this (such as while(ReadCommandIterator(CmdIter, Name, sizeof(Name), Flags, Desc, sizeof(Desc))
    4. 32 is being hard-coded instead of using the MAX_NAME_LENGTH constant.
    Okay.. I'll fix this and update it really soon.
    __________________

    Last edited by El Diablo War3Evo; 11-07-2014 at 16:31.
    El Diablo War3Evo is offline
    El Diablo War3Evo
    Veteran Member
    Join Date: Jun 2013
    Old 11-07-2014 , 19:24   Re: [ANY] Admin RegAdminCmd Logging (version 1.2)
    Reply With Quote #5

    If anyone has downloaded the old version, probably should update and down this newest version

    Cause I remember telling everyone to avoid it until I'm sure about it.. now I believe even with the known bug .. it is worth downloading.
    __________________

    Last edited by El Diablo War3Evo; 11-07-2014 at 19:25.
    El Diablo War3Evo is offline
    Robin955
    Veteran Member
    Join Date: Jun 2013
    Old 05-02-2017 , 22:04   Re: [ANY] Admin RegAdminCmd Logging (version 1.3) 10 Nov 2014
    Reply With Quote #6

    annyone who uses admin menu wont be logged when using admin commands.
    Robin955 is offline
    Reply


    Thread Tools
    Display Modes

    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 10:05.


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