QuestionConsole Which Sends Packets With 1 Click ?

Posts 1–12 of 12 · Page 1 of 1
Console Which Sends Packets With 1 Click ?
Hey guys,
I am new to C++, I would like to create a program which sends multiple "Packets" with 1 click of a button, the only problem is I do not know how to do, if anyone can show me- I would be truly grateful. The idea behind it, is that when activated, it will Purchase and Sell items to make gold. One of my friends told me I need to "Loop through every bag slot and send a packet" but I do not really know how to do this, if anyone could take my code and just do 1 part of it so I can learn from it, thankx - Cadbury
Code:
void SellItem(int nBagNum, int nBagSlot, int nAmount)
{
	BYTE* tmp = new BYTE[5];

	*reinterpret_cast<WORD*>(tmp) = 0x0703;
	*static_cast<BYTE*>(tmp + 2) = nBagNum;
	*static_cast<BYTE*>(tmp + 3) = nBagSlot;
	*static_cast<BYTE*>(tmp + 4) = nAmount;

	SendPacket(tmp, 5);

	delete[] tmp;
}
Here are the Packets which I want sent,
 
Packets

These are sent to NPC the items
03 07 01 00 FF
03 07 01 01 FF
03 07 01 02 FF
03 07 01 03 FF
03 07 01 04 FF
03 07 01 05 FF
03 07 01 06 FF
03 07 01 07 FF
03 07 01 08 FF
03 07 01 09 FF
03 07 01 0A FF
03 07 01 0B FF
03 07 01 0C FF
03 07 01 0D FF
03 07 01 0E FF
03 07 01 0F FF
03 07 01 10 FF
03 07 01 11 FF
03 07 01 12 FF
03 07 01 13 FF
03 07 01 14 FF
03 07 01 15 FF
03 07 01 16 FF
03 07 01 17 FF




03 07 02 00 FF
03 07 02 01 FF
03 07 02 02 FF
03 07 02 03 FF
03 07 02 04 FF
03 07 02 05 FF
03 07 02 06 FF
03 07 02 07 FF
03 07 02 08 FF
03 07 02 09 FF
03 07 02 0A FF
03 07 02 0B FF
03 07 02 0C FF
03 07 02 0D FF
03 07 02 0E FF
03 07 02 0F FF
03 07 02 10 FF
03 07 02 11 FF
03 07 02 12 FF
03 07 02 13 FF
03 07 02 14 FF
03 07 02 15 FF
03 07 02 16 FF
03 07 02 17 FF





03 07 03 00 FF
03 07 03 01 FF
03 07 03 02 FF
03 07 03 03 FF
03 07 03 04 FF
03 07 03 05 FF
03 07 03 06 FF
03 07 03 07 FF
03 07 03 08 FF
03 07 03 09 FF
03 07 03 0A FF
03 07 03 0B FF
03 07 03 0C FF
03 07 03 0D FF
03 07 03 0E FF
03 07 03 0F FF
03 07 03 10 FF
03 07 03 11 FF
03 07 03 12 FF
03 07 03 13 FF
03 07 03 14 FF
03 07 03 15 FF
03 07 03 16 FF
03 07 03 17 FF


03 07 04 00 FF
03 07 04 01 FF
03 07 04 02 FF
03 07 04 03 FF
03 07 04 04 FF
03 07 04 05 FF
03 07 04 06 FF
03 07 04 07 FF
03 07 04 08 FF
03 07 04 09 FF
03 07 04 0A FF
03 07 04 0B FF
03 07 04 0C FF
03 07 04 0D FF
03 07 04 0E FF
03 07 04 0F FF
03 07 04 10 FF
03 07 04 11 FF
03 07 04 12 FF
03 07 04 13 FF
03 07 04 14 FF
03 07 04 15 FF
03 07 04 16 FF
03 07 04 17 FF


