Jump to content

Recommended Posts

Posted

Hello,

I’m working on decrypting the Init packet that the server sends to the client during login. This packet is treated specially and contains the Blowfish keys used to encrypt and decrypt subsequent packets. Although it isn’t encrypted irreversibly and should be reversible, I haven’t succeeded yet.

My goal is to extract the Blowfish key to decrypt certain client packets without disrupting the normal session flow. I can inject a DLL to sniff the packets, and with that I plan to develop a module that extends the client’s functionality. For example, after logging in, this module would capture all the data the client receives (character data, etc.). Additionally, it could listen for real-time server events, enabling integrations with Discord SDKs or other systems, thereby expanding Lineage 2’s capabilities.


Init packet(0x00) LoginServer.

Currently in the java Cores I checked there is no decode function for this package, only encript.

Posted (edited)

 

https://github.com/gawric/Guide-L2Unity/blob/main/Guide/Pakets/Blowfish/General description.md

 

Perhaps you will find it useful

piece of encryption and decryption code from Acis Interlude

 

I transferred these methods to Unity c# and everything works fine

 

https://ibb.co/DHhP0JYr

 

I think the first 2 bytes are the packet size.
Third byte packet id
And then the information itself

 

It's all there in l2j servers

 

Edited by Gawric
Posted
8 hours ago, Gawric said:

 

https://github.com/gawric/Guide-L2Unity/blob/main/Guide/Pakets/Blowfish/Descripción general.md

 

Quizás te resulte útil

fragmento de código de cifrado y descifrado de Acis Interlude

 

Transferí estos métodos a Unity C# y todo funciona bien.

 

https://ibb.co/DHhP0JYr

 

Creo que los dos primeros bytes representan el tamaño del paquete.
El tercer byte, el ID del paquete.
Y luego, la información en sí.

 

Todo está ahí en los servidores l2j

 



 

Hello first of all thank you for your prompt response and the time you are taking to read this and answer, I am aware that not everyone takes the time and for that I thank you.


On the other hand the specific problem is when decrypting this package and being able to parse it, 

In some places it says that it is only encrypted with xor, in others that only a static blowfish is used and in others that both are used in the order of xor and then blowfish, this is the problem in spite of being able to see the encryption mechanisms of the servers, I can not put together the function that reverses this encryption to obtain the keys sent by the init packet.

 

Thanks for your time, hopefully the rest can contribute something because it is a super useful module to extend any functionality to the client and I will publish it in an opensource way when it is finished.

Posted (edited)
2 hours ago, rufi said:



 

Hello first of all thank you for your prompt response and the time you are taking to read this and answer, I am aware that not everyone takes the time and for that I thank you.


On the other hand the specific problem is when decrypting this package and being able to parse it, 

In some places it says that it is only encrypted with xor, in others that only a static blowfish is used and in others that both are used in the order of xor and then blowfish, this is the problem in spite of being able to see the encryption mechanisms of the servers, I can not put together the function that reverses this encryption to obtain the keys sent by the init packet.

 

Thanks for your time, hopefully the rest can contribute something because it is a super useful module to extend any functionality to the client and I will publish it in an opensource way when it is finished.

I open the l2j server and see

1. XOR->NewCrypt.encXORPass(raw, offset, size, Rnd.nextInt()); ---> XOR can also be taken from l2j
2. _staticCrypt.crypt(raw, offset, size);
----->
Quote

private void encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
{
    int xl = bytesTo32bits(src, srcIndex);
    int xr = bytesTo32bits(src, srcIndex + 4);
     xl ^= P[0];
    for (int i = 1; i < ROUNDS; i += 2)
    {
      xr ^= func(xl) ^ P[i];
      xl ^= func(xr) ^ P[i + 1];
    }
      xr ^= P[ROUNDS + 1];
      bits32ToBytes(xr, dst, dstIndex);
      bits32ToBytes(xl, dst, dstIndex + 4);
 }

 

 

I scroll down the code and see this code

 

----->

Quote

/**
     * Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset. The input will be an exact multiple of our blocksize.
     * @param src
     * @param srcIndex
     * @param dst
     * @param dstIndex
     */
    private void decryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
    {
        int xl = bytesTo32bits(src, srcIndex);
        int xr = bytesTo32bits(src, srcIndex + 4);
        xl ^= P[ROUNDS + 1];
        for (int i = ROUNDS; i > 0; i -= 2)
        {
            xr ^= func(xl) ^ P[i];
            xl ^= func(xr) ^ P[i - 1];
        }
        xr ^= P[0];
        bits32ToBytes(xr, dst, dstIndex);
        bits32ToBytes(xl, dst, dstIndex + 4);
    }

 

===================================================

 

I'm transferring this code to C#

Quote

private void decryptBlock(byte[] src, uint srcIndex, byte[] dst, uint dstIndex)
   {
       uint xl = BytesTo32bits(src, srcIndex);
       uint xr = BytesTo32bits(src, srcIndex + 4);
       xl ^= P[ROUNDS + 1];
       for (int i = ROUNDS; i > 0; i -= 2)
       {
           xr ^= F(xl) ^ P[i];
           xl ^= F(xr) ^ P[i - 1];
       }
       xr ^= P[0];
       Bits32ToBytes(xr, dst, dstIndex);
       Bits32ToBytes(xl, dst, dstIndex + 4);
   }

 

And in c# I first do decryptBlock and then XOR and everything works, I get the package

and the first 2 bytes have already been removed as far as I remember

 

loginXor.png

This only works for the login server.

The blowfish encryption key is used static, it can be found in the l2j server

 

