Receiving package, Sending package

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
eXtreem
Noob
Noob
Posts: 3
Joined: 26 Jun 2009, 10:56
Noob?: No

Receiving package, Sending package

#1 Post by eXtreem »

Hi guys, i'm actually totally new to development, but i already got a working idea, and now i just wonder if there are enought possibilities in openkore to implement, release it for me.

Here is the problem:
Im playing on low populatet private server. A GM seems already noticed i used a bot, so they added a "Enter Password" feature for my account. It looks like follows: after i log in and can see me on the map, an ingame Window appers, where is written: Please enter the password "Elunium is needed!" to active your sessin or something like that.
Ofc the bot does not handle this ingame window and just stay on the map writing "Stuck" to the console.

My working Idea:
I have turned on wireshark and captured the packets between me and the server, so here is the server package with password request:

Code: Select all

0000   00 e0 4d a9 9d 7b 00 0f b5 55 a5 b2 08 00 45 00  ..M..{...U....E.
...
0370   a0 00 85 c7 2d 00 01 b4 00 0f 00 9d 9c 8e 06 5b  ....-..........[
0380   47 61 69 61 5d 00 b4 00 3d 00 9d 9c 8e 06 50 6c  Gaia]...=.....Pl
0390   65 61 73 65 20 65 6e 74 65 72 20 74 68 65 20 66  ease enter the f
03a0   6f 6c 6c 6f 77 69 6e 67 20 70 61 73 73 77 6f 72  ollowing passwor
03b0   64 20 74 6f 20 73 74 61 72 74 20 70 6c 61 79 69  d to start playi
03c0   6e 67 00 b4 00 1c 00 9d 9c 8e 06 22 45 6c 75 6e  ng........."Elun
03d0   69 75 6d 20 69 73 20 6e 65 65 64 65 64 22 00 b4  ium is needed"..
03e0   00 34 00 9d 9c 8e 06 59 6f 75 20 68 61 76 65 20  .4.....You have 
03f0   31 20 74 72 69 65 73 20 72 65 6d 61 69 6e 69 6e  1 tries remainin
0400   67 20 74 6f 20 67 65 74 20 69 74 20 72 69 67 68  g to get it righ
0410   74 2e 00 78 00 00 9d 9c 8e 06 00 00 00 00 00 00  t..x............
...
and here is my respond with corret answer:

Code: Select all

0000   00 0f b5 55 a5 b2 00 e0 4d a9 9d 7b 08 00 45 00  ...U....M..{..E.
0010   00 42 5f ae 40 00 80 06 e3 e7 c0 a8 00 02 d0 64  .B_.@..........d
0020   26 11 09 8e 14 01 96 70 02 eb 35 14 07 f4 50 18  &......p..5...P.
0030   ff b1 b7 54 00 00 d5 01 1a 00 9d 9c 8e 06 45 6c  ...T..........El
0040   75 6e 69 75 6d 20 69 73 20 6e 65 65 64 65 64 00  unium is needed.
so as i can see
"d5 01 1a 00 9d 9c 8e 06 45 6c 75 6e 69 75 6d 20 69 73 20 6e 65 65 64 65 64 00" stands for "Elunium is needed" and the correct confirmation.

So i wrote a simple macro (using macro plugin):

Code: Select all

automacro password {
console /Stuck during route/
call enterPassword
}

macro enterPassword {
do send d5 01 1a 00 9d 9c 8e 06 45 6c 75 6e 69 75 6d 20 69 73 20 6e 65 65 64 65 64 00
}
after triggering thsi macro, my bot ai able to move and play again. ok the next problem is: if the password is entered false, i get disconnnected. so if i'm lucky and the password they ask is "Elunium is needed!" i countinue playing.


And here is my question:
How can i capture packets using openkore to scan them for containing the srting "please enter the following password" and tell openkore what to do? Which are these source files? So i actually need to write a simple if else if esle if statement for captured packets.

Any idea how to make it?

Regards,
eXtreem

eXtreem
Noob
Noob
Posts: 3
Joined: 26 Jun 2009, 10:56
Noob?: No

Re: Receiving package, Sending package

#2 Post by eXtreem »

so i hope not to get misunderstood: i actually dont want to write a macro for this issue, but modify the source code, i just need some tips in whick modules i can handle this functionality

Bibian
Perl Monk
Perl Monk
Posts: 416
Joined: 04 Apr 2008, 03:08

Re: Receiving package, Sending package

#3 Post by Bibian »

if the packet is the same every time all you need to do is use your client to fill it in once, sniff how its send and then make a macro to duplicate the packets or plugin.
Or you might be able to use the reactOnActor or the other reactOn plugins, you'll have to test those yourself.

eXtreem
Noob
Noob
Posts: 3
Joined: 26 Jun 2009, 10:56
Noob?: No

Re: Receiving package, Sending package

#4 Post by eXtreem »

Hmm, thx for your reply, however i just continued developing my idea. here is the solution, how to make a macro with all passwords and to turn off packet debugging after it was triggered. so if you have the same problem as i had here is the way you go:


i open src/commands.pm and added to sub initHandlers {...} a line

Code: Select all

initHandlers {
        ...
	pdebug			   => \&cmdPdebug,
        ...
}
then i wrote the "sub" to sepcify what this command shall do^^

Code: Select all

sub cmdPdebug {
	my (undef, $arg1) = @_;
	if ($arg1 eq "on") {
		configModify("debugPacket_received", 1);
		message T("Showing debug informations about the incomming packets\n"), "success";
	} elsif ($arg1 eq "off") {
		configModify("debugPacket_received", 0);
		message T("No more showing debug informations about the incomming packets\n"), "success";
	}
}
now using macro plugin, modify you macros text files. here is what you have to add to it:

Code: Select all

automacro loot {
console /Have fun!/
run-once 1
call login
}

macro login {
do c !autoloot
do pdebug on

automacro passwordOrideconIsNeeded {
console /Oridecon is needed/
call enterPasswordOrideconIsNeeded
}
macro enterPasswordOrideconIsNeeded {
do send d5 01 1a 00 9d 9c 8e 06 45 6c 75 6e 69 75 6d 20 69 73 20 6e 65 65 64 65 64 00
do pdebug off
}

automacro passwordGaiaFTW {
console /Gaia FTW/
call enterPasswordGaiaFTW
}
macro enterPasswordGaiaFTW {
do send d5 01 11 00 65 69 8f 06 47 61 69 61 20 46 54 57 00
do pdebug off
}

automacro passwordEluniumIsNeeded {
console /Elunium is Needed/
call enterPasswordEluniumIsNeeded
}
macro enterPasswordEluniumIsNeeded {
do send d5 01 1a 00 65 69 8f 06 45 6c 75 6e 69 75 6d 20 69 73 20 6e 65 65 64 65 64 00
do pdebug off
}

automacro passwordOrideconIsAwesome {
console /Oridecon is Awesome!/
call enterPasswordOrideconIsAwesome
}
macro enterPasswordOrideconIsAwesome {
do send d5 01 1d 00 65 69 8f 06 4f 72 69 64 65 63 6f 6e 20 69 73 20 41 77 65 73 6f 6d 65 21 00
do pdebug off
}

}
those "send d5 01 1d 00 65 69 8f 06 4f 72 69 64 65 63 6f 6e 20 69 73 20 41 77 65 73 6f 6d 65 21 00" i've got with wireshark just by clicking on the datatext within the packege the password was send.

HF

Locked