On 2/14/2018 at 10:39 PM, hplus0603 said:
The library calls to send and receive data for UDP are typically sendto() and recvfrom(). You should be able to find those in the disassembly. If it's on Windows, it may be something like WSARecvFrom() and WSASendTo() instead, which exist in parallel with recvfrom() and sendto(). You should be able to see whichi functions call those functions, and figure out which functions in turn call those functions, and so forth, to figure out how packets are generated and sent, and received and decoded. If you have working executables for both sides, that should be totally doable, although you do need to learn assembly and probably C level programming to do it.
Also, can you run the server binary that you have? If so, you can attach with a debugger, and simply put a breakpoint where packets are sent/received, and trace your way backwards. At that point, it's not that much different from debugging a program you wrote yourself, assuming you wrote the program in assembly and forgot all about it afterwards :-)
While it is true that some protocols will negotiate keys, and some will even use a key exchange protocol and perhaps sign the keys with public/private crypto, my experience has been that most games don't bother. Games aren't particularly attractive targets for man-in-the-middle attacks; instead, the main problem for them is cheating, and cheaters have full control of the client machine and thus can attack the network protocol outside any attempt to encrypt data. Thus, might as well save the effort and debugging pain and not encrypt it.
/// Call sendto (UDP obviously)
/// \param[in] s the socket
/// \param[in] data The byte buffer to send
/// \param[in] length The length of the \a data in bytes
/// \param[in] ip The address of the remote host in dotted notation.
/// \param[in] port The port number to send to.
/// \return 0 on success, nonzero on failure.
int SendTo( SOCKET s, const char *data, int length, const char ip[ 16 ], unsigned short port );
This is the function the server library uses to send the UDP data. Since i'm reverse engineering this, couldn't I save the "const char *data" to a file and see exactly what the server is sending to the client, before it "encrypts" it? Also I looked at the assembly code for the server and client as far as the sendto() and recvfrom() functions go but i couldn't figure out how exactly I could decode the UDP packet data when being captured live across the server and client. I've looked at where the data values are stored such as "exi' and "esi" etc., how how their moved around/calculated, but I can't see how that would tell me how it encrypts the data. There was a "__security_cookie" function that was called, however just like the other functions, I could't find out how it encrypts the data other then maybe generating a number (Checksum possibly??) that is used to encrypt the data every time it's sent. I've looked at several videos explaining the packets and assembly language and while i am learning how they function it doesn't help me find out how to decode the information i want. I guess, in a reworded version of my overall question, is it possible to decode the series of packets I captured above (in the links) to 'human readable'?
Here's a link to the website with documentation of the information i'm trying to collect (even though it's already documented I'd like to learn how to do it myself). http://lu-docs.readthedocs.io/en/latest/packets.html
Here's a sample format of what I'd like to find. (It's the exact data being sent in the captured packets I have [although mine are still encrypted] however i'm not sure where they found the "53-01-00-00", and what that means as far as the packet itself, and how they categorized the other data being sent into the sections they have [such as "L:512" and the "u32" or "u16")
To Auth
[53-01-00-00] (login info)
[wstring] - Username
[L:82] - Password, wstring
[u16] - COMLANG, language id
[u8] - ???, could be a count for something
(maybe the following info)? it could also be an identifier for the platform (I encountered something like that in the code for values 2 and 1: “mac” or “pc”), seems to be always 1
[L:512] - process memory info of the client, wstring
(see GetProcessMemoryInfo() on MSDN for more info, the values get constructed to a wstring in the client code)
[L:256] - client graphics card (driver) info, wstring
[u32] - SYSTEM_INFO.dwNumberOfProcessors
[u32] - SYSTEM_INFO.dwProcessorType
[u16] - SYSTEM_INFO.dwProcessorLevel
[u16] - SYSTEM_INFO.dwProcessorRevision
[u32] - ???, doesn’t seem to be part of the above/below struct
(but is apparently written as constant (0x114) in the packet?)
(the following structures can be skipped or does the client abort packet creation if that happens?)
[u32] - OSVERSIONINFO.dwMajorVersion
[u32] - OSVERSIONINFO.dwMinorVersion
[u32] - OSVERSIONINFO.dwBuildNumber
[u32] - OSVERSIONINFO.dwPlatformId
Thanks for the help. Understand most likely it's stuff I still have to dive into myself but if you know anything more based the information I have that'd be great. Either way I got a point in the right direction