Pettab_ Petinfo BLOB get info

08/28/2024 13:11 NerkoWoI#1
Hello , I need litlle help with PetBug find code :
Code:
CREATE DEFINER=`root`@`localhost` FUNCTION `getpetinteger`(PET_GET_ID BIGINT UNSIGNED, PET_GET_TYPE INT) RETURNS int(11)
    READS SQL DATA
    DETERMINISTIC
BEGIN
	DECLARE PET_VIT INTEGER UNSIGNED;
	DECLARE PET_INT INTEGER UNSIGNED;
	DECLARE PET_STR INTEGER UNSIGNED;
	DECLARE PET_SPR INTEGER UNSIGNED;
	DECLARE PET_DEX INTEGER UNSIGNED;
	SET PET_VIT = 0;
	SET PET_INT = 0;
	SET PET_STR = 0;
	SET PET_SPR = 0;
	SET PET_DEX = 0;
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+10,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+8,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+6,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+4,2)),16,10) INTO PET_VIT FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_VIT;
	ELSEIF PET_GET_TYPE = 2 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+50,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+48,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+46,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+44,2)),16,10) INTO PET_INT FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_INT;
	ELSEIF PET_GET_TYPE = 3 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+90,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+88,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+86,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+84,2)),16,10) INTO PET_STR FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_STR;
	ELSEIF PET_GET_TYPE = 4 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+130,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+128,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+126,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+124,2)),16,10) INTO PET_SPR FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_SPR;
	ELSEIF PET_GET_TYPE = 5 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+170,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+168,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+166,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+164,2)),16,10) INTO PET_DEX FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_DEX;
	END IF;
END

CREATE DEFINER=`root`@`localhost` FUNCTION `getpetfloat`(PET_INTEGER INTEGER UNSIGNED ) RETURNS int(11)
    READS SQL DATA
    DETERMINISTIC
BEGIN
	RETURN SIGN(PET_INTEGER) *  (1.0 + (PET_INTEGER &  0x007FFFFF) * POWER(2.0, -23)) * POWER(2.0, (PET_INTEGER & 0x7f800000) / 0x00800000 - 127);
END

SELECT RoleID, getpetfloat(getpetinteger(PetID,1)) AS 'VIT', getpetfloat(getpetinteger(PetID,2)) AS 'INT', getpetfloat(getpetinteger(PetID,3)) AS 'STR', getpetfloat(getpetinteger(PetID,4)) AS 'SPR', getpetfloat(getpetinteger(PetID,5)) AS 'DEX' FROM pettab_sg;
Credit to LikeReally

But this code getting just started Value for Vit/Str/Int...
if you lvl pet or someone use PetBug hack they are not found in Pettab_sg, bcz code getting start value from pet info.

If anyone can little help with this.
Thank you
08/28/2024 13:58 terrain#2
Quote:
Originally Posted by NerkoWoI View Post
Hello , I need litlle help with PetBug find code :
Code:
CREATE DEFINER=`root`@`localhost` FUNCTION `getpetinteger`(PET_GET_ID BIGINT UNSIGNED, PET_GET_TYPE INT) RETURNS int(11)
    READS SQL DATA
    DETERMINISTIC
BEGIN
	DECLARE PET_VIT INTEGER UNSIGNED;
	DECLARE PET_INT INTEGER UNSIGNED;
	DECLARE PET_STR INTEGER UNSIGNED;
	DECLARE PET_SPR INTEGER UNSIGNED;
	DECLARE PET_DEX INTEGER UNSIGNED;
	SET PET_VIT = 0;
	SET PET_INT = 0;
	SET PET_STR = 0;
	SET PET_SPR = 0;
	SET PET_DEX = 0;
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+10,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+8,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+6,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+4,2)),16,10) INTO PET_VIT FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_VIT;
	ELSEIF PET_GET_TYPE = 2 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+50,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+48,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+46,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+44,2)),16,10) INTO PET_INT FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_INT;
	ELSEIF PET_GET_TYPE = 3 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+90,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+88,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+86,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+84,2)),16,10) INTO PET_STR FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_STR;
	ELSEIF PET_GET_TYPE = 4 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+130,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+128,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+126,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+124,2)),16,10) INTO PET_SPR FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_SPR;
	ELSEIF PET_GET_TYPE = 5 THEN
	SELECT CONV(CONCAT(SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+170,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+168,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+166,2),SUBSTR(hex(PetInfo),INSTR(SUBSTR(hex(PetInfo),43), "3F00")+164,2)),16,10) INTO PET_DEX FROM pettab_sg WHERE PetID = PET_GET_ID;
	RETURN PET_DEX;
	END IF;