03 07 05 00 FF
03 07 05 01 FF
03 07 05 02 FF
03 07 05 03 FF
03 07 05 04 FF
03 07 05 05 FF
03 07 05 06 FF
03 07 05 07 FF
03 07 05 08 FF
03 07 05 09 FF
03 07 05 0A FF
03 07 05 0B FF
03 07 05 0C FF
03 07 05 0D FF
03 07 05 0E FF
03 07 05 0F FF
03 07 05 10 FF
03 07 05 11 FF
03 07 05 12 FF
03 07 05 13 FF
03 07 05 14 FF
03 07 05 15 FF
03 07 05 16 FF
03 07 05 17 FF
My example of the layout of the packet.
03 07
01 00 FF. Self-assigned Bytes | The Inventory Bag | The Slot Number | The Number of items(In bytes)
 
Buying the Item
02 26 42 31 5F 42 63 61 6C 6C 30 30 30 35 00 00 00 00 3D AA AE 07 00 , this is more complicated to explain, but basically it buys an item from a merchant. If you can, how can I send THIS same packet 20 times
We need more information, Are you talking about sending a packet over a network? Or does this have something to do with pipes and IPC?

If you want to send packets over a network (on windows) You can use raw sockets. When you use raw sockets windows will only establish an IP connection with your peer, and leaves the actual packets to you. If you want *full* control (eg. also build your own Internet packets) take a look at winpcap, it allows you to receive and send raw packets.

On linux raw sockets are also an option, and I believe that raw packet sending is natively supported.
Ohh no, it is for a game, where I want to send packets before it gets encrypted and sent to the server. If it is needed, i can post the source for the packet editor if it would help ?
No that wont help. Just explain what your problem is exactly.

This is what I think you're trying to do:

There's a game you want to cheat on by editing and sending your packets through a tcp/ip connection to the server.
Because of your last comment ("I want...the server") I'm also assuming you have a program ready to encrypt your data, or you're doing it by hand.

What I'm not clear on is what exactly is your problem. Are you having trouble sending the packet? Or are you having trouble constructing it?
As .:SCHiM:. has explained, we need more information. It really depends on the network protocol used by your target (it will be either UDP or TCP most likely) If you're working with UDP you can send packets over to the server without first establishing a connection and thus you may be able to (in theory) throw your packet in when ever you like (though this really depends on the communication layer the server has created over top of the UDP protocol...) but with TCP you cannot just create a new connection(as the server will probably treat you as a new client...) you will need to get a handle of the previously opened connection. Also, you can't just throw data into the communication stream where ever you like - you should make sure that you aren't interrupting another transaction.

Its probably easier just to get a hold of the parameters by hijacking send or if you can get access to a higher-level communication routine that would be even better.
For this one I have to be Ingame for it to work, and I am not so sure on how the packet is sent, but @.::SCHiM::. i think you have a pretty good Idea

EDIT: Basically there already is a Packet Editor for the game I play, but I have to individually put the packets in to send it and what I want to create here is something that does the exact same, but sents only the packets that I have put up there, in mass
Quote Originally Posted by cadbury2010 View Post
For this one I have to be Ingame for it to work, and I am not so sure on how the packet is sent, but @.::SCHiM::. i think you have a pretty good Idea

EDIT: Basically there already is a Packet Editor for the game I play, but I have to individually put the packets in to send it and what I want to create here is something that does the exact same, but sents only the packets that I have put up there, in mass
The packet sniffer probably works by detouring routines in the winsock library (there are a thousand other ways to do it, but that is the simplest and most likely method in userland...) The packet sniffer should tell you what method its using to get the packets - should be in configuration or something.
Mmm, tbh I do not have a proper understanding of how it works, didnt know it would be this hard lol, but would you know how to loop a packet through the code I pasted at the intro ?

EDIT: "The hack was written in C++. For IDE I use Visual Studio 2010.(hack referring to the persons original hack which sent packets, although I wanted to spread on one of the things they did)" and "Loop through every bag slot and send a packet." quotes from what the person answered me with before, it might help with the programming of this? Idk....
Ah, so you need help constructing the packets? In that case, here's how you build them:

