Jump to content

Emoticons usage --> Disconnect


Recommended Posts

  • Gold

Hey guys,

i implemented new emoticons from official server to my client and I found a problem.

When I will "spam" these emoticons by clicking on some of them many times in a row I'll be disconnected from the server.

Syslog from channel:

CHAT_HACK: (player name)

It's actually some protection for chat hack implemented in source. I want to know if it's useless protection and I can simply remove it. Because emoticons use sending a chat command to server so I don't really know how it should be fixed.

Thanks for answers!

Sincerely,

ReFresh

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

Hi, 

I don't recommend you to remove this protection who block the chat/pm spam.

I don't know what code you've taked because i've not this system but you can simply increase the Counter before kick function change 10 to 15 for example, or just make an exception in this part if user use "x command" on the chat.

PgGYei3.png

Edited by Metin2 Dev
Core X - External 2 Internal
 

 

Link to comment
Share on other sites

  • 3 weeks later...
il y a 47 minutes, ReFresh a dit :

ref

Like I told you upper, make an exeption on the code of the /commands, but I don't recommend you this function in any cases because it can be a security issue.
 

   if (ch->IncreaseChatCounter() >= 10)
    {
        if (ch->GetChatCounter() == 10)
        {
            if (!(std::string(buf).find("/your_command_xxx") != std::string::npos || std::string(buf).find("your_command_xxx2") != std::string::npos)) {
                sys_log(0, "CHAT_HACK: %s", ch->GetName());
                ch->GetDesc()->DelayedDisconnect(5);
            }
        }

        return iExtraLen;
    }

 

 

 

Link to comment
Share on other sites

il y a 21 minutes, tmoitoi a dit :

Like I told you upper, make an exeption on the code of the /commands, but I don't recommend you this function in any cases because it can be a security issue.
 


   if (ch->IncreaseChatCounter() >= 10)
    {
        if (ch->GetChatCounter() == 10)
        {
			strlcpy(buf, data + sizeof(TPacketCGChat), MIN(iExtraLen + 1, sizeof(buf)));
            if (!(std::string(buf).find("/your_command_xxx") != std::string::npos || std::string(buf).find("your_command_xxx2") != std::string::npos)) {
            sys_log(0, "CHAT_HACK: %s", ch->GetName());
            ch->GetDesc()->DelayedDisconnect(5);
            }
        }

        return iExtraLen;
    }

 

Go to input_main.cpp, search for CHAT_HACK and change like I do upper then if, for example, your emotion commands is "/sky" you change /your_command_xxx by /sky, be carrefull, i've edited code he was wrong.

 

Hope you understand

 

 

Link to comment
Share on other sites

il y a 2 minutes, ReFresh a dit :

@tmoitoi Thanks. Gonna try it. Btw. These commands metin2 using by default, these are commands like (?), (!), (fish) etc. you can use them ingame by pressing ctrl+1, ctrl+2  etc. keys.

You welcome, I understand, but anyway,  the commands like (fish), (!) will also disconnect you while spamming them.

  • Love 1
 

 

Link to comment
Share on other sites

  • Gold

@tmoitoi Btw. Do you know how I can make it eye better looking? This looks very bad and it's very bad readable. Something like make a new variable and input in the variable a chat commands.

			if (!(std::string(buf).find("(Ȳ´ç)") != std::string::npos || std::string(buf).find("(µ·)") != std::string::npos
				|| std::string(buf).find("(±â»Ý)") != std::string::npos || std::string(buf).find("(ÁÁľĆ)") != std::string::npos
				|| std::string(buf).find("(»ç¶ű)") != std::string::npos || std::string(buf).find("(şĐłë)") != std::string::npos
				|| std::string(buf).find("(ľĆÇĎ)") != std::string::npos || std::string(buf).find("(żěżď)") != std::string::npos
				|| std::string(buf).find("(ÁËĽŰ)") != std::string::npos || std::string(buf).find("(!)") != std::string::npos
				|| std::string(buf).find("(?)") != std::string::npos || std::string(buf).find("(fish)") != std::string::npos
				|| std::string(buf).find("(celebration)") != std::string::npos || std::string(buf).find("(alcohol)") != std::string::npos
				|| std::string(buf).find("(weather3)") != std::string::npos || std::string(buf).find("(letter)") != std::string::npos
				|| std::string(buf).find("(hungry)") != std::string::npos || std::string(buf).find("(busy)") != std::string::npos
				|| std::string(buf).find("(charging)") != std::string::npos || std::string(buf).find("(call)") != std::string::npos
				|| std::string(buf).find("(weather1)") != std::string::npos || std::string(buf).find("(weather2)") != std::string::npos
				|| std::string(buf).find("(siren)") != std::string::npos || std::string(buf).find("(nosay)") != std::string::npos
				|| std::string(buf).find("(whirl)") != std::string::npos))
			{
				sys_log(0, "CHAT_HACK: %s", ch->GetName());
				ch->GetDesc()->DelayedDisconnect(5);
			}

 

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 3 years later...
On 4/1/2019 at 6:05 PM, ReFresh said:

@tmoitoi Btw. Do you know how I can make it eye better looking? This looks very bad and it's very bad readable. Something like make a new variable and input in the variable a chat commands.

			if (!(std::string(buf).find("(Ȳ´ç)") != std::string::npos || std::string(buf).find("(µ·)") != std::string::npos
				|| std::string(buf).find("(±â»Ý)") != std::string::npos || std::string(buf).find("(ÁÁľĆ)") != std::string::npos
				|| std::string(buf).find("(»ç¶ű)") != std::string::npos || std::string(buf).find("(şĐłë)") != std::string::npos
				|| std::string(buf).find("(ľĆÇĎ)") != std::string::npos || std::string(buf).find("(żěżď)") != std::string::npos
				|| std::string(buf).find("(ÁËĽŰ)") != std::string::npos || std::string(buf).find("(!)") != std::string::npos
				|| std::string(buf).find("(?)") != std::string::npos || std::string(buf).find("(fish)") != std::string::npos
				|| std::string(buf).find("(celebration)") != std::string::npos || std::string(buf).find("(alcohol)") != std::string::npos
				|| std::string(buf).find("(weather3)") != std::string::npos || std::string(buf).find("(letter)") != std::string::npos
				|| std::string(buf).find("(hungry)") != std::string::npos || std::string(buf).find("(busy)") != std::string::npos
				|| std::string(buf).find("(charging)") != std::string::npos || std::string(buf).find("(call)") != std::string::npos
				|| std::string(buf).find("(weather1)") != std::string::npos || std::string(buf).find("(weather2)") != std::string::npos
				|| std::string(buf).find("(siren)") != std::string::npos || std::string(buf).find("(nosay)") != std::string::npos
				|| std::string(buf).find("(whirl)") != std::string::npos))
			{
				sys_log(0, "CHAT_HACK: %s", ch->GetName());
				ch->GetDesc()->DelayedDisconnect(5);
			}

 

Hi, 

I was not active all this time along, I don't know if you are still using this, but you can simplify like this:

if (ch->IncreaseChatCounter() >= 10)
    {
        if (ch->GetChatCounter() == 10)
        {
			strlcpy(buf, data + sizeof(TPacketCGChat), MIN(iExtraLen + 1, sizeof(buf)));
        	std::vector<std::string> stringsToFind = {"(Ȳ´ç)", "(µ·)", "(±â»Ý)", "(ÁÁľĆ)", "(»ç¶ű)", "(şĐłë)", "(ľĆÇĎ)", "(żěżď)", "(ÁËĽŰ)", "(!)", "(?)", "(fish)", "(celebration)", "(alcohol)", "(weather3)", "(letter)", "(hungry)", "(busy)", "(charging)", "(call)", "(weather1)", "(weather2)", "(siren)", "(nosay)", "(whirl)"};
			bool found = false;
            for(const auto &str : stringsToFind) {
              if (std::string(buf).find(str) != std::string::npos) {
                found = true;
                break;
              }
        }
        if (!found) {
            sys_log(0, "CHAT_HACK: %s", ch->GetName());
            ch->GetDesc()->DelayedDisconnect(5);
        }
      }

    return iExtraLen;
  }

 

Edited by tmoitoi
  • Metin2 Dev 1
 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.