Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2008, 08:33 PM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default What packet encryption is the EQEMU implementing?

I'm trying to decode text being sent from one user to another inside of the game world. It seems that all chat has been encrypted for transmission. Can anyone point me in the right direction as to where this encryption / decryption algorithms are in the EQEMU source. Thanks
Reply With Quote
  #2  
Old 05-01-2008, 11:01 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

The data steam is not encrypted to my knowledge, portions of it are compressed using zlib however.
Reply With Quote
  #3  
Old 05-01-2008, 11:41 PM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

where is the portion of the code where sending the packets across networks is actually done. I'm specifically trying to locate chat packets (tells, shouts, ooc, etc..). Anything would be very helpful.
Reply With Quote
  #4  
Old 05-02-2008, 12:17 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I don't know offhand but I'll try to find it later tonight for ya.
Reply With Quote
  #5  
Old 05-02-2008, 12:47 AM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

if you find out then you are an angel
Reply With Quote
  #6  
Old 05-06-2008, 05:13 PM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

Quote:
Originally Posted by KLS View Post
I don't know offhand but I'll try to find it later tonight for ya.
Any update on finding the code segments that deal with the compression? thanks
Reply With Quote
  #7  
Old 05-06-2008, 11:51 PM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

So youre trying to be able to spy on peoples conversations. How nice. Should we call you George?

People have an expectation of privacy in their communications, so you could be openning yourself to legal issues and if someone does bust you spying on them, I hope they do persue it to the fullest extent of the law.

Its bad enough our goverment is spying on us without any regards to our rights and you adding to that isnt going to gain you any friends.
Reply With Quote
  #8  
Old 05-07-2008, 04:02 AM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

Quote:
Originally Posted by MNWatchdog View Post
So youre trying to be able to spy on peoples conversations. How nice. Should we call you George?

People have an expectation of privacy in their communications, so you could be openning yourself to legal issues and if someone does bust you spying on them, I hope they do persue it to the fullest extent of the law.

Its bad enough our goverment is spying on us without any regards to our rights and you adding to that isnt going to gain you any friends.
I swear people like you seem to exist in every division of this world, be it forums, family, or in the classroom.

Thank you so much for you near-sighted thoughts. How about you stick to just playing the game and not wasting my time you moron.

There are many different reasons to want to monitor chat packets on the EMU than just petty privacy theft .... (what in the world would be so important and sensitive that I would want to monitor on an emulated game anyways)! Use your wits if you have any, seriously.

Since, you lack the ability to conceive of a non-malicious purpose for monitoring chat packets; allow me to guide you to enlightenment.

I'm building a /tell based bot program to help those who want private servers and don't want to go through all the pains of macro managing multiple EQ Clients to form full groups.

But again, clearly you know my intentions better than my own. Go somewhere else to make nonsensical false allegations against people (a great place for that is in political forums since you were so ready to make a direct correlation between video gaming ethics and federal government policy) and spare us all.

Thanks


Anyways, does anyone have any intelligent thoughts on the matter now that my intentions have been made clear?
Reply With Quote
  #9  
Old 05-07-2008, 04:38 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I'm not 100% sure, but I think this is what you're looking for:

common/EQPacket.cpp:
Code:
  390 void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
  391 {
  392 	if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
  393 		int Key=DecodeKey;
  394 		unsigned char *test=(unsigned char *)malloc(size);
  395 		buffer+=2;
  396 		size-=2;
  397 
  398         	int i;
  399 		for (i = 0 ; i+4 <= size ; i+=4)
  400 		{
  401 			int pt = (*(int*)&buffer[i])^(Key);
  402 			Key = (*(int*)&buffer[i]);
  403 			*(int*)&test[i]=pt;
  404 		}
  405 		unsigned char KC=Key&0xFF;
  406 		for ( ; i < size ; i++)
  407 		{
  408 			test[i]=buffer[i]^KC;
  409 		}
  410 		memcpy(buffer,test,size);
  411 		free(test);
  412 	}
  413 }
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #10  
Old 05-07-2008, 05:13 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

People who have a need to do what your talking about already do it with Macroquest most likely.

Ive been involved in some rather personal conversation while sitting around in EQ, after all, the name of the game is EVER QUEST, which often means tons of down time and I for one dont want you being able to listen in.

Excuse me for wanting some sense of privacy when I sending PRIVATE messages.

What your wanting to do should be done using a command prefaced with a # like all specialty commands and certainly does not need for you to modify the current chat system so you can tap into it.
Reply With Quote
  #11  
Old 05-07-2008, 05:13 AM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

Quote:
Originally Posted by AndMetal View Post
I'm not 100% sure, but I think this is what you're looking for:

common/EQPacket.cpp:
Code:
  390 void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
  391 {
  392 	if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
  393 		int Key=DecodeKey;
  394 		unsigned char *test=(unsigned char *)malloc(size);
  395 		buffer+=2;
  396 		size-=2;
  397 
  398         	int i;
  399 		for (i = 0 ; i+4 <= size ; i+=4)
  400 		{
  401 			int pt = (*(int*)&buffer[i])^(Key);
  402 			Key = (*(int*)&buffer[i]);
  403 			*(int*)&test[i]=pt;
  404 		}
  405 		unsigned char KC=Key&0xFF;
  406 		for ( ; i < size ; i++)
  407 		{
  408 			test[i]=buffer[i]^KC;
  409 		}
  410 		memcpy(buffer,test,size);
  411 		free(test);
  412 	}
  413 }
