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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Tell a Škoda 1.4 driver that a Škoda 1.8 is faster — and suddenly, you’re riding a mini race car. On the way, they might share random stories — gas prices, the perfect BBQ recipe, or how passengers once called them “just for a minute.” Maybe even how someone left a suitcase full of money in their car once.     The important part? You’ll get there on time, no delays.     Vibe SMS works just as fast — messages fly like that driver who just heard their 1.8 isn’t the fastest.     🌐 https://vibe-sms.net/ 📲 https://t.me/vibe_sms  
    • ⚔️ The Grand Opening Has Arrived! ⚔️ In just a few hours the gate to the eternal battlefield will be open and the war between Order and Chaos will be set once again ! Its time to claim your destiny 🔥 👉 Register now and join the fight today! 🌐 https://l2ovc.com register now : https://l2ovc.com The gates are open the war between Order and Chaos has officially started! 🔥 Join the battlefield NOW and claim your destiny in Order vs Chaos! 💥 Don’t fall behind your faction needs you. ➡️ https://l2ovc.com  
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock