ANTI PACKET FLOOD c++ Saldırılar karşı koruma

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 39

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Hemen yapınız.....

Arkadaşlar Bazı adamlar yurdışından serveriniz packet saldırısı yani
buffer exploit yapıyorlar. bu yüzden makine ram fazla kulanıyor ve oyun game.core verir.

@hikmetaypek Teşekkür ederiz... ( Yardımcı oldular ).

Ayrıyeten teşekkür ederim...



Core bu

Çözüm

Kod:
//input.cpp açılır ve aratılır int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) //input.cpp fonksiyon değiştiriir. int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) {     if (bHeader == HEADER_CG_ENTERGAME)         return 0;     if (bHeader == HEADER_CG_MARK_LOGIN)     {         if (!guild_mark_server)         {             // ²÷¾î¹ö·Á! - ¸¶Å© ¼¹ö°¡ ¾Æ´Ñµ¥ ¸¶Å©¸¦ ¿äûÇÏ·Á°í?             sys_err("Guild Mark login requested but i'm not a mark server!");             d->SetPhase(PHASE_CLOSE);             return 0;         }         // ¹«Á¶°Ç ÀÎÁõ --;         sys_log(0, "MARK_SERVER: Login");         d->SetPhase(PHASE_LOGIN);         return 0;     }     else if (bHeader == HEADER_CG_STATE_CHECKER)     {         if (d->isChannelStatusRequested()) {             return 0;         }         d->SetChannelStatusRequested(true);         db_clientdesc->DBPacket(HEADER_GD_REQUEST_CHANNELSTATUS, d->GetHandle(), NULL, 0);     }     else if (bHeader == HEADER_CG_PONG)         Pong(d);     else if (bHeader == HEADER_CG_HANDSHAKE)         Handshake(d, c_pData); [HASH=2]#ifdef[/HASH] _IMPROVED_PACKET_ENCRYPTION_     else if (bHeader == HEADER_CG_KEY_AGREEMENT)     {         // Send out the key agreement completion packet first         // to help client to enter encryption mode         d->SendKeyAgreementCompleted();         // Flush socket output before going encrypted         d->ProcessOutput();         TPacketKeyAgreement* p = (TPacketKeyAgreement*)c_pData;         if (!d->IsCipherPrepared())         {             sys_err ("Cipher isn't prepared. %s maybe a Hacker.", inet_ntoa(d->GetAddr().sin_addr));             d->DelayedDisconnect(5);             return 0;         }         if (d->FinishHandshake(p->wAgreedLength, p->data, p->wDataLength)) {             // Handshaking succeeded             if (g_bAuthServer) {                 d->SetPhase(PHASE_AUTH);             }             else {                 d->SetPhase(PHASE_LOGIN);             }         }         else {             sys_log(0, "[CInputHandshake] Key agreement failed: al=%u dl=%u",                 p->wAgreedLength, p->wDataLength);             d->SetPhase(PHASE_CLOSE);         }     } [HASH=3]#endif[/HASH] // _IMPROVED_PACKET_ENCRYPTION_     else     {         sys_err("Handshake phase does not handle packet %d (fd %d)", bHeader, d->GetSocket());         d->SetPhase(PHASE_CLOSE); // maybe disconnect player from server.         return -1;     }     return 0; }


Kod:
// input_login.cpp açılır ve aratılır...             sys_err("login phase does not handle this packet! header %d", bHeader);             //d->SetPhase(PHASE_CLOSE);             return 0; // fonksiyon değiştirilir.             sys_err("login phase does not handle this packet! header %d", bHeader);             //d->SetPhase(PHASE_CLOSE);             return -1;