Edited by Gawric

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • all your doubts ask chatgpt, also ask what you could do yourself hahaha
    • This post originally appeared on MmoGah. Odin: Valhalla Rising is an ambitious open-world MMORPG developed with Unreal Engine 4, offering breathtaking visuals and immersive gameplay. I will share everything you need to know before starting it.     Re-rolling In Odin, re-rolling isn't a practical strategy. Unlike most gacha games, where it's common to reset for better initial pulls, Odin focuses heavily on long-term growth. The earlier you begin playing and developing your character, the more advantages you'll gain over time. Instead of spending your efforts on re-rolling for ideal equipment, it's better to dive in and start progressing right away.   Server Selection Before starting your character, selecting a server is a crucial step. Since Odin doesn't support cross-server gameplay, coordinating with your friends, family, or guildmates is essential to ensure everyone creates their characters on the same server. Take the time to plan with your group beforehand. After deciding on a server, your next major choice will be picking a class.   Class Breakdown Odin features four primary starting classes: Warrior, Sorceress, Rogue, and Priest. Each class comes with its own distinct playstyle and unique strengths, so choose wisely, as your selection is permanent. However, even free-to-play players can create up to three characters on one server, giving you the flexibility to try different options and find the one that matches your preferences.   Quest and Leveling Once your character is created, your initial objective is to work through the main questline. This acts as both a tutorial and a method for early leveling. Odin simplifies the process with a convenient quest button that handles navigation, starts dialogues, and even enables auto-combat. This user-friendly feature allows beginners to grasp the basics of the game without feeling overloaded.   Auto Combat and No Kill-steal Mode Auto combat is an essential feature in Odin, enabling your character to battle monsters autonomously. This system allows you to effortlessly gain experience and loot, even while you're busy studying, cooking, or unwinding. To optimize its use, activate the no-kill-steal mode. This setting prevents your character from targeting monsters already engaged by other players, helping you avoid conflicts or potential PvP situations. However, if a quest becomes difficult to complete due to overcrowded areas, you can temporarily disable this mode to overcome the obstacle and move forward.   Item Management and Potions Don't overlook the importance of consumable items, especially health potions. These can be purchased, along with buffs, from general merchants in villages, and they play a crucial role in improving your combat efficiency and ensuring your survival. Always aim to keep a full stock of HP potions and carry buffs that boost attack, defense, or regeneration in batches of 5-10 for convenience.   Once you've acquired your consumables, assign them to your quick slots located at the bottom center of the screen. Swiping down activates these slots, and items like potions will automatically be used when necessary, so you don't need to worry about them mid-battle. Keep a close eye on your potion reserves, as running out during a tough fight could leave you vulnerable before reaching a safe area. In the early stages of the game, it's better to return to town for a restock if supplies are low rather than risking unnecessary defeats. You can also enable notifications to alert you when your health or potion count drops too low—a handy feature for staying prepared if your attention is elsewhere.   Leveling and AFK Farming Once you've mastered the fundamentals, the next step is to focus on leveling up and enhancing your character. Gaining levels is your primary source of progression early on, as it not only improves your stats but also unlocks crucial game features and new abilities. At this stage, simply sticking to the main questline provides a reliable and efficient way to gain experience.   Additionally, Odin includes a highly convenient idle feature called AFK mode. This allows your character to keep farming for resources and experience even when the game is closed, with a maximum duration of 8 hours per day. It's an excellent option for making progress while you're asleep, commuting, or otherwise occupied.   Gear Upgrades When the time comes to improve your gear, the initial focus should be on upgrading from normal-grade equipment to high-grade items. These provide significantly better stats and can be enhanced further to increase their effectiveness. Enhancing requires enhancement stones and gold, but it's important to stay within the safe enhancement limit. Attempting upgrades beyond this limit carries the risk of destroying your gear if the enhancement fails. Stick to safe enhancements until you've gained more experience and accumulated spare equipment to mitigate potential losses.   Skill Purchases When you've accumulated enough gold, it's time to invest in skills. These are crucial for enhancing your combat abilities and provide key benefits tailored to your class, whether it's increasing damage output, improving healing capabilities, or adding valuable utility. Before purchasing, ensure your character meets the level prerequisites for each skill. Your ultimate goal will be progressing through and completing the main questline in Midgard as you continue to develop your character.   Unlocking Jotenheim Finishing this milestone grants you access to the next region, Jetunheim, unlocking a variety of new content and challenges. This marks your first significant achievement in the game and is an essential early objective to strive for as you progress.   Joining a Guild Joining a guild is a highly beneficial step in Odin. Guilds not only provide opportunities for social interaction and group activities but also offer passive bonuses that can significantly enhance your gameplay. Even if you're not particularly active socially, being part of any guild is advantageous. The guild feature becomes accessible after completing Chapter 4, Quest 19 of the main story.   Guilds provide various perks, including buffs that scale with the guild's level. Additionally, you can earn guild coins by contributing through donations, quest completions, or regular logins. These coins can be exchanged for valuable rewards, such as epic-grade armor. The more you actively contribute to your guild, the greater the overall benefits for both you and the guild itself. Joining early and staying involved will undoubtedly strengthen your progression in the game.   Conclusion Here is the end of this beginners' guide. I hope these tips will help you level fast in Odin.
    • You can actually make a pseudomount code in your server, that way it can be displayed.. a friend made it for the l2off and i extended it a bit.. if u have l2off i might be able to help u on that
    • Discord : utchiha_market Telegram : https://t.me/utchiha_market Auto Buy Store : https://utchihamkt.mysellauth.com/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...