Sending Packets

11/05/2012 03:45 somatando#331
Quote:
Originally Posted by Interest07 View Post
C# code I use for packet sending as follows

PacketSender class:

use as follows:
PHP Code:
//open process
IntPtr pr_processHandle MemFunctions.OpenProcess(pid);
//create new packetSender class for this process
PacketSender sendPacket = new PacketSender(pr_processHandle);

//send packet for toggling flymode for example:
sendPacket.useItem(10xCplayer.values.flyMountId); 
Memfunctions class:

i used these classes for test and my pw got crash (not report bug, just terminate process) PS: i changed real base and send packet address.
can someone help me?
------------------------
i discovered the problem is in createremotethread. when the debugger execute the createremotethread line pw get crashes.
But i don't know what is the solution
------------------------
Sorry for noob quests. I think I found the problem. I use the pwbr and i think the problem is in opcode. i wanna know how to find de sendpacketopcodeaddress for my pw... can someone help me? :D
thanks in advance
11/20/2012 01:13 Murmuring#332
Thats an very interesting Part i read here.
Did not read all 34 Pages, but that sound like you use the Ingame Functions with this.
So this can be used on any Ingame Function we may found an no need to inject them ?
Since i use asm code for Pick up Loot etc.

To Bad i found this Board and Info not some Months ago.
01/15/2013 08:02 ronald19#333
Quote:
Originally Posted by vuduy View Post
Looks fine to me. It might be better to wait until the targetID is registered before executing the skills; you can also measure the server's latency while waiting as well. Example:

Code:
public long DoSetTarget(uint targetID)
{
	var stream = new MemoryStream();
	stream.Write(BitConverter.GetBytes(0x2), 0, 2);
	stream.Write(BitConverter.GetBytes(targetID), 0, 4);
	byte[] data = stream.ToArray();
	SendPackage(data);
	Stopwatch timer = Stopwatch.StartNew();
	while (timer.ElapsedMilliseconds < 5000)
	{
		// Check for TargetID to show up
		if (Self.TargetId == targetID) break;
		Thread.Sleep(10);
	}
	return timer.ElapsedMilliseconds / 2;
}
i am so confused how to convert that to C++ ?

i already try but still error.
01/15/2013 16:50 Interest07#334
Quote:
Originally Posted by ronald19 View Post
i am so confused how to convert that to C++ ?

i already try but still error.
Prolly a good idea to post your attempt so people can actually see what you did wrong ;)
01/21/2013 09:04 raymamat05#335
omg i dont understand what is this use for.. and where to get it.. what is the function??>. how to use???... blurrrr
01/21/2013 17:41 Interest07#336
Quote:
Originally Posted by raymamat05 View Post
omg i dont understand what is this use for.. and where to get it.. what is the function??>. how to use???... blurrrr
When you want to create a bot or similar tools, you generally want your client to perform certain actions. In order to do those actions you need to find the function ingame so you can call it from your process. Instead of finding a separate function for every action, it is easier to call the function that sends packets to the server as every action has to come through this function.

This way you need to only locate one function and determine the structure of the packets, which hardly ever change.
02/02/2013 17:39 santa777#337
Dear for all Member at this forum..... :)
I have a problem to write code for buying or selling multiple items...
especially for above 4 different items....
for example ..
for buy item .. $packet_size use formula = (8 + 12 * nDifferent items),,,
if i put the $packet_size from above formula..
.it will crash the client


can anyone help me....... :)
02/04/2013 13:05 nashua100#338
Quote:
lPacket.len := 50;
lPacket.buf[0] := $25;
lPacket.buf[1] := $00;

lPacket.buf[2] := $01;
lPacket.buf[3] := $00;
lPacket.buf[4] := $00;
lPacket.buf[5] := $00;

lPacket.buf[6] := $28;
lPacket.buf[7] := $00;
lPacket.buf[8] := $00;
lPacket.buf[9] := $00;

Fillmemory(@lPacket.buf[10], 24, $00);

lPacket.buf[34] := $01;
lPacket.buf[35] := $00;
lPacket.buf[36] := $00;
lPacket.buf[37] := $00;

copymemory(@lPacket.buf[38], @ID, sizeof(Cardinal));
copymemory(@lPacket.buf[42], @Shopindex, sizeof(Cardinal));
copymemory(@lPacket.buf[46], @Number, sizeof(Cardinal))

How About,more then 128 byte packet,what code to write 128 byte packet...can any one help?
02/04/2013 15:12 Sᴡoosh#339
Get creative...

Code:
procedure TMain.SendReforgePacket;
begin
Self.Buffer.Flush;
Self.Buffer.WriteWord(37); //25 00
Self.Buffer.WriteInt(58);  //3A 00 00 00
Self.Buffer.WriteInt(145); //91 00 00 00
Self.Buffer.WriteInt(0);   //00 00 00 00
Self.Buffer.WriteInt(Self.GetRecipieID(Self.ReforgeItemID));
Self.Buffer.WriteInt(MOMORIAL_COINS);
Self.Buffer.WriteInt(ROUND_SHIELD_MEDAL);
Self.Buffer.WriteInt(DAMASCENE_ORE);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryIDWhereMinNumber(MOMORIAL_COINS,90));
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryIDWhereMinNumber(ROUND_SHIELD_MEDAL,9));
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryIDWhereMinNumber(DAMASCENE_ORE,3));
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(Self.ReforgeItemID);
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryID(Self.ReforgeItemID));
Self.Buffer.WriteByte(7); //wtf
Self.PWAction.SendPointerPacket(@Self.Buffer.Buffer[0],Self.Buffer.Bufferlength);
end;
02/04/2013 15:52 nashua100#340
Sorry Swoosh..but when i buy item use buypacket,its normally working if $packet size under 128byte ,when $packet size above 128 byte,,it will crash the client....can You help me Swoosh...
02/04/2013 18:42 Sᴡoosh#341
That's because length is generally written as a packed Dword/CUINT. This means everything under 0x80 is written as a literal, while everything over 0x80 is encoded differently.
02/04/2013 19:34 nashua100#342
so..it means ...i cant send packet over 0x80 with (sendpacket function) as the usual i use ?
if cannot...how i write it......can You tell me ...Swoosh....Txs before
02/04/2013 19:37 Sᴡoosh#343
You can, you just need to send differently encoded data. If somebody else feels the need to share this, go ahead, but I won't.
02/05/2013 19:30 nashua100#344
Ok Swoosh...THANKS for ur reply...
02/06/2013 17:04 belobrk#345
So, can anyone please translate the main subject here? I ain't no programmer or anything related but I'd still like to know how would I make a good use of this 35 pages o info. It'd be much appreciated :D