1. db.cpp aç:
KOD:
ekle:
KOD:
[/CODE]ve daha sonra bu fonksiyon bloğu bakarak:
ve tüm değiştirin:
Bilgi:
- algoritmasını kullanarak yeni şifre: SHA256
- Uzunluk: 64
- PHP Kodu: $ hash = hash ( 'SHA256', 'text');
Metin2 Server Geliştirme Sürecinde C++ ile Şifre Güvenliği
Metin2 özel sunucuları geliştirirken güvenlik en önemli konulardan biridir. Özellikle kullanıcı hesapları ve şifrelerin korunması büyük önem taşır. Bu bağlamda, C++ dilini kullanarak güçlü şifre güvenliği sistemleri kurmak, sunucu güvenliğini ciddi anlamda artırabilir. Bu yazıda, Metin2 özel sunucularında C++ kullanarak nasıl güvenli şifre sistemleri kurulabileceğini ele alacağız.
C++ ile Güvenlik Katmanı Oluşturmak
C++ gibi düşük seviyeli bir dil sayesinde doğrudan bellek yönetimi ve performans avantajları elde edebilirsiniz. Bu da şifreleme gibi kritik işlemler için idealdir. Örneğin, kullanıcıdan gelen şifreyi doğrudan server-side olarak hash’lemek için C++ tabanlı algoritmalar kullanılabilir. Bu sayede şifreler asla raw olarak saklanmaz.
Hash Fonksiyonlarının Kullanımı
SHA-256, bcrypt veya Argon2 gibi güçlü hash fonksiyonları, Metin2 sunucularında C++ ile entegre edilebilir. Özellikle bcrypt gibi zaman ayarlı hash fonksiyonları, brute-force saldırılarına karşı dayanıklıdır. Bu fonksiyonlar sayesinde, kullanıcı şifresi bir kez hash’lenir ve bu değer veritabanına (örneğin MySQL DB) kaydedilir.
SQL Injection ve Diğer Açıkların Önlenmesi
C++ ile yazılmış sunucu tarafında input validation (girdi doğrulama) işlemleri de kritik öneme sahiptir. Kullanıcıdan gelen şifreler, SQL injection gibi saldırılara karşı filtrelenmelidir. C++’nın pointer kontrolü sayesinde bu tür açıklar minimize edilebilir. Ayrıca, prepared statements (hazırlanmış ifadeler) kullanılması önerilir.
Sunucu Tarafında Şifre Doğrulama
Oyuncu giriş yapmak istediğinde, girilen şifre tekrar aynı hash fonksiyonundan geçirilir ve veritabanındaki hash ile karşılaştırılır. Eğer eşleşiyorsa, kullanıcıya erişim sağlanır. Bu işlem C++ ile oldukça hızlı ve güvenli bir şekilde yapılabilir. Bu doğrulama işlemi genellikle auth server tarafından yapılır.
Python ve C++ Entegrasyonu
Bazı durumlarda, güvenlik işlemleri için Python da kullanılabilir. Ancak, C++ ile entegre çalışması gerekebilir. Örneğin, bir py script ile hash kontrolü yapıldığında, bu script C++ tabanlı bir yapıya entegre edilebilir. Bu sayede hem Python’un esnekliği hem de C++’nın performansı kullanılmış olur.
Client Side Güvenlik
Client tarafında da şifre güvenliği önemlidir. Kötü niyetli kişiler, client dosyalarını analiz ederek şifre gönderimini görebilir. Bu nedenle, client src (kaynak kodu) üzerinde şifrelerin doğrudan gönderilmesi engellenmelidir. Bunun için, client-src üzerinde C++ ile şifrelenmiş olarak gönderim yapılmalıdır.
Özet
Metin2 özel sunucularında şifre güvenliği, C++ diliyle çok daha güçlü hale getirilebilir. Hash fonksiyonları, input validation, SQL injection önlemleri ve client-server iletişimi gibi konular, güvenlik için dikkat edilmesi gereken başlıca alanlardır. Bu tür güvenlik katmanları, oyuncuların güvenliğini sağlarken sunucunuzun uzun ömürlülüğünü de destekler.
Password Security with C++ in Metin2 Server Development
Security is one of the most important topics when developing Metin2 private servers. Especially protecting user accounts and passwords holds great significance. In this context, building robust password security systems using C++ can significantly enhance server security. In this article, we will examine how to implement secure password systems using C++ in Metin2 private servers.
Creating a Security Layer with C++
With a low-level language like C++, you can achieve direct memory management and performance advantages. This makes it ideal for critical operations such as encryption. For example, passwords received from users can be hashed directly on the server-side using C++ based algorithms. This ensures that passwords are never stored in raw format.
Using Hash Functions
Strong hash functions like SHA-256, bcrypt, or Argon2 can be integrated into Metin2 servers using C++. Particularly time-adjusted hash functions like bcrypt are resistant to brute-force attacks. Through these functions, the user’s password is hashed once and this value is saved in the database (e.g., MySQL DB).
Preventing SQL Injection and Other Vulnerabilities
Input validation processes on the server-side written in C++ are also critically important. Passwords received from users must be filtered against attacks such as SQL injection. With C++’s pointer control, such vulnerabilities can be minimized. Additionally, the use of prepared statements is recommended.
Server-Side Password Verification
When a player attempts to log in, the entered password is passed through the same hash function again and compared with the hash stored in the database. If they match, access is granted to the user. This process can be performed very quickly and securely using C++. This verification is typically handled by the auth server.
Integration of Python and C++
In some cases, Python may also be used for security operations. However, it may need to work integrated with C++. For example, when a hash check is done via a py script, this script can be integrated into a C++ based structure. This way, both the flexibility of Python and the performance of C++ can be utilized.
Client-Side Security
Password security is also important on the client side. Malicious individuals may analyze client files to observe password transmission. Therefore, sending passwords directly from the client source code should be prevented. For this, the password must be sent encrypted using C++ within the client-src.
Summary
Password security in Metin2 private servers can be significantly strengthened with the C++ language. Hash functions, input validation, SQL injection prevention, and client-server communication are among the key areas requiring attention for security. Such security layers support not only player safety but also the longevity of your server.
KOD:
Kod:
#include "auth_brazil.h"
KOD:
Kod:
#include "cryptopp/sha.h" #include "cryptopp/filters.h" #include "cryptopp/hex.h" #include "boost/algorithm/string.hpp"
Kod:
[COLOR=#333333][FONT=Tahoma] void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)[/FONT][/COLOR]
Kod:
[COLOR=#333333][FONT=Tahoma][B]KOD: [/B] case QID_AUTH_LOGIN: [...] sys_log(0, "QID_AUTH_LOGIN: SUCCESS %s", pinfo->login); } } } break;[/FONT][/COLOR]
Kod:
[B]KOD: [/B] case QID_AUTH_LOGIN: { TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) qi->pvData; LPDESC d = DESC_MANAGER::instance().FindByLoginKey(qi->dwIdent); if (!d) { M2_DELETE(pinfo); break; } d->SetLogin(pinfo->login); sys_log(0, "QID_AUTH_LOGIN: START %u %p", qi->dwIdent, get_pointer(d));
Kod:
if (pMsg->Get()->uiNumRows == 0) { sys_log(0, " NOID"); LoginFailure(d, "NOID"); M2_DELETE(pinfo); } else if (!pinfo->passwd){ LoginFailure(d, "WRONGPWD"); sys_log(0, " WRONGPWD"); M2_DELETE(pinfo); } else { MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); int col = 0; DWORD dwID = 0; char szEncrytPassword[64]; char szPassword[64 + 1]; char szMatrixCode[192 + 1]; char szSocialID[SOCIAL_ID_MAX_LEN + 1]; char szStatus[ACCOUNT_STATUS_MAX_LEN + 1]; std::string szEncryptedPassword; char cSHAPassword[64+1]; if (!row[col]) { sys_err("error column %d", col); M2_DELETE(pinfo); break; } strlcpy(szEncrytPassword, row[col++], sizeof(szEncrytPassword)); CryptoPP::SHA256 hash; CryptoPP::StringSource(pinfo->passwd, true, new CryptoPP::HashFilter(hash, new CryptoPP::HexEncoder(new CryptoPP::StringSink(szEncryptedPassword)))); szEncryptedPassword.resize(64); sprintf(cSHAPassword, "%s", szEncryptedPassword.c_str()); if (!row[col]) { sys_err("error column %d", col); M2_DELETE(pinfo); break; } strlcpy(szPassword, row[col++], sizeof(szPassword)); if (!row[col]) { *szMatrixCode = '\0'; col++; } else { strlcpy(szMatrixCode, row[col++], sizeof(szMatrixCode)); } if (!row[col]) { sys_err("error column %d", col); M2_DELETE(pinfo); break; } strlcpy(szSocialID, row[col++], sizeof(szSocialID)); if (!row[col]) { sys_err("error column %d", col); M2_DELETE(pinfo); break; } str_to_number(dwID, row[col++]); if (!row[col]) { sys_err("error column %d", col); M2_DELETE(pinfo); break; } strlcpy(szStatus, row[col++], sizeof(szStatus)); BYTE bNotAvail = 0; str_to_number(bNotAvail, row[col++]); int aiPremiumTimes[PREMIUM_MAX_NUM]; memset(&aiPremiumTimes, 0, sizeof(aiPremiumTimes)); char szCreateDate[256] = "00000000"; { str_to_number(aiPremiumTimes[PREMIUM_EXP], row[col++]); str_to_number(aiPremiumTimes[PREMIUM_ITEM], row[col++]); str_to_number(aiPremiumTimes[PREMIUM_SAFEBOX], row[col++]); str_to_number(aiPremiumTimes[PREMIUM_AUTOLOOT], row[col++]); str_to_number(aiPremiumTimes[PREMIUM_FISH_MIND], row[col++]); str_to_number(aiPremiumTimes[PREMIUM_MARRIAGE_FAST], row[col++]); str_to_number(aiPremiumTimes[PREMIUM_GOLD], row[col++]); { long retValue = 0; str_to_number(retValue, row[col]); time_t create_time = retValue; struct tm * tm1; tm1 = localtime(&create_time); strftime(szCreateDate, 255, "%Y%m%d", tm1); sys_log(0, "Create_Time %d %s", retValue, szCreateDate); sys_log(0, "Block Time %d ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8)); } } int nPasswordDiff = strcmp(szEncrytPassword, szPassword); int nPasswordDiff2; boost::to_upper(szPassword); nPasswordDiff2 = strcmp(cSHAPassword, szPassword); if (nPasswordDiff && nPasswordDiff2) { LoginFailure(d, "WRONGPWD"); sys_log(0, " WRONGPWD"); M2_DELETE(pinfo); } else if (bNotAvail) { LoginFailure(d, "NOTAVAIL"); sys_log(0, " NOTAVAIL"); M2_DELETE(pinfo); } else if (DESC_MANAGER::instance().FindByLoginName(pinfo->login)) { LoginFailure(d, "ALREADY"); sys_log(0, " ALREADY"); M2_DELETE(pinfo); } else if (strcmp(szStatus, "OK")) { LoginFailure(d, szStatus); sys_log(0, " STATUS: %s", szStatus); M2_DELETE(pinfo); } else { if (strncmp(szCreateDate, g_stBlockDate.c_str(), 8) >= 0) { LoginFailure(d, "BLKLOGIN"); sys_log(0, " BLKLOGIN"); M2_DELETE(pinfo); break; } char szQuery[1024]; snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID); std::auto_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) ); TAccountTable & r = d->GetAccountTable(); r.id = dwID; trim_and_lower(pinfo->login, r.login, sizeof(r.login)); strlcpy(r.passwd, pinfo->passwd, sizeof(r.passwd)); strlcpy(r.social_id, szSocialID, sizeof(r.social_id)); DESC_MANAGER::instance().ConnectAccount(r.login, d); if (!g_bBilling) { LoginPrepare(BILLING_FREE, 0, 0, d, pinfo->adwClientKey, aiPremiumTimes); //By SeMinZ M2_DELETE(pinfo); break; } sys_log(0, "QID_AUTH_LOGIN: SUCCESS %s", pinfo->login); } } } break;
Bilgi:
- algoritmasını kullanarak yeni şifre: SHA256
- Uzunluk: 64
- PHP Kodu: $ hash = hash ( 'SHA256', 'text');
Metin2 Server Geliştirme Sürecinde C++ ile Şifre Güvenliği
Metin2 özel sunucuları geliştirirken güvenlik en önemli konulardan biridir. Özellikle kullanıcı hesapları ve şifrelerin korunması büyük önem taşır. Bu bağlamda, C++ dilini kullanarak güçlü şifre güvenliği sistemleri kurmak, sunucu güvenliğini ciddi anlamda artırabilir. Bu yazıda, Metin2 özel sunucularında C++ kullanarak nasıl güvenli şifre sistemleri kurulabileceğini ele alacağız.
C++ ile Güvenlik Katmanı Oluşturmak
C++ gibi düşük seviyeli bir dil sayesinde doğrudan bellek yönetimi ve performans avantajları elde edebilirsiniz. Bu da şifreleme gibi kritik işlemler için idealdir. Örneğin, kullanıcıdan gelen şifreyi doğrudan server-side olarak hash’lemek için C++ tabanlı algoritmalar kullanılabilir. Bu sayede şifreler asla raw olarak saklanmaz.
Hash Fonksiyonlarının Kullanımı
SHA-256, bcrypt veya Argon2 gibi güçlü hash fonksiyonları, Metin2 sunucularında C++ ile entegre edilebilir. Özellikle bcrypt gibi zaman ayarlı hash fonksiyonları, brute-force saldırılarına karşı dayanıklıdır. Bu fonksiyonlar sayesinde, kullanıcı şifresi bir kez hash’lenir ve bu değer veritabanına (örneğin MySQL DB) kaydedilir.
SQL Injection ve Diğer Açıkların Önlenmesi
C++ ile yazılmış sunucu tarafında input validation (girdi doğrulama) işlemleri de kritik öneme sahiptir. Kullanıcıdan gelen şifreler, SQL injection gibi saldırılara karşı filtrelenmelidir. C++’nın pointer kontrolü sayesinde bu tür açıklar minimize edilebilir. Ayrıca, prepared statements (hazırlanmış ifadeler) kullanılması önerilir.
Sunucu Tarafında Şifre Doğrulama
Oyuncu giriş yapmak istediğinde, girilen şifre tekrar aynı hash fonksiyonundan geçirilir ve veritabanındaki hash ile karşılaştırılır. Eğer eşleşiyorsa, kullanıcıya erişim sağlanır. Bu işlem C++ ile oldukça hızlı ve güvenli bir şekilde yapılabilir. Bu doğrulama işlemi genellikle auth server tarafından yapılır.
Python ve C++ Entegrasyonu
Bazı durumlarda, güvenlik işlemleri için Python da kullanılabilir. Ancak, C++ ile entegre çalışması gerekebilir. Örneğin, bir py script ile hash kontrolü yapıldığında, bu script C++ tabanlı bir yapıya entegre edilebilir. Bu sayede hem Python’un esnekliği hem de C++’nın performansı kullanılmış olur.
Client Side Güvenlik
Client tarafında da şifre güvenliği önemlidir. Kötü niyetli kişiler, client dosyalarını analiz ederek şifre gönderimini görebilir. Bu nedenle, client src (kaynak kodu) üzerinde şifrelerin doğrudan gönderilmesi engellenmelidir. Bunun için, client-src üzerinde C++ ile şifrelenmiş olarak gönderim yapılmalıdır.
Özet
Metin2 özel sunucularında şifre güvenliği, C++ diliyle çok daha güçlü hale getirilebilir. Hash fonksiyonları, input validation, SQL injection önlemleri ve client-server iletişimi gibi konular, güvenlik için dikkat edilmesi gereken başlıca alanlardır. Bu tür güvenlik katmanları, oyuncuların güvenliğini sağlarken sunucunuzun uzun ömürlülüğünü de destekler.
Password Security with C++ in Metin2 Server Development
Security is one of the most important topics when developing Metin2 private servers. Especially protecting user accounts and passwords holds great significance. In this context, building robust password security systems using C++ can significantly enhance server security. In this article, we will examine how to implement secure password systems using C++ in Metin2 private servers.
Creating a Security Layer with C++
With a low-level language like C++, you can achieve direct memory management and performance advantages. This makes it ideal for critical operations such as encryption. For example, passwords received from users can be hashed directly on the server-side using C++ based algorithms. This ensures that passwords are never stored in raw format.
Using Hash Functions
Strong hash functions like SHA-256, bcrypt, or Argon2 can be integrated into Metin2 servers using C++. Particularly time-adjusted hash functions like bcrypt are resistant to brute-force attacks. Through these functions, the user’s password is hashed once and this value is saved in the database (e.g., MySQL DB).
Preventing SQL Injection and Other Vulnerabilities
Input validation processes on the server-side written in C++ are also critically important. Passwords received from users must be filtered against attacks such as SQL injection. With C++’s pointer control, such vulnerabilities can be minimized. Additionally, the use of prepared statements is recommended.
Server-Side Password Verification
When a player attempts to log in, the entered password is passed through the same hash function again and compared with the hash stored in the database. If they match, access is granted to the user. This process can be performed very quickly and securely using C++. This verification is typically handled by the auth server.
Integration of Python and C++
In some cases, Python may also be used for security operations. However, it may need to work integrated with C++. For example, when a hash check is done via a py script, this script can be integrated into a C++ based structure. This way, both the flexibility of Python and the performance of C++ can be utilized.
Client-Side Security
Password security is also important on the client side. Malicious individuals may analyze client files to observe password transmission. Therefore, sending passwords directly from the client source code should be prevented. For this, the password must be sent encrypted using C++ within the client-src.
Summary
Password security in Metin2 private servers can be significantly strengthened with the C++ language. Hash functions, input validation, SQL injection prevention, and client-server communication are among the key areas requiring attention for security. Such security layers support not only player safety but also the longevity of your server.
