Jump to content
McKay Development

How does one go about reversing the payload you intercept from the GC if you know all the pieces?


Acorn Eyes
 Share

Recommended Posts

I hate to ask this because it seems like a pretty simple thing to figure out but I've been banging my head here.

Trying to figure out the proper payload to send to

k_EMsgGCNameBaseItem 

using this as a starting point

k_EMsgGCNameItem 

I've used NetHook2 to capture the payload sent when naming a base item, as well as when naming a storage casket.

NameItem was 0100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000B873BC9706000000003F00 and NameBaseItem was 0100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCD63BD97060000003B000000003F00

I was able to extract the part of the payload that's the ID of the base item (3B000000) thing is I have no earthly idea what that is as a unsigned 64 int.

the base item ID is 17293822569102704699, which is longer than the typical item id (12345678901). There's no way that's what's being sent to GC because the id being sent is shorter: 8 bytes instead of 16.

The beginning of the id is also irrelevant honestly, it was the exact same on a different account (172938225691)

my latest attempt has been:

GlobalOffensive.prototype.nameBaseItem = function(nameTagId, baseItemId, name) {
    let buffer = new ByteBuffer(14 + Buffer.byteLength(name), ByteBuffer.LITTLE_ENDIAN);
    buffer.writeUint64(nameTagId);
    buffer.writeUint64(baseItemId);
    buffer.writeByte(0x00); // unknown
    buffer.writeCString(name);
    this._send(Language.NameBaseItem, null, buffer);
};

I've tried: 17293822569102704699, 02704699, 4699, and 4001 (the def_index) as the baseItemId.

 

Appreciate any help!

Link to comment
Share on other sites

Nevermind I'm incredibly dumb. Flipping hexadecimal takes each 'pair' and reverses the order. So 3B000000 is actually 0000003B. The decimal version of which is 59. 59 is the def_index of the Terrorist knife, as expected.

The correct function would be

/**
 * Rename a stock item in your inventory using a name tag.
 * @param {int} nameTagId
 * @param {int} def_index
 * @param {string} name
 */
GlobalOffensive.prototype.nameBaseItem = function(nameTagId, def_index, name) {
	let buffer = new ByteBuffer(14 + Buffer.byteLength(name), ByteBuffer.LITTLE_ENDIAN);
	buffer.writeUint64(nameTagId);
	buffer.writeUint32(def_index);
	buffer.writeByte(0x00); // unknown
	buffer.writeCString(name);
	this._send(Language.NameBaseItem, null, buffer);
};

This has been tested and confirmed working.

Link to comment
Share on other sites

1 hour ago, Acorn Eyes said:

I was able to extract the part of the payload that's the ID of the base item (3B000000) thing is I have no earthly idea what that is as a unsigned 64 int.

That's a 32-bit int, not a 64-bit one. Each hex character is only half a byte (F = 15, FF = 255). It's equal to 55 decimal: Buffer.from('3B000000', 'hex').readUInt32LE(0)

1 hour ago, Acorn Eyes said:

the base item ID is 17293822569102704699, which is longer than the typical item id (12345678901). There's no way that's what's being sent to GC because the id being sent is shorter: 8 bytes instead of 16.

I don't have any idea where you got this 17293822569102704699 value from.

1 hour ago, Acorn Eyes said:

my latest attempt has been:

GlobalOffensive.prototype.nameBaseItem = function(nameTagId, baseItemId, name) {
    let buffer = new ByteBuffer(14 + Buffer.byteLength(name), ByteBuffer.LITTLE_ENDIAN);
    buffer.writeUint64(nameTagId);
    buffer.writeUint64(baseItemId);
    buffer.writeByte(0x00); // unknown
    buffer.writeCString(name);
    this._send(Language.NameBaseItem, null, buffer);
};

You need to use writeUint32 for the base item ID since it's a 32-bit value. Your buffer size of 14 bytes + length of the name is correct. As for what exactly that value corresponds to, I'd say that it's very likely the item's def_index. If the item you renamed is a knife, that seems like confirmation to me.

Edit: Looks like you beat me to the realization! 😉

Edited by Dr. McKay
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...