Sign in to follow this  
Followers 0
crackcomm

C++ to AutoIt

9 posts in this topic

Hey, can anyone help me with translate something from C++ to AutoIt ?

void MakeLoginPacket(char* LoginPacket, unsigned long newXTeaKey[4], unsigned int ClientVersion, unsigned int ClientOS, string accname, string accchar, string accpassword, char connectionRequest[5])
{
    char PacketBuffer[MAXBUFFER];
    int accnameLen, acccharLen, accpasswordLen, tempChecksum;
    TibiaCrypt crypt;
        
    PacketBuffer[0] = 0x89;     //packet size
    PacketBuffer[1] = 0x00;

    PacketBuffer[2] = 0x0A;     //game server type

    memcpy(&PacketBuffer[3], &ClientOS, 2);     //OS, 1 = linux, 2 = windows

    memcpy(&PacketBuffer[5], &ClientVersion, 2);   //client version

    PacketBuffer[7] = 0x00;     //white byte, here starts the RSA encryption

    memcpy(&PacketBuffer[8],&newXTeaKey[0],4);    //and add it to the buffer
    memcpy(&PacketBuffer[12],&newXTeaKey[1],4);
    memcpy(&PacketBuffer[16],&newXTeaKey[2],4);
    memcpy(&PacketBuffer[20],&newXTeaKey[3],4);

    PacketBuffer[24] = 0x00;    //player = 0, 1 = GM

    accnameLen = accname.length();      //account name
    memcpy(&PacketBuffer[25], &accnameLen, 2);
    memcpy(&PacketBuffer[27], accname.c_str(), accnameLen);

    acccharLen = accchar.length();      //chracter name
    memcpy(&PacketBuffer[27+accnameLen], &acccharLen, 2);
    memcpy(&PacketBuffer[29+accnameLen], accchar.c_str(), acccharLen);

    accpasswordLen = accpassword.length();      //account password
    memcpy(&PacketBuffer[29+accnameLen+acccharLen], &accpasswordLen, 2);
    memcpy(&PacketBuffer[31+accnameLen+acccharLen], accpassword.c_str(), accpasswordLen);

    //fill the packet request info
    memcpy(&PacketBuffer[31+accnameLen+acccharLen+accpasswordLen], &connectionRequest[0], 5);

    crypt.SetRSAKey((char*)TibiaRSAKey);
    crypt.RSAEncrypt(&PacketBuffer[7], 128);        //crypt the packet with the RSA key

    memcpy(&LoginPacket[0],&PacketBuffer[0],2);     //add the checksum
    tempChecksum = crypt.adler((uint8_t*)&PacketBuffer[2],133);
    memcpy(&LoginPacket[2],&tempChecksum,4);
    memcpy(&LoginPacket[6],&PacketBuffer[2],200);
}

Sorry for my English.

Share this post


Link to post
Share on other sites



What do you need this for?

Yeah, it might be easier to just write new AutoIt code for it.


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

That's making packets which i will send to server to login my character. (I'm writing game "client" in AutoIt but i dont know c++ to translate this part of code.)


Sorry for my English.

Share this post


Link to post
Share on other sites

Game client? Thought that was supposed to be a human and guess you are referring to a BOT?

Anyways ... have fun and come back when you have an Autoit3 question, not a "make a script for me because I do not understand the C++ code I found on the internet."


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Nope, not Bot, client.

I just want somebody can explain me functions etc.


Sorry for my English.

Share this post


Link to post
Share on other sites

Where i should try ?


Sorry for my English.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0