Jump to content

[C++] Two-Stage Pack Security (First stage)


Recommended Posts

  • Active+ Member

Hello, I have been hearing about the existence of such an event from time to time. I thought of creating such a solution. I haven't had any problems so far in my tests.

To briefly talk about the incident; Some pack files can be opened and edited while the game is open. This may pose a problem in some exceptional cases.
Most of the time, changes made due to cache may not be reflected in the game unless the client is reset, but I still thought it wouldn't hurt to prevent this situation.
In addition; Nowadays, foxfs etc. methods are used, so you can also consider this as additional security for your game.

The codes are completely open to development and customization, you can progress them in any direction you want.
I should point out that this method will work more efficiently with autopatcher. So, you also have a job to do here, the codes I share here are the first stage of this system. The necessary adjustments you will make to the autopatcher depending on these codes will be the second stage.

To give an example from the working logic; As soon as the pack file named x is edited, the game will close completely, and when it is opened again, autopatcher (if there is a file integrity feature, etc.) will download the original instead of this edited pack file and allow you to log in from the original file.
Likewise, if there is any intervention in the pack files again, these operations will be repeated automatically. (This is the idea I suggested, anyone can use it however they want.)

Now let's get to the point..


Here's a short video showing it before editing:

After video:

 

This is the hidden content, please

For those who are curious; The codes run only once when the client is opened and only keep track of the pack files as long as the game (client) is open. In other words, it does not work repeatedly in situations such as teleportation or casting a character.

Edited by Metin2 Dev International
Core X - External 2 Internal
  • Metin2 Dev 51
  • Eyes 1
  • Smile Tear 1
  • Good 4
  • Love 11
Link to comment
Share on other sites

Thx,

You might consider using a separate thread and sleep() if you're worried about performance or just check the root (if your index is from the source) nothing else really matter,

but the thing here is that you can just cython your root and avoid all this non sense + improve the performance ,

And if you wanted an extra protection on the root you can also use dynamic python moudles,

Both of these things are already shared in here..

Edited by CONTROL
  • Good 1
Link to comment
Share on other sites

  • Active+ Member
12 minutes ago, CONTROL said:

Thx,

You might consider using a separate thread and sleep() if you're worried about performance or just check the root (if your index is from the source) nothing else really matter,

but the thing here is that you can just cython your root and avoid all this non sense + improve the performance ,

And if you wanted an extra protection on the root you can also use dynamic python moudles,

Both of these things are already shared in here..

Yes, they can be used too. However, the point I am talking about here covers all pack files, not just root. The root file does not continue the game after any editing and it gives an error and closes. But this is not the case for other pack files, the game continues even if intervention is made. Here I just presented a small idea to prevent this. Anyone can customize it as they wish and use it as a small add-on. Or he may not use it.

Link to comment
Share on other sites

 

Yesterday, I got motivated to do at least some small things with the keys. It seems like a good idea to share it in one thread, in case someone wants to explore more options without having to search for them.

 

Spoiler
#ifdef __OBFUSCATE_KEYS__
#include <string>
#include <array>

constexpr int NUM_VALUES = 10;

using EterPackKey = std::array<std::string, NUM_VALUES>;

static std::array<EterPackKey, 4> s_strEterPackKey = {{
	{ "4", "5", "1", "2", "9", "4", "0", "1" },
	{ "9", "2", "3", "6", "7", "2", "1", "5" },
	{ "6", "8", "1", "2", "8", "5", "7", "3", "1" },
	{ "1", "7", "1", "0", "2", "0", "1" }
}};

static std::array<EterPackKey, 4> s_strEterPackSecurityKey = {{
	{ "7", "8", "9", "5", "2", "4", "8", "2" },
	{ "5", "2", "7", "3", "4", "8", "3", "2", "4" },
	{ "1", "6", "3", "2", "9", "4", "2" },
	{ "4", "8", "6", "2", "7", "4", "7", "2", "6" }
}};

static unsigned long s_EncryptEterPackKey(int key)
{
	std::string sEterPackKey = "";
	unsigned long iEterPackKey = 0;

	for (int iter = 0; iter < (sizeof(s_strEterPackKey[key]) / sizeof(std::string)); ++iter)
	{
		sEterPackKey.append(s_strEterPackKey[key][iter]);
	}

	iEterPackKey = std::stoul(sEterPackKey);

	return iEterPackKey;
}

static unsigned long s_EncryptEterPackSecurityKey(int key)
{
	std::string sEterPackSecurityKey = "";
	unsigned long iEterPackSecurityKey = 0;

	for (int iter = 0; iter < (sizeof(s_strEterPackSecurityKey[key]) / sizeof(std::string)); ++iter)
	{
		sEterPackSecurityKey.append(s_strEterPackSecurityKey[key][iter]);
	}

	iEterPackSecurityKey = std::stoul(sEterPackSecurityKey);

	return iEterPackSecurityKey;
}
#endif

#ifdef __PACK_ENCRYPTION__
static unsigned long s_adwEterPackKey[] =
{
#ifdef __OBFUSCATE_KEYS__
	s_EncryptEterPackKey(0),
	s_EncryptEterPackKey(1),
	s_EncryptEterPackKey(2),
	s_EncryptEterPackKey(3)
#else
	45129401,
	92367215,
	681285731,
	1710201
#endif
};

static unsigned long s_adwEterPackSecurityKey[] =
{
#ifdef __OBFUSCATE_KEYS__
	s_EncryptEterPackSecurityKey(0),
	s_EncryptEterPackSecurityKey(1),
	s_EncryptEterPackSecurityKey(2),
	s_EncryptEterPackSecurityKey(3)
#else
	78952482,
	527348324,
	1632942,
	486274726
#endif
};
#else
static unsigned long s_adwEterPackKey[] =
{
#ifdef __OBFUSCATE_KEYS__
	s_EncryptEterPackKey(0),
	s_EncryptEterPackKey(1),
	s_EncryptEterPackKey(2),
	s_EncryptEterPackKey(3)
#else
	45129401,
	92367215,
	681285731,
	1710201
#endif
};

static unsigned long s_adwEterPackSecurityKey[] =
{
#ifdef __OBFUSCATE_KEYS__
	s_EncryptEterPackSecurityKey(0),
	s_EncryptEterPackSecurityKey(1),
	s_EncryptEterPackSecurityKey(2),
	s_EncryptEterPackSecurityKey(3)
#else
	78952482,
	527348324,
	1632942,
	486274726
#endif
};
#endif

 

It's not much, but it will surely catch the attention of a few people too.

Link to comment
Share on other sites

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.