Code:
void SellItem(int nBagNum, int nBagSlot, int nAmount)
{
	BYTE* tmp = new BYTE[5];

	*reinterpret_cast<WORD*>(tmp) = 0x0703;
	*static_cast<BYTE*>(tmp + 2) = nBagNum;
	*static_cast<BYTE*>(tmp + 3) = nBagSlot;
	*static_cast<BYTE*>(tmp + 4) = nAmount;

	SendPacket(tmp, 5);

	delete[] tmp;
}

void PacketLoop( char cNItems ){

int nBag = 0, nSlot = 0;

for( nBag = 0; nBag != 0xFF; nBag++ ) {                 // loop through all the bags
     for( nSlot = 0; nSlot != 0xFF; nSlot++) {            // loop through all slots for each bag
           SellItem(  nBag, nSlot, (int)cNItems );        // sell this slot
     }
}
return;
}
See if you can make this work for you. And a tip: If you're not even sure yourself what it is you're trying to do, how can you expect others to it for you? You should spend more time researching the game/case/program you're trying to hack before copying the work and/or ideas of others. Most of the time (especially in public forums) 'hack' source code is sloppy and the implementation is often wrong. In some cases this is because the author only wanted to provide a working example to illustrate his/her ideas. But more often then not it's just a crappy C+P job of an even older public release. So try to create your own ideas and/or techniques to use.
using socket:

Code:
#include <winsock2.h>
#pragma comment( lib, "wsock32.lib" )

void StartSocket()
{
	return WSAStartup( MAKEWORD(2,2), &WsaData ) == NO_ERROR;
}

void CloseSocket()
{
	WSACleanup();
}

int main32_t ()
{
	StartSocket();

	DWORD NoBlock = 1;
	int IntWinSock = NULL;

	IntWinSock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );

	if ( IntWinSock <= 0 )
	{
		MessageBox(0,"Error to create socket",0,MB_ICONERROR);
		return false;
	}

	unsigned int a = xxx; // Your IP
    unsigned int b = xxx;
    unsigned int c = xxx;
    unsigned int d = xxx;
    WORD port = xxx; //YOUR PORT

	unsigned int AddressDestination = ( a << 24 ) | ( b << 16 ) | ( c << 8 ) | d;
    unsigned short PortDestination = Port;

	sockaddr_in Address;
    address.sin_family = AF_INET;
    address.sin_addr.s_addr = htonl( AddressDestination );
    address.sin_port = htons( PortDestination );

    if ( bind( handle, (const sockaddr*) &Address, sizeof(sockaddr_in) ) < 0 )
    {
        MessageBox(0,"Error to bind socket",0,MB_ICONERROR);
        return false;
    }

	if ( ioctlsocket( IntWinSock, FIONBIO, &NoBlock ) != 0 )
	{
		MessageBox(0,"Error to noBlocking socket",0,MB_ICONERROR);
		return false;
	}

	char PacketData[256];
	char PacketSize[256];
	do{
		int SendPacket = sendto( IntWinSock, (const char*)PacketData, PacketSize,
                             0, (sockaddr*)&Address, sizeof(sockaddr_in) );

		if ( SendPacket != PacketSize )
		{
			char BufferOverround[256];
			sprintf(BufferOverround, "Error to send packet, Error value: %d", SendPacket);
			MessageBox(0,BufferOverround,0,MB_ICONERROR);
			return false;
		}

	}while(GetAsyncKeyState(VK_CTRL));

	CloseSocket();
}
Thank you @DirecTX_ and @.:SCHiM:. , but I get this one error everytime I try compile my finished product and I get this for every script I make, even the defualt ones lol
My error.png18 KB · 12 downloads
Quote Originally Posted by cadbury2010 View Post
Thank you @DirecTX_ and @.:SCHiM:. , but I get this one error everytime I try compile my finished product and I get this for every script I make, even the defualt ones lol
Fix you Visual Studio installation. Might solve it, but I am not sure.
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Need help?