END

CREATE DEFINER=`root`@`localhost` FUNCTION `getpetfloat`(PET_INTEGER INTEGER UNSIGNED ) RETURNS int(11)
    READS SQL DATA
    DETERMINISTIC
BEGIN
	RETURN SIGN(PET_INTEGER) *  (1.0 + (PET_INTEGER &  0x007FFFFF) * POWER(2.0, -23)) * POWER(2.0, (PET_INTEGER & 0x7f800000) / 0x00800000 - 127);
END

SELECT RoleID, getpetfloat(getpetinteger(PetID,1)) AS 'VIT', getpetfloat(getpetinteger(PetID,2)) AS 'INT', getpetfloat(getpetinteger(PetID,3)) AS 'STR', getpetfloat(getpetinteger(PetID,4)) AS 'SPR', getpetfloat(getpetinteger(PetID,5)) AS 'DEX' FROM pettab_sg;
Credit to LikeReally

But this code getting just started Value for Vit/Str/Int...
if you lvl pet or someone use PetBug hack they are not found in Pettab_sg, bcz code getting start value from pet info.

If anyone can little help with this.
Thank you
[Only registered and activated users can see links. Click Here To Register...] IT'S NOT WORKING PROPERLY. THE PET CAN STILL BE BROKEN
08/28/2024 14:32 NerkoWoI#3
I know for this, but thank you for answered. Yeah its same you cant get right value from blob :)
08/28/2024 14:41 terrain#4
Quote:
Originally Posted by NerkoWoI View Post
I know for this, but thank you for answered. Yeah its same you cant get right value from blob :)
FOR NORMAL OPERATION YOU NEED TO PUT PROTECTION AGAINST PACKET SPOOFING, NOT A USELESS PROCEDURE IN THE DATABASE

Quote:
Originally Posted by NerkoWoI View Post
I know for this, but thank you for answered. Yeah its same you cant get right value from blob :)
YOU SHOULD WRITE TO NECROS AND HE'LL HAVE INFORMATION ON YOUR QUESTION.
08/28/2024 14:56 BOILegends#5
Create a Sniff -> Filter the AddPoints packet -> Check the attribute points received on the packet -> Boom, catched
08/28/2024 15:10 NerkoWoI#6
Quote:
Originally Posted by BOILegends View Post
Create a Sniff -> Filter the AddPoints packet -> Check the attribute points received on the packet -> Boom, catched
Thank you mate, but can you little explain please bud ?
09/24/2024 01:16 LikeReally#7
01010110010011001010100010010011010110010101110101 01101010101010
09/24/2024 11:24 BOILegends#8
Quote:
Originally Posted by NerkoWoI View Post
Thank you mate, but can you little explain please bud ?
you need create a packet sniff and filter the packet id 17510 that is MSG_PET_C2S_ADD_POINT and just check how many points the user added on the pet

this is my code to detect and ban pet
Quote:
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HellYeah.Core;
using HellYeah.Database;
using HellYeah.Modules.Cfg;

