From 180182e384b3db2d9a60e9e499c3a0b8831fdf43 Mon Sep 17 00:00:00 2001 From: weedelbhoy1 <57690131+weedelbhoy1@users.noreply.github.com> Date: Sat, 2 Jan 2021 23:33:19 +0000 Subject: [PATCH] Fixed Command block exploit cause am yer da BadMan --- .../Command/Commands/CommandBlockExploitCommand.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Horion/Command/Commands/CommandBlockExploitCommand.cpp b/Horion/Command/Commands/CommandBlockExploitCommand.cpp index 0155a7ed..20a7dc38 100644 --- a/Horion/Command/Commands/CommandBlockExploitCommand.cpp +++ b/Horion/Command/Commands/CommandBlockExploitCommand.cpp @@ -19,17 +19,20 @@ bool CommandBlockExploitCommand::execute(std::vector* args) { os << " "; os << args->at(i); } + using ItemRegistry__lookupByName_t = C_Item***(__fastcall*)(void*, void*, TextHolder); + static ItemRegistry__lookupByName_t ItemRegistry__lookupByNameF = reinterpret_cast(FindSignature("48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B EA 48 89 54 24 ? 48 89 4C 24 ? 48 89 4D")); void* ItemPtr = malloc(0x8); - C_Item*** cStack = ItemRegistry::getItemFromId(ItemPtr, 325); - C_ItemStack* yot = new C_ItemStack(***cStack, 1, 5); + void* idk = malloc(0x0); + C_ItemStack* yot = new C_ItemStack(***ItemRegistry__lookupByNameF(ItemPtr, idk, std::string("beehive")), 1, 0); free(ItemPtr); + free(idk); int slot = g_Data.getLocalPlayer()->getSupplies()->inventory->getFirstEmptySlot(); std::string cmd = os.str(); - std::string tag = "{ChestItems:[{Count:0b,Damage:0s,Name:\"\",Slot:0b}],Chested:0b,Color:0b,Color2:0b,Command:\"" + cmd + "\",CurrentTickCount:0,ExecuteOnFirstTick:1b,FallDistance:0f,Fire:0s,InventoryVersion:\"1.14.20\",Invulnerable:0b,IsAngry:0b,IsAutonomous:0b,IsBaby:0b,IsEating:0b,IsGliding:0b,IsGlobal:0b,IsIllagerCaptain:0b,IsOrphaned:0b,IsRoaring:0b,IsScared:0b,IsStunned:0b,IsSwimming:0b,IsTamed:0b,IsTrusting:0b,LastDimensionId:0,LastExecution:0l,LootDropped:0b,MarkVariant:0,Motion:[0f,0.1f,0f],OnGround:1b,OwnerNew:-1l,PortalCooldown:0,Pos:[0f,0f,0f],Rotation:[0f,0f],Saddled:0b,Sheared:0b,ShowBottom:0b,Sitting:0b,SkinID:0,Strength:0,StrengthMax:0,SuccessCount:1000,TickDelay:1,Ticking:1b,TrackOutput:1b,UniqueID:0l,Variant:0,Version:10,definitions:[\"+minecraft:command_block_minecart\",\"+minecraft:command_block_inactive\"],identifier:\"minecraft:command_block_minecart\",EntityType:100}"; + std::string tag = "{Occupants:[{ActorIdentifier:""\"minecraft:command_block_minecart<>""\",SaveData:{Command:\"" + cmd + "\",Ticking:1b,TicksLeftToStay:1}}]}"; yot->setUserData(std::move(Mojangson::parseTag(tag))); g_Data.getLocalPlayer()->getTransactionManager()->addInventoryAction(C_InventoryAction(0, yot, nullptr, 507, 99999)); g_Data.getLocalPlayer()->getTransactionManager()->addInventoryAction(C_InventoryAction(slot, nullptr, yot)); g_Data.getLocalPlayer()->getSupplies()->inventory->addItemToFirstEmptySlot(yot); - clientMessageF("[%sHorion%s] %sPlace the bucket to spawn a command block minecart with a command already inside!", GOLD, WHITE, GREEN); + clientMessageF("[%sHorion%s] %sPlace the beehive to spawn a command block minecart with a command already inside!", GOLD, WHITE, GREEN); return true; }