OpenKore / openkore

A free/open source client and automation tool for Ragnarok Online
http://openkore.com
Other
1.29k stars 1.05k forks source link

tRO Mega Thread - All tRO issues here only #221

Closed aecuto closed 7 years ago

aecuto commented 8 years ago

how can i fix this problem??

today my server has update new EAC, my openkore can login to map server but after 1-3 second my openkore has disconnect from map server, please help me or notice me about this problem.

ps. i'm newbie for programmer :D ps2. i'm from Free bot page....

kittinan commented 8 years ago

@unknown-item how you find key (EDB9D10AB84C9A2E05E38997C2F64A29) ?

danmadoon commented 8 years ago

@unknown-item give me step by step pls. I have a old one that was work before and then? what i have to do next plsssssss for X3

zuroba commented 8 years ago

@unknown-item i use you code from above but it's have dc and not working from my x3 bot or about crpytkey?

pr0di9yexe commented 8 years ago

Encrypted MID : [0436]->[3A41] / KEY : [0x4D8E]->[0x3E77] Sent packet : 0436 [19 bytes]
Timeout on Map Server, connecting to Account Server...

need help

scream1ng commented 8 years ago

@kittinan disassemble ragexe

as70873463 commented 8 years ago

@unknown-item It perfect for me !! Thanks very much

cydiath commented 8 years ago

@as70873463 Pls upload send.pm sir.. Thxxx krub

danmadoon commented 8 years ago

@as70873463 pls tell me how to way you learn. Thank you ^^

forall01 commented 8 years ago

@unknown-item

I follow on you code is don't work for me. this substr($msg, 2, length($msg) - 2 - 24) where to add it.

patjung555 commented 8 years ago

it work thx u so much

dekaze commented 8 years ago

@unknown-item Thank you for your information. Now I already run in Xkore0 but in Xkore3 dose not work because program disconnect to server after connect with mapserver around 5 sec.

unknown-item commented 8 years ago

@pr0di9yexe @zuroba don't use crpytkey, it does not exist in tRO. x3 need extra fix(undo HMAC), my code fix only x0, read my posts.

@Poonjaroen @dekaze this goes to where xkore handles packets sent from client, need some extra work on determining when to turn HMAC on or off. Please do it yourself or have somebody else familiar with this to do it.

@kittinan you need to debug a running game client with EAC code injected to find this key.

forall01 commented 8 years ago

@dekaze

Your X0 is worked ?, Can you tech me pls.

pr0di9yexe commented 8 years ago

@unknown-item many thanks. it's work for me. Hali Hydra!!

dekaze commented 8 years ago

@Poonjaroen Copy and past source code from @unknown-item in send.pm and re-run OPK.

zuroba commented 8 years ago

@unknown-item ok now my working on x0 but x3 it's hard to fix

sorry guy

forall01 commented 8 years ago

for the digest folder where to past it 1). openkore/digest 2).openkore/network/digest.

dekaze commented 8 years ago

@Poonjaroen at openkore/src

nono911 commented 8 years ago

@unknown-item after stripe the packets send by client. which .pm file i should change or modify

cydiath commented 8 years ago

New Erorr sir.....

23 bytes Sep 14 18:34:48 2016 0> 6A 00 77 00 00 00 00 00 00 00 00 00 00 00 00 00 j.w............. 16> 00 00 00 00 00 00 00 ....... ยกเลิกการติดต่อกับ (103.55.55.12:6900)...ยกเลิกการติดต่อแล้ว Selected server: Thor The server has denied your connection for unknown reason (119).

patjung555 commented 8 years ago

@cydiath X3 orX0

forall01 commented 8 years ago

@dekaze

I'm add the digest is done , and put copy code on send.pm is done, But don't work , you can show me the send.pm file ?

unknown-item commented 8 years ago

fine, I'll write some x3 test code for you, but I have no way to test it.

XKoreProxy.pm in sub serverDisconnect, add: $self->{client_hmac} = 0; before: return $self->{server}->serverDisconnect();

in sub modifyPacketOut, add:

if($self->{client_hmac} && length($msg) > 28) {
    $msg = substr($msg, 2, length($msg) - 2 - 24)
}

before: my $switch = uc(unpack("H2", substr($msg, 1, 1))) . uc(unpack("H2", substr($msg, 0, 1)));

add:

if ($switch eq "0436" || $switch eq "0072") {
    $self->{client_hmac} = 1;
}

before: return $msg;

give it a try, but only AFTER you get x0 working already.

cydiath commented 8 years ago

@patjung555 me use x0.

ninenite commented 8 years ago

@unknown-item i used send.pm and digest.zip you but it error

