Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya
You last visited: Today at 15:38

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Shaiya Packet Encryption ( Infos )

Discussion on Shaiya Packet Encryption ( Infos ) within the Shaiya forum part of the MMORPGs category.

Reply
 
Old   #1

 
elite*gold: 0
Join Date: Apr 2007
Posts: 2,394
Received Thanks: 6,644
Shaiya Packet Encryption ( Infos )

Ive just taken a look at the Shaiya Packet Encryption
and the encryption itself is fairly simple. The encryption
itself is a simple Xor routine and ill show you how you
can use that. However, i dont know yet how the
client currently is Creating the Xortable. Luckily
the Xortable is always at the same address
you can find the base Address in the Function call one
Call above the Send call. The start of that Function
looks like this ( Shaiya Encryption function ):

Code:
CMP BYTE PTR DS:[2242E21],0
E SHORT game.004010DF
CMP DWORD PTR DS:[2242E18],0
JNZ SHORT game.004010CA
MOV EAX,DWORD PTR SS:[ESP+8] 
PUSH ESI
PUSH EAX
MOV EAX,DWORD PTR SS:[ESP+C]
MOV ECX,EAX
MOV ESI,game.02242E28
CALL game.004051B0
MOV ESI,game.02242E28

This line is currently intresting for us. It moves the
base Address of the Xortable into ESI. So 0x2242E28 would
be the address. This Address + 0x104 is currently a
Packetcounter. This Counter is also used for the Encryption.
The Xortable starts at Xortable base address + 0x108.

So we have the following Addresses for our Encryption function:

0x2242F2C = Packetcounter
0x2242F30 = Xortable start

Now we can use the following function to
Encrypt our Packets:

Code:
int packetcounter = 0x2242F2C;
int Xortable = 0x2242F30;

char* encryptpacket( char * packet )
{
	int encryptcounter = *(int*)packetcounter;
        // ( how many packets have been encrypted yet )
	for( int i = 0; i < packetsize; ++i )
	{
		packet[i] ^= *(char*)( XorTable + i + 108 + encryptcounter );
	}
	encryptcounter += 1;
	*(int*)packetcounter = encryptcounter;
        return packet;
}
PS:

You can only use this Function after you have at least send
one Loginpacket ( this are the first Packets that gets encryted ).
Simply because when the First Packet is to be sent but the
Xortable isnt created yet, the Client will create it and encrypt the
Packet. I might be wrong at any point, i did not test this yet,
i was just bored and took a look at it with OllyDBG

regards
Wurstbrot123
wurstbrot123 is offline  
Thanks
10 Users
Old 07/15/2011, 15:12   #2
 
elite*gold: 0
Join Date: Aug 2010
Posts: 241
Received Thanks: 255
I could find that the function at 0x00404770 was writing to the Xortable memory address address that you had mentioned.
zargon05 is offline  
Thanks
1 User
Old 07/15/2011, 16:31   #3

 
elite*gold: 0
Join Date: Apr 2007
Posts: 2,394
Received Thanks: 6,644
I know where the function itself is ( it is currently in the same
big call for sending Packets ). But its a pretty big Routine
its probly a hell lot of work to reverse it completly.
Not sure if ill ever take a look at it. Anyway thank you
for Sharing
wurstbrot123 is offline  
Old 03/07/2013, 14:56   #4
 
elite*gold: 0
Join Date: Jul 2010
Posts: 8
Received Thanks: 0
@wurstbrot123 Have you found out how encryption works from the start? I see with WireShark when we first open the game, the server sends us a packet and the client sends another one back. They both have the same OP Codes I think, "01 a1". Could these packets be how the XorTable is created?
warekurt is offline  
Old 03/07/2013, 16:31   #5
 
elite*gold: 0
Join Date: Jun 2009
Posts: 29
Received Thanks: 10
Im not sure if its the same, but the ingame encryption algorithm (client side) contains 3 parts
XOR-Table (176 byte)
and two 128 bit XOR-Keys

the second key is used to actually encrypt the packet.
After the key is "consumed" (encryption counter is equal to key size), a new key is generated using the first key and the xor-table. At the end, the first key will be modified by adding 1 to it.

On which client version are your memory addresses based on?

hope that was helpful in any kind

,shiko
shikosan is offline  
Old 03/11/2013, 07:17   #6

 
elite*gold: 0
Join Date: Apr 2007
Posts: 2,394
Received Thanks: 6,644
When you look at the date i looked at it quiet a while
ago ( 2011 ) so i cant tell much about the current clients
and i dont remember what client Version it was back than
wurstbrot123 is offline  
Old 03/11/2013, 07:33   #7
 
elite*gold: 0
Join Date: Jul 2010
Posts: 8
Received Thanks: 0
Thanks, just wanted to know if you recorded any progress afterwards.
warekurt is offline  
Old 03/11/2013, 16:14   #8
 
elite*gold: 0
Join Date: Jun 2009
Posts: 29
Received Thanks: 10
whops, didnt look at the date hehe...

i got a working implementation of the ingame encryption/decryption algorithm. What im missing is the xor table creation part. im willing to trade my part for the xor table part.
shikosan is offline  
Old 03/11/2013, 16:38   #9
 
elite*gold: 0
Join Date: Jul 2010
Posts: 8
Received Thanks: 0
Well did you try the first 2 packets client and server exchanges? If you know every detail about encryption you could share and I'll see if I can find any relation with those 2 packets.
warekurt is offline  
Reply


Similar Threads Similar Threads
BOI Packet Encryption
09/28/2011 - Battle of the Immortals - 13 Replies
I've made some research about the packet encryption used in this game and I thought I'd share them. BOI uses a simple XOR-Algorithm. Each byte of a packet is being XORed with the value of the previous byte. The first byte of every packet indicates its length. Furthermore the first byte of the very first packet sent after the connection was established is being XORed with the value 0xCD. Example: Let's say the client sends this packet right after connecting to the server. 0x06 0xA7 0x57...
Shaiya Packet Encryption/Decryption
07/08/2010 - Shaiya - 5 Replies
Hey. I was trying to get this info reversing the client, but i think my skills aren't good enough for such task yet. I was wondering if somebody here could tell me how does Shaiya encrypts(for sending)/decrypts(receiving) packets. Please post also, how you found this info, cause i few like I wasted 5 days searching for the algorithm in reversing sessions. :mad:
Packet encryption.
06/22/2009 - Shaiya - 2 Replies
Not sure if anyone has tried making a proxy yet, other than the one that is stickied (which is injected and I imagine directly hooks the games send function bypassing the need for encryption?). Anyway, just curious if anyone knows what sort of encryption is being used on packets? US server for the record.
Packet encryption
09/19/2005 - Lineage 2 - 1 Replies
Hi,I'm trying to make a simple L2 bot, but i got stuck in begginning - in the packet encryption. I rewrote the l2j login thread sources (those about encryption) but it doesn't work. Has anyone any description of L2 packet encryption. And second question - what Init packet (server packet,nr. 0) means? I guess that it something related with encryption, but in l2j sources that packet content is hardcoded. Thanks for replies (if any ;) )



All times are GMT +1. The time now is 15:39.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.