You are amazing my friend ... the ironic thing is that I just found this about 20 minutes ago. Seems that the answer to my question only leaves me with more questions since I have only programmed in Java/C#.

Question: It's using a decode key which, at a glance, isn't a predefined constant. What is the decode key they are using ... does it change constantly or do they have a constant being applied to the method call?

Anyways, thanks for the help. Great work!
Reply With Quote
  #12  
Old 05-07-2008, 05:34 AM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

Quote:
Originally Posted by MNWatchdog View Post
People who have a need to do what your talking about already do it with Macroquest most likely.

Ive been involved in some rather personal conversation while sitting around in EQ, after all, the name of the game is EVER QUEST, which often means tons of down time and I for one dont want you being able to listen in.

Excuse me for wanting some sense of privacy when I sending PRIVATE messages.

What your wanting to do should be done using a command prefaced with a # like all specialty commands and certainly does not need for you to modify the current chat system so you can tap into it.
Again, you fall to see. I don't want to modify the source and add 'specialty commands' as you phrase it.

As for macro quest, unless I am mistaken you have to still pay for that piece of software. Even if I don't have to pay, I want to make a bot program that meets MY needs, there is no rule that says I can't re-invent the wheel plus some, as you are making it seem.

You make it sound like there is a specific path towards my goal and that I'm veering off. I am implementing my application in the way I deem best. NO it wouldnt be best to implement it using specialty commands ... that would require adding bot functionality into the source ... I'm not even going to attempt to explain to you why that would be utterly complicated.

Having speciality commands would only solve the problem of execution, but not interpretation or management.

Out of curiousity, sense you have such a vast carnal knowledge of how to implement bots, once I implement A speciality command for casting a spell with a given spellid ... then what? What about self casting, target casting, group casting, or wait ... what if I wanted to actually allow for the functionality of reiterative statements such as "Heal me EVERY 5 seconds so i don't have to keep spamming the ingeniuous speciality cmd macro button"

Take some time to think it through, I am making a fully functional bot that can be controlled with a specific (my design and implementation) Command Language that is simplistic and powerful.

Adding a thousand specialty commands to the source along with bot functionality is not the correct approach in any way, the emu is a server not convoluted, add as you go, piece of software, it needs to remain as light-weight as possible. The only viable option, since the EQ Client doesn't have specific cmds that I need to facilitate this endevour, is to monitor chat packets to garner update info. and send synthetic packets to the server to issue commands that have no front-end access in the EQ Client.

I never knocked you for wanting a sense of privacy. I bashed on you because you simply made assumptions about my intentions. I frankly don't care if you think I'm out to monitor the entire world. That is your problem not mine.

Please stop posting back to me to salvage what is left of your e-penis. I'm interested in making a bot program and unless you have something worth-while to contribute then leave this thread alone. Thanks
Reply With Quote
  #13  
Old 05-07-2008, 05:49 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Did a little more digging, and came up with this:

common/EQStream.cpp:
Code:
 1003 void EQStream::Process(const unsigned char *buffer, const uint32 length)
 1004 {
 1005 static unsigned char newbuffer[2048];
 1006 uint32 newlength=0;
 1007 	if (EQProtocolPacket::ValidateCRC(buffer,length,Key)) {
 1008 		if (compressed) {
 1009 			newlength=EQProtocolPacket::Decompress(buffer,length,newbuffer,2048);
 1010 		} else {
 1011 			memcpy(newbuffer,buffer,length);
 1012 			newlength=length;
 1013 			if (encoded)
 1014 				EQProtocolPacket::ChatDecode(newbuffer,newlength-2,Key);
 1015 		}
 1016 		if (buffer[1]!=0x01 && buffer[1]!=0x02 && buffer[1]!=0x1d)
 1017 			newlength-=2;
 1018 		EQProtocolPacket *p = MakeProtocolPacket(newbuffer,newlength);
 1019 		ProcessPacket(p);
 1020 		delete p;
 1021 		ProcessQueue();
 1022 	} else {
 1023 		_log(NET__DEBUG, _L "Incoming packet failed checksum" __L);
 1024 		_hex(NET__NET_CREATE_HEX, buffer, length);
 1025 	}
 1026 }
Key is defined a few times throughout EQStream.cpp, and it seems to be somewhat dependent on the type of packet. For the most part, I think it's defined as 0:
Code:
   53 	Key=0;
Here is an example of where it isn't:
Code:
  299 #ifndef COLLECTOR
  300 			Key=0x11223344;
  301 			SendSessionResponse();
  302 #endif

  310 			Key=ntohl(Response->Key);

  802 	Response->Key=htonl(Key);
I'd dig deeper, but it's late for me. Good luck with figuring out the encoding
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #14  
Old 05-07-2008, 12:42 PM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

Genius! Someone give this man a medal! Awesome I'm going to gather some packets and see if I can run them through this algorithm and I
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:42 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3