Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4365 from weedelbhoy1/master
Browse files Browse the repository at this point in the history
Fixed Command block exploit cause am yer da
  • Loading branch information
SurvirvorHRG authored Jan 4, 2021
2 parents e76f5e2 + 180182e commit cdf3d9a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Horion/Command/Commands/CommandBlockExploitCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ bool CommandBlockExploitCommand::execute(std::vector<std::string>* args) {
os << " ";
os << args->at(i);
}
using ItemRegistry__lookupByName_t = C_Item***(__fastcall*)(void*, void*, TextHolder);
static ItemRegistry__lookupByName_t ItemRegistry__lookupByNameF = reinterpret_cast<ItemRegistry__lookupByName_t>(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;
}

0 comments on commit cdf3d9a

Please sign in to comment.