Help to rewrite moving packet

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

Moderator: Moderators

Message
Author
flo4t
Noob
Noob
Posts: 3
Joined: 09 Nov 2009, 19:25
Noob?: Yes

Help to rewrite moving packet

#1 Post by flo4t »

Hi all.
Please, help me to rewrite the sendMove sub to make it work on server with kind-of antibot protection.
There is some code has been patched to exe, and a small function in external dll.
My first goal is to pack a valid packet like EXE does.
And please help me to rewrite some assembler instructions to perl analogues.
Here is the example.

x,y - coordinates in unsigned int.

A7 00 37 33 00 47 0C 00
1)A7 00 - is a packet "header"
2)37 33 - two last chars from strange 6-char string (random?) example: cfae96 (not from this example packet)
3)47 - encrypted X coordinate.
Algorithm:
SAR X(dword),2 (perhaps binary shift to right by 2.)
4)0C - encrypted Y coordinate.
Algorithm:
SAR Y(dword),4
AND Y(lower byte of Y coordinate),0x3F (wtf how to work with only lower byte on perl?)
SHL X(lower byte of X coordinate),6
OR Y(lower byte of Y coordinate),X(lower byte of X coordinate)
now we have 1-byte encrypted Y

that's all for EXE's encryption.

Thanks in advance for answers

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Help to rewrite moving packet

#2 Post by kLabMouse »

flo4t wrote:Hi all.
AND Y(lower byte of Y coordinate),0x3F (wtf how to work with only lower byte on perl?)
$a = 0xFFFF;
$a = $a & 0x00FF;
now $a is just a lower byte.

the upper:
$a = 0xFFFF
$a = $a >> 8
$a = $a & 0xFF
now $a is just an upper byte.

you can use pack/unpack tricks too.

flo4t
Noob
Noob
Posts: 3
Joined: 09 Nov 2009, 19:25
Noob?: Yes

Re: Help to rewrite moving packet

#3 Post by flo4t »

kLabMouse wrote:
flo4t wrote:Hi all.
AND Y(lower byte of Y coordinate),0x3F (wtf how to work with only lower byte on perl?)
$a = 0xFFFF;
$a = $a & 0x00FF;
now $a is just a lower byte.

the upper:
$a = 0xFFFF
$a = $a >> 8
$a = $a & 0xFF
now $a is just an upper byte.

you can use pack/unpack tricks too.
thank you for response!

And can I work with string as array? Like that
$str = "test";

$str[0] == "t"

kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

Re: Help to rewrite moving packet

#4 Post by kali »

Yes, Perl strings are just arrays of chars.
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

flo4t
Noob
Noob
Posts: 3
Joined: 09 Nov 2009, 19:25
Noob?: Yes

Re: Help to rewrite moving packet

#5 Post by flo4t »

how can I output something to console from sendMove sub? printf() and debug() (in config.txt I set debug to 1) do not working.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Help to rewrite moving packet

#6 Post by EternalHarvest »

flo4t wrote:how can I output something to console from sendMove sub? printf() and debug() (in config.txt I set debug to 1) do not working.
Log::message

Civis
Noob
Noob
Posts: 2
Joined: 29 Dec 2009, 17:39
Noob?: Yes

Re: Help to rewrite moving packet

#7 Post by Civis »

Hello. I'am noob in programming.
Can you explain me this algorithm in common language:
3)47 - encrypted X coordinate.
Algorithm:
SAR X(dword),2 (perhaps binary shift to right by 2.)
4)0C - encrypted Y coordinate.
Algorithm:
SAR Y(dword),4
AND Y(lower byte of Y coordinate),0x3F (wtf how to work with only lower byte on perl?)
SHL X(lower byte of X coordinate),6
OR Y(lower byte of Y coordinate),X(lower byte of X coordinate)
now we have 1-byte encrypted Y
Second question:

It's information about monster:
86 00 1B B0 8E 06 23 CC 52 3C CB 88 8C DC AE 02
Where is here monster id and what algorithm to get it?
Where is here monster location(x,y) and what algorithm to get it?

Civis
Noob
Noob
Posts: 2
Joined: 29 Dec 2009, 17:39
Noob?: Yes

Re: Help to rewrite moving packet

#8 Post by Civis »

up :cry:

Locked