Can't locate Digest/HMAC_MD5.pm in @INC (@INC contains: src src/deps D:/cc/bot kobold/mmmmmaa4/src/deps D:/cc/bot kobold/mmmmmaa4/src D:/cc/bot kobold/mmmmmaa4 C:\Users\ninenite\AppData\Local\Temp\pdk-ninenite-2204\ .) at src/Network/Send.pm line 39. BEGIN failed--compilation aborted at src/Network/Send.pm line 39. Compilation failed in require at src/Misc.pm line 42. BEGIN failed--compilation aborted at src/Misc.pm line 42. Compilation failed in require at openkore.pl line 59. BEGIN failed--compilation aborted at openkore.pl line 59.

Press ENTER to exit.

forall01 commented 8 years ago

@unknown-item

for x0

  1. copy - openkore/src/Digest
  2. on send.pm file.

use Digest::HMAC_MD5 qw(hmac_md5);

sub sendToServer { my ($self, $msg) = @_; my $net = $self->{net};

shouldnt(length($msg), 0);
return unless ($net->serverAlive);

my $messageID = uc(unpack("H2", substr($msg, 1, 1))) . uc(unpack("H2", substr($msg, 0, 1)));

my $hookName = "packet_send/$messageID";
if (Plugins::hasHook($hookName)) {
    my %args = (
        switch => $messageID,
        data => $msg
    );
    Plugins::callHook($hookName, \%args);
    return if ($args{return});
}

#encrypt(\$msg, $msg);

# Packet Prefix Encryption Support
#$self->encryptMessageID(\$msg);#++++

$self->encryptMessageID(\$msg);

####### begin sample handling of hmac packets
if ($messageID eq $self->{packet_lut}{map_login}) {
    $self->{hmac_enc} = 1;
    $self->{seq} = 0;
    $self->{flag} = 1;
} elsif ($self->{net}->getState() != Network::IN_GAME) {
    $self->{hmac_enc} = 0;
    $self->{seq} = 0;
} elsif($self->{hmac_enc}) {
    $msg .= pack('V', $self->{flag}) . pack('V', $self->{seq}++);
    $msg .= hmac_md5($msg, pack('H*', 'EDB9D10AB84C9A2E05E38997C2F64A29'));
    $msg = pack('v', length($msg) + 2) . $msg;
}
####### end sample handling of hmac packets

$net->serverSend($msg);
$bytesSent += length($msg);

if ($config{debugPacket_sent} && !existsInList($config{debugPacket_exclude}, $messageID) && $config{debugPacket_include_dumpMethod} < 3) {
    my $label = $packetDescriptions{Send}{$messageID} ?
        "[$packetDescriptions{Send}{$messageID}]" : '';
    if ($config{debugPacket_sent} == 1) {
        debug(sprintf("Sent packet    : %-4s    [%2d bytes]  %s\n", $messageID, length($msg), $label), "sendPacket", 0);
    } else {
        Misc::visualDump($msg, ">> Sent packet: $messageID  $label");
    }
}

if ($config{'debugPacket_include_dumpMethod'} && !existsInList($config{debugPacket_exclude}, $messageID) && existsInList($config{'debugPacket_include'}, $messageID)) {
    my $label = $packetDescriptions{Send}{$messageID} ?
        "[$packetDescriptions{Send}{$messageID}]" : '';
    if ($config{debugPacket_include_dumpMethod} == 3 && existsInList($config{'debugPacket_include'}, $messageID)) {
        #Security concern: Dump only when you included the header in config
        Misc::dumpData($msg, 1, 1);
    } elsif ($config{debugPacket_include_dumpMethod} == 4) {
        open my $dump, '>>', 'DUMP_LINE.txt';
        print $dump unpack('H*', $msg) . "\n";
    } elsif ($config{debugPacket_include_dumpMethod} == 5 && existsInList($config{'debugPacket_include'}, $messageID)) {
        #Security concern: Dump only when you included the header in config
        open my $dump, '>>', 'DUMP_HEAD.txt';
        print $dump sprintf("%-4s %2d %s%s\n", $messageID, length($msg), 'Send', $label);
    }
}

}

unknown-item commented 8 years ago

you should put Digest with folder, into either: root folder of openkore/ or src/deps/

@Poonjaroen $self->encryptMessageID(\$msg); this line is from original code, not my addition.

ninenite commented 8 years ago

@unknown-item thanks a lot sir , it use for me / can i subscribe you ?

forall01 commented 8 years ago

@unknown-item

sitll error

Incoming data left in the buffer:

