View Full Version : [SOLVED] How to block a "/" command?

06-27-2014, 09:08 AM
Greetings, I hope you don`t take this request as an insult. I know I have just registered and already asking for help but I could really use some hints. I don`t mind working my a$$ out to achieve something but when I have no idea where to start it's quite annoying.

My questions i, is there any possibility to block a "/" command? Such as an addon command, or "/join channel" command etc.

Thank you for taking the time to read and eventually answer this. Have a great day!

06-27-2014, 10:31 AM
I dont think there is really .. you would need to modify the client for that.
However, the client sends a packet to the server. Then the server checks what it should do ( what packet it is ) and then read the contents and act accordingly.
There are a bunch of packet handling functions that are used to do that process.
If you remove the packet handler function, the packet is not handled and whatever the player sent does nothing.

So you cant exactly remove / block a slash command, but you can ignore it, which is pretty much the same thing.
But it can be difficult to find what packet, where and if its possible to see what command the player used etc..

If you go to Opcodes.cpp and search for channel, you can find CMSG_JOIN_CHANNEL
From there you see that this packet is handled with WorldSession::HandleJoinChannel function.
You can either modify that function or disable the whole packet by changing the handler function to WorldSession::Handle_NULL, status to STATUS_NEVER and process to PROCESS_INPLACE.

This is just theory. I have not actually tried this ever.

06-27-2014, 10:40 AM
You can either modify that function or disable the whole packet by changing the handler function to WorldSession::Handle_NULL, status to STATUS_NEVER and process to PROCESS_INPLACE.

Which would totally disable joining a channel and not just only the slash command though.

I am not sure, but if slash commands are sent in plain text you could use the OnSay hooks and act accordingly.. If the slash command is already formed into a specific opcode then I'm afraid you'll have to edit the client.

06-27-2014, 12:36 PM
Interesting. I have come to find an addon that heavily lags the client on a certain command use. And while using cheat engine, he can switch the packets and target a player and freezes that player's client.

Now I have disabled the addon by using Shauren's Addon Handling patch. However every kiddie can rename the addon and keep on using it. How could I protect myself from that?

I was also thinking to disable all addon's but I have no idea on how to do that. Or if it would be possible to allow only certain addons that are found in the addons table and have the crc signature: 1276933997

Thank you for taking the time to read and answer to my thread.

06-27-2014, 01:24 PM
Sounds like the core code should be changed.

All the data a player receives comes from the server.
This means that if player A crashes player B,
player A sends data to server and then server sends the data to player B.

This means that you can add code to the core to check the validity of the packet etc possibly.
And so, not send the invalid packet to player B and possibly take action against player A by logging the event and or kick etc.

The kind of heavy lagging commands should be altered to not be able to be used so often or to make more efficient.

I have no experience with disabling / coping with addons myself : |

06-27-2014, 02:15 PM
I understand. Thank you for your answer Rochet2. You are kind and helpful. So I should detect the packet that he is modifying or something like that and filter it.

I have a way of detecting the add-on, after checking my logs and further-more testing, I have found that once the add-on is active, the console outputs the following error:

ERROR:SESSION: opcode CMSG_WHO (0x0062) have unprocessed tail data (read stop at 0 from 29)

And it keeps on spamming this thing. Also the /who list doese not work(obviously) whiel the add-on is active.

SO a newb like me was thinking, could I make a filter/rule if a player keeps spaming that OPCODE, get an auto-kick or some action towards him? Or simply log him?

Any hints/pin-points towards where could I find such a thing would be great. Thank you.