namespace HellYeah.PacketProcessing
{
class PetBugFix : Message
{
private uint roleid;
private ushort realm;
public PetBugFix(ProcessInComingPacket br) : base(br)
{
roleid = br.RoleID;
realm = br.Realm;
}

public override void Decode()
{
try
{
using (var br = new BinaryReader(new MemoryStream(GetData())))
{
//var role = ResourcesManager.GetRoleDatabase((int)roleid);
var PetDBID = br.ReadUInt64();
var STRAdd = br.ReadUInt16();
var VITAdd = br.ReadUInt16();
var DEXAdd = br.ReadUInt16();
var INTAdd = br.ReadUInt16();
var SPRAdd = br.ReadUInt16();
var Total = STRAdd + VITAdd + DEXAdd + INTAdd + SPRAdd;
Log.Pet(string.Format("RoleID:[" + roleid + "] PetDBID:{0} Str:{1} Vit:{2} Dex:{3} Int:{4} Spr:{5} Total:{6}",PetDBID, STRAdd, VITAdd, DEXAdd, INTAdd, SPRAdd, Total));
// Console.WriteLine();
if (Total > 1000)
{

Log.Pet($"RoleID:{roleid} PetDbId:{PetDBID}, Added a Total of [{Total}] TRIED TO BUG PET BUT I HAVE STOPPED HIM AND MOVED THE BUGGED PET TO THE TABLE CALLED 'pettab_sg_banned'\n");





if (PetBugFixCfg.AutoBanAccount.ToLower() == "true")
{
DatabaseManager.BanAccount(roleid.ToString());
//FormManager.GetForm<FM_Main>(new FM_Main()).AddRichText($"RoleID:{roleid} PetDbId:{PetDBID} GOT BANNED\n");
Log.Pet($"RoleID:{roleid} PetDbId:{PetDBID} GOT BANNED");
}



if (PetBugFixCfg.AutoBanPet.ToLower() == "true")
{
var accountid = ResourcesManager.GetRoleDatabase((int)roleid).Acco untID;
CommandManager.KickAccount((int)accountid, Msg_KickClient.Kick_CheatDetectorReqKick);

using (var context = new Database.shenguiEntities())
{
context.Configuration.AutoDetectChangesEnabled = false;
context.Configuration.LazyLoadingEnabled = false;
context.Database.ExecuteSqlCommand(
"CREATE TABLE if not exists `pettab_sg_banned` (`PetID` bigint(20) NOT NULL,`RoleID` int(10) unsigned NOT NULL,`PetInfo` blob,PRIMARY KEY(`PetID`),KEY `RoleID` (`RoleID`)) ENGINE = InnoDB DEFAULT CHARSET = latin1; ");

var result = context.pettab_sg.Find((long)PetDBID);

context.pettab_sg_banned.AddOrUpdate(new pettab_sg_banned()
{
PetID = result.PetID,
PetInfo = result.PetInfo,
RoleID = result.RoleID
});
context.pettab_sg.Remove(result);
context.SaveChanges();

}
Log.Pet($"AntiPetBug > Detected PetDbID[{PetDBID}], RoleID[{roleid}] Kicked from the Server and Pet Moved to pettab_sg_banned");
}
//CommandManager.KickAccount((int)DatabaseManager.Ge tUserByRoleID((int)roleid).ID, Msg_KickClient.Kick_CheatDetectorReqKick);
}
else
{
Log.Pet($"RoleID:{roleid} PetDbId:{PetDBID}, Added a Total of [{Total}] Points\n");
}
}
}
catch (Exception e)
{

Log.Debug("PetBugFix.cs ->" + e.ToString());
}
}
}

}
Quote:
Originally Posted by LikeReally View Post
Just because you can't, doesn't means it can't :wutface:
Gave you but you cant HAHAHA:lul:
Packet is another way too but why not release the packet fixer after releasing the hack :kappa:
I’m planning to make the pet bug fix public soon; I just need some time to code it as a standalone version
09/26/2024 02:09 NerkoWoI#9
Quote:
Originally Posted by LikeReally View Post
Just because you can't, doesn't means it can't :wutface:
Gave you but you cant HAHAHA:lul:
Packet is another way too but why not release the packet fixer after releasing the hack :kappa:
Well, I tried to make that function, but fail :/.
09/26/2024 18:09 LikeReally#10
01010110010011001010100010010011010110010101110101 01101010101010
09/26/2024 19:11 NerkoWoI#11
Quote:
Originally Posted by LikeReally View Post
THANK YOU SO MUCH BUDDY !

You are AMZING !!!

Do i need DECLARE this Attribute like on your script ?
bcz after I change this Dec in float got again value from pet is born :/
well I missing something. Tried to make view from this function and again same
old value, 1161527296 = 3000 i put 2000 again not find pet.

Well thank you for share, probably missing something.
Just to be clear its up to me not you bud.
09/26/2024 21:22 LikeReally#12
01010110010011001010100010010011010110010101110101 01101010101010
09/26/2024 22:10 NerkoWoI#13
Quote:
Originally Posted by LikeReally View Post
its ok bud, I still getting old value from PetInfo, I make some pets with over 2000 but this does not show that value just old when pet get born.
Put like 1148846080 = 1000, but the script did not find him in this query.

Thank you for your support, I really appreciate it :)

Oh how I'm stupid, lol all work well buddy, I just don't saw something, been messed xD.
Like I said is not bcz you its stupid me, didn't see obvious thing.

Thank you again
09/26/2024 23:40 LikeReally#14
01010110010011001010100010010011010110010101110101 01101010101010
09/27/2024 00:40 NerkoWoI#15
Quote:
Originally Posted by LikeReally View Post
:wat: No idea what you saying.
Don't think is hard to copy and paste :reeee:

Thank you soooooooooooooooooo much :) you are savior <3

Quote:
Originally Posted by LikeReally View Post

If you mean forbid didn't ban, for that write your own forbid method.

If not, just remove call forbid lines from the sql.
Yeah I make to add in forbidtab_sg for ban player character :)
but will write function for add account banned not just charater