AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Admin RegAdminCmd Logging (version 1.3) 10 Nov 2014 (https://forums.alliedmods.net/showthread.php?t=251183)

El Diablo War3Evo 11-07-2014 12:41

[ANY] Admin RegAdminCmd Logging (version 1.3) 10 Nov 2014
 
1 Attachment(s)
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.

ocwoody 11-07-2014 13:39

Re: [ANY] Admin RegAdminCmd Logging
 
MYSQL support. :)

Powerlord 11-07-2014 14:02

Re: [ANY] Admin RegAdminCmd Logging
 
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.

El Diablo War3Evo 11-07-2014 16:31

Re: [ANY] Admin RegAdminCmd Logging
 
Quote:

Originally Posted by Powerlord (Post 2221404)
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.

El Diablo War3Evo 11-07-2014 19:24

Re: [ANY] Admin RegAdminCmd Logging (version 1.2)
 
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.

Robin955 05-02-2017 22:04

Re: [ANY] Admin RegAdminCmd Logging (version 1.3) 10 Nov 2014
 
annyone who uses admin menu wont be logged when using admin commands.


All times are GMT -4. The time now is 02:45.

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