28 bytes Sep 14 18:51:40 2016 0> 71 00 32 65 07 00 70 72 74 5F 66 69 6C 64 30 35 q.2e..prt_fild05 16> 2E 67 61 74 00 00 67 37 37 4B 2E 27 .gat..g77K.' Disconnecting (103.55.55.71:4500)...disconnected Received character ID and Map IP from Character Server ----------Game Info---------- Char ID: 32 65 07 00 (484658) MAP Name: prt_fild05.gat MAP IP: 103.55.55.75

MAP Port: 10030

Closing connection to Character Server Connecting to Map Server... Connecting (103.55.55.75:10030)... connected Timeout on Map Server, connecting to Account Server...

firstsozaa commented 8 years ago

talk to npc and disconnected what to do

ninenite commented 8 years ago

@firstsozaa i same put new send.pm and digest talk to npc and dc

firstsozaa commented 8 years ago

@unknown-item pls help us everything work perfect the only problem is when we talk to npc we disconnected

lungkeemao commented 8 years ago

@unknown-item Big thanks for your X3 test code, by the way, it doesn't work

windhamwong commented 8 years ago

oh well, the thread is too long now. @unknown-item I am working on tRO as well, not just twRO. I mentioned twRO because we have similar things and we were working on these things as well. So, what you have mentioned is, the C32 key is working in tRO now. May I ask do tRO has 3 different keys that changes every week for encrypting the Send packets? I have a working copy of OpenKore for tRO, and we have toolsets for extracting data from client. What I really need now is the login pattern and key extraction. I see you have solved the issue of login, may I have some details please? I can migrate to the repo and move on to other issues you guys see in tRO.

disable37743 commented 8 years ago

@unknown-item Thanks you, i manage to make it work.

unknown-item commented 8 years ago

@lungkeemao find out why it doesn't work and maybe have it fixed.

@windhamwong tRO have no cryptkeys yet, and sync_ex packets are also original(not mixed). They just use different map packet format, not cryptkeys, no need for extraction. Login packet is generally the same, I've showed you on my previous post. Some fork above also have working code.

firstsozaa commented 8 years ago

@unknown-item bro dont skip my question pls T_T

ninenite commented 8 years ago

@firstsozaa bro , i think new recvpackets npc talk becuz dont talk npc it work

unknown-item commented 8 years ago

@firstsozaa your problem is related to packet switch, maybe your bot is sending it wrong, we are discussing about HMAC now. Try capture packets from client and compare them and figure out why.

udomsaph commented 8 years ago

untitled2 for x3 we can't walk and an environment in game can't load caused sent packet : 035F

unknown-item commented 8 years ago

@udomsaph try my x3 test code and capture + debug packets, see what went wrong.

zuroba commented 8 years ago

you x3 code @unknown-item 1473855880493

udomsaph commented 8 years ago

0A76 80 0001 60 0001 92 0A7C 196

i tried you x3 code, i got from UnknowSend.txt

unknown-item commented 8 years ago

@udomsaph try change if ($switch eq "0436" || $switch eq "0072") { into if ($switch eq "0436") {

also check if this is correct in tRO.pm: '0A76' => ['master_login', 'V Z40 a32 C', [qw(version username password_rijndael master_version)]],

0A7C in recvpackets should be -1 (variable packet length) you may want to turn on debugPacket_clientSend and see if bot is handling client packets correctly.

windhamwong commented 8 years ago

@unknown-item thanks for the info. We extracted the shuffled packet header list as well. It would solve a lot of unknown packet issues right now.

@unknown-item do you have your post or a complete src for me please? I can do the migration and fix.

cydiath commented 8 years ago

@unknown-item Oh im. Complete fix. Thx verry sir

but. erorr talk with npc pls fix it sir.. Thx. for lesson

windhamwong commented 8 years ago

0437 0089 actor_action 0438 0113 skill_use 035F 0085 character_move 0360 007E sync 0361 009B actor_look_at 0362 009F item_take 0363 00A2 item_drop 0364 00F3 storage_item_add 0365 00F5 storage_item_remove 0366 0116 skill_use_location 0368 0094 actor_info_request 0369 0193 actor_name_request 0819 0819 buy_bulk_buyer 0817 0817 buy_bulk_request 0815 0815 buy_bulk_closeShop 0811 0811 buy_bulk_openShop 0802 0802 booking_register 0436 0072 map_login 02C4 02C4 party_join_request_by_name 0202 0202 friend_request 022D 022D homunculus_command 023B 023B storage_password

Looks like it has no NPC talk.

firstsozaa commented 8 years ago

@windhamwong so what sould we do

windhamwong commented 8 years ago

@firstsozaa I need a copy of the src first. @unknown-item 's work looks great I think.

cydiath commented 8 years ago

@windhamwong Add Code in file? recvpackets or not..?