Kod:
// input_main.cpp açılır ve aratılır... int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) // fonksiyon kontrol ederek ekleyiniz. int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) {     LPCHARACTER ch;     if (!(ch = d->GetCharacter()))     {         sys_err("no character on desc");         d->SetPhase(PHASE_CLOSE);         return -1;//FloodFix     }     //ExploitFix//     if (ch && ch->GetDesc()->GetPhase() != PHASE_GAME && ch->GetDesc()->GetPhase() != PHASE_DEAD)     {         sys_err("no character in game");         sys_log(0, "no character in game pid : %u phase : %u header : %u ip address : %s", ch->GetPlayerID(), ch->GetDesc()->GetPhase(), bHeader, ch->GetDesc()->GetHostName());         d->SetPhase(PHASE_CLOSE);         return -1;//FloodFix     }     //ExploitFix//     int iExtraLen = 0; // input_main.cpp açılır ve aratılır... int CInputDead::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) // fonksiyon kontrol ederek ekleyiniz. int CInputDead::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) {     LPCHARACTER ch;     if (!(ch = d->GetCharacter()))     {         sys_err("no character on desc");         return -1;//FloodFix     }     if (ch && ch->IsPC())     {         if (get_global_time() < ch->analyze_protect)         {             ch->analyze_protect_count = (ch->analyze_protect_count + 1);             if (ch->analyze_protect_count >= 300)             {                 sys_err("%s bu olu serefsiz packet flood yapiyor. Packet[%u]", ch->GetName(), bHeader);                 ch->analyze_protect_count = 0;                 d->SetPhase(PHASE_CLOSE);                 return -1;//Fix             }         }         else             ch->analyze_protect_count = 0;         ch->analyze_protect = (get_global_time() + 1);     }     int iExtraLen = 0;

Kod:
//input_main.cpp açılır ve aratılır. int CInputDead::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) // Fonskiyon içinde bu bulunur         default:             return (0); // Değiştirilir..         default:             return -1;//FloodFix



Kod:
//char.h açılır aratılır. int                GetSyncHackCount() { return m_iSyncHackCount; } // altına eklenir.     //FloodFix     public:         int analyze_protect;         int analyze_protect_count;         int analyze_protect_other_count;     //FloodFix

Kod:
//desc.h açılır ve aratılır         bool            IsPhase(int phase) const    { return m_iPhase == phase ? true : false; } // Altına eklenir.         int                GetPhase() const    { return m_iPhase; }

ANTI PACKET FLOOD C++ Saldırılar Karşı Koruma Sistemleri

Metin2 özel sunucularında çalışan sistemlerde, güvenlik en önemli konulardan biridir. Özellikle C++ tabanlı game server yapılarında, paket taşmalarına karşı alınması gereken önlemler büyük önem taşır. Bu yazıda, packet flood saldırılarına karşı C++ dilinde geliştirilmiş koruma sistemlerinden bahsedeceğiz. Bu tür saldırılar, sunucuya yüksek miktarda istek göndererek performansı düşürmeyi veya tamamen çökertmeyi amaçlayan kötü niyetli kullanıcılar tarafından yapılır.

Packet Flood Nedir?
Packet flood, bir sunucuya kısa sürede çok sayıda veri paketi gönderilmesiyle oluşan bir saldırı türüdür. Bu saldırılar genellikle sunucunun işleyemeyeceği kadar fazla bağlantı isteği veya komut göndererek sistem kaynaklarını tüketmeyi amaçlar. Metin2 gibi MMO oyunlarında, bu tür saldırılar oyuncuların oyun içindeki deneyimini ciddi şekilde bozabilir.

Potansiyel Tehlikeler
- Sunucu çökmesi
- Oyuncu düşmeleri
- Performans kaybı
- Veritabanı bağlantı sorunları

C++ ile Anti Packet Flood Sistemi Geliştirme
C++ dili, Metin2 sunucularında kullanılan temel programlama dillerinden biridir. Bu nedenle, C++ kullanarak geliştirilen anti-packet flood sistemleri, doğrudan sunucu seviyesinde çalışarak daha etkili sonuçlar verebilir.

Ana Bileşenler:
- Paket sınırlayıcı mekanizmalar
- IP bazlı engelleme
- Anomali tespiti algoritmaları
- Loglama ve raporlama sistemleri

Örnek Uygulama: Basit Bir Rate Limiter
Her bir oyuncudan gelen paketler belirli bir süre içinde sayılır. Belirlenen eşiği geçen paketler reddedilir. Bu işlem genellikle bir sayaç ve zamanlayıcı üzerinden kontrol edilir.

void OnPacketReceived(int playerID, const char* packet)
{
if (IsRateLimited(playerID)) {
DisconnectPlayer(playerID);
return;
}

ProcessPacket(playerID, packet);
}

IP Tabanlı Engelleme
Bazı durumlarda, aynı IP adresinden gelen birden fazla bağlantı isteği şüpheli olabilir. Bu gibi durumlar için, IP bazlı engelleme mekanizmaları da kullanılabilir. Her IP adresi için belirli bir limit tanımlanabilir ve bu limit aşıldığında IP adresi geçici olarak engellenebilir.

Loglama ve İzleme
Anti-packet flood sistemlerinde loglama da oldukça önemlidir. Günlük tutulan veriler, saldırı tespiti ve analizleri için kritik rol oynar. Loglar sayesinde hangi IP adreslerinin saldırgan davranış sergilediği kolayca tespit edilebilir.

Metin2 Sunucularında Entegrasyon
Metin2 özel sunucularında, bu tür sistemler genellikle game server src dosyalarına entegre edilir. Bu işlem sırasında dikkat edilmesi gereken konulardan biri, sistemin mevcut oyun yapısını bozmamasıdır. Doğru bir entegrasyon, hem güvenliği artırırken hem de oyun deneyimini olumsuz etkilememelidir.

Sonuç
Packet flood saldırıları, Metin2 gibi MMO oyunlarında ciddi sorunlara yol açabilir. Ancak doğru C++ tabanlı koruma sistemleriyle bu tür tehditler minimize edilebilir. Güvenlik, her zaman öncelikli olması gereken bir konudur ve bu tür saldırılarla başa çıkmak için düzenli olarak sistem güncellemeleri yapılmalıdır.

Kaynak Kod Paylaşımı
olarak, bu tür gelişmiş sistemlerin kaynak kodlarını paylaşarak topluluk katkıları sağlamaktayız. C++ sistemleri, source edit, server src gibi alanlarda uzmanlaşmış takımlarımızla, güvenli ve güçlü sunucu yapıları geliştirmekteyiz.


ANTI PACKET FLOOD C++ Protection Against Attacks

In Metin2 private servers, security is one of the most critical aspects. Particularly in C++ based game server structures, measures against packet flooding attacks are extremely important. In this article, we will discuss protection systems developed in C++ against packet flood attacks. These types of attacks aim to reduce performance or even crash the server by sending high volumes of requests to the server in a short period of time. Such attacks are often carried out by malicious users who send excessive connection requests or commands to overwhelm the server's processing capacity.

What is Packet Flood?
Packet flood is an attack type where a large number of data packets are sent to a server in a short time. These attacks generally aim to exhaust system resources by sending more requests than the server can handle. In MMO games like Metin2, such attacks can severely disrupt the players' in-game experience.

Potential Risks
- Server crashes
- Player disconnections
- Performance loss
- Database connection issues

Developing Anti-Packet Flood Systems with C++
C++ is one of the main programming languages used in Metin2 servers. Therefore, anti-packet flood systems developed using C++ can provide more effective results by operating directly at the server level.

Main Components:
- Packet limiting mechanisms
- IP-based blocking
- Anomaly detection algorithms
- Logging and reporting systems

Example Application: A Simple Rate Limiter
Packets from each player are counted within a specific time interval. Packets exceeding the defined threshold are rejected. This process is typically controlled via a counter and timer.

void OnPacketReceived(int playerID, const char* packet)
{
if (IsRateLimited(playerID)) {
DisconnectPlayer(playerID);
return;
}

ProcessPacket(playerID, packet);
}

IP-Based Blocking
In some cases, multiple connection requests from the same IP address may be suspicious. For such cases, IP-based blocking mechanisms can also be implemented. A certain limit can be defined for each IP address, and once exceeded, that IP address can be temporarily blocked.

Logging and Monitoring
Logging is also very important in anti-packet flood systems. The logs kept can play a crucial role in detecting and analyzing attacks. By examining these logs, it becomes easier to identify which IP addresses exhibit malicious behavior.

Integration in Metin2 Servers
In Metin2 private servers, such systems are usually integrated into the game server src files. One of the key considerations during integration is ensuring that the system does not disrupt the existing game structure. Proper integration should enhance security without negatively impacting gameplay.

Conclusion
Packet flood attacks can cause serious problems in MMO games like Metin2. However, with the right C++ based protection systems, such threats can be minimized. Security should always be a top priority, and regular system updates must be performed to handle such attacks effectively.

Source Code Sharing
, as a platform, shares advanced system source codes to contribute to the community. With our specialized teams in areas such as C++ systems, source edit, and server src, we develop secure and robust server infrastructures.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Geri
Üst Alt