From ac09410491460310dd13390ece15943b58cdc25e Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 19:17:32 +0100 Subject: [PATCH 01/14] receive packet event added attackLag --- HotSpot/HotSpot.cpp | 21 ++++++ HotSpot/HotSpot.hpp | 1 + README.md | 12 ++-- Ripterms Ghost.vcxproj | 4 ++ Ripterms Ghost.vcxproj.filters | 12 ++++ Ripterms/Hook/JavaHook.cpp | 6 ++ Ripterms/Hook/JavaHook.h | 2 +- Ripterms/Mappings/mappings_forge_1_7_10.h | 17 +++++ Ripterms/Mappings/mappings_lunar_1_16_5.h | 17 +++++ Ripterms/Mappings/mappings_lunar_1_19_4.h | 17 +++++ Ripterms/Mappings/mappings_lunar_1_7_10.h | 17 +++++ Ripterms/Mappings/mappings_lunar_1_8_9.h | 17 +++++ Ripterms/Mappings/mappings_vanilla_1_8_9.h | 17 +++++ Ripterms/Modules/AimAssist.cpp | 2 +- Ripterms/Modules/Modules.cpp | 65 +++++++++++++++++++ Ripterms/Modules/Modules.h | 17 ++++- .../ChannelHandlerContext.cpp | 0 .../ChannelHandlerContext.h | 10 +++ .../network/NetworkManager/NetworkManager.cpp | 7 ++ .../network/NetworkManager/NetworkManager.h | 14 ++++ 20 files changed, 267 insertions(+), 8 deletions(-) create mode 100644 io/netty/ChannelHandlerContext/ChannelHandlerContext.cpp create mode 100644 io/netty/ChannelHandlerContext/ChannelHandlerContext.h create mode 100644 net/minecraft/network/NetworkManager/NetworkManager.cpp create mode 100644 net/minecraft/network/NetworkManager/NetworkManager.h diff --git a/HotSpot/HotSpot.cpp b/HotSpot/HotSpot.cpp index a7deeb8..aa4955a 100644 --- a/HotSpot/HotSpot.cpp +++ b/HotSpot/HotSpot.cpp @@ -528,6 +528,27 @@ unsigned short* HotSpot::Method::get_flags() return (unsigned short*)((uint8_t*)this + vm_entry->offset); } +void HotSpot::Method::set_dont_inline(bool enabled) +{ + unsigned short* _flags = get_flags(); + if (!_flags) + { + static VMStructEntry* vm_entry = find_VMStructEntry("Method", "_intrinsic_id", false); + if (!vm_entry) return; + unsigned char* flags = ((uint8_t*)this + vm_entry->offset + 1); + if (enabled) + *flags |= (1 << 4); + else + *flags &= ~(1 << 4); + return; + } + + if (enabled) + *_flags |= _dont_inline; + else + *_flags &= ~_dont_inline; +} + int HotSpot::Thread::get_thread_state_offset() { static VMStructEntry* vm_entry = find_VMStructEntry("JavaThread", "_thread_state", false); diff --git a/HotSpot/HotSpot.hpp b/HotSpot/HotSpot.hpp index 6faf3d3..b551d6c 100644 --- a/HotSpot/HotSpot.hpp +++ b/HotSpot/HotSpot.hpp @@ -206,6 +206,7 @@ namespace HotSpot void set_from_compiled_entry(void* entry); void* get_i2i_entry(); unsigned short* get_flags(); + void set_dont_inline(bool enabled); }; struct Array diff --git a/README.md b/README.md index 7f55309..314a592 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RiptermsGhost +ï»ż# RiptermsGhost An example injectable cheat for minecraft using java native interface, jvmti, java method hooking, and constant pool editing. @@ -16,7 +16,7 @@ Any question ? Contact me on discord: lefraudeur ### Supported versions : x64 windows only. Because of the way ripterms hooks java methods, it supports only some jvm versions (tested on zulu17, openjdk8, openjdk17). Please open an issue if it doesn't work on your jvm version. -- Lunar Client: 1.7.10, 1.8.9, 1.16.5, 1.17.1, 1.19.4, 1.20.4 +- 🌙Lunar Client: 1.7.10, 1.8.9, 1.16.5, 1.17.1, 1.19.4, 1.20.4 - Forge: 1.7.10 - Badlion Client: 1.8.9 - Vanilla: 1.8.9 @@ -41,6 +41,8 @@ Change mappings to add new versions - Glide - VelocityFly - Speed +- BackTrack (set the hitbox of the target to a previous position) +- AttackLag (delay received packet when attacking someone) ![image](https://github.com/Lefraudeur/RiptermsGhost/assets/91006387/39690baa-859a-4ea2-a9b0-dfbc8cbfe472) @@ -49,17 +51,19 @@ Insert to open the gui / end key to self destruct ![image](https://github.com/Lefraudeur/RiptermsGhost/assets/73477238/0d8f6308-1036-4480-b487-eaf02d07259d) -### Event system (hook, modifiy parameters, cancel, modify return value): +### ⚓Event system (hook, modifiy parameters, cancel, modify return value): - onAddToSendQueue (edit sent packets) - onUpdateWalkingPlayer - onAttackTargetEntityWithCurrentItem +- onChannelRead0 (edit received packets) +##### ⚠java method hooking is still unreliable, and might cause a crash on some methods To test it, just build the project with visual studio 2022, and inject the dll using any injector (process hacker, extreme injector...). You can also take a look at RiptermsInjector: https://github.com/Lefraudeur/RiptermsInjector Help would be appreciated, this repo is here to share your knowledge with other people. You can also make suggestions. (open an issue or a pull request to dev branch) -TODO: +📃TODO: - Good world to screen, to make player and block ESP (missing w2s for 1.16.5) - Customizable key binds - Enabled modules list diff --git a/Ripterms Ghost.vcxproj b/Ripterms Ghost.vcxproj index c46045f..405dbda 100644 --- a/Ripterms Ghost.vcxproj +++ b/Ripterms Ghost.vcxproj @@ -176,6 +176,7 @@ + @@ -203,6 +204,7 @@ + @@ -246,6 +248,7 @@ + @@ -272,6 +275,7 @@ + diff --git a/Ripterms Ghost.vcxproj.filters b/Ripterms Ghost.vcxproj.filters index 2952eea..e5f5c93 100644 --- a/Ripterms Ghost.vcxproj.filters +++ b/Ripterms Ghost.vcxproj.filters @@ -243,6 +243,12 @@ Fichiers sources + + Fichiers sources + + + Fichiers sources + @@ -413,5 +419,11 @@ Fichiers d%27en-tĂȘte + + Fichiers d%27en-tĂȘte + + + Fichiers d%27en-tĂȘte + \ No newline at end of file diff --git a/Ripterms/Hook/JavaHook.cpp b/Ripterms/Hook/JavaHook.cpp index f0dfb03..9dcbdf8 100644 --- a/Ripterms/Hook/JavaHook.cpp +++ b/Ripterms/Hook/JavaHook.cpp @@ -30,6 +30,7 @@ void Ripterms::JavaHook::clean() } for (HookedMethod& hm : hooked_methods) { + hm.method->set_dont_inline(false); int* flags = (int*)hm.method->get_access_flags(); *flags &= ~(NO_COMPILE); } @@ -52,6 +53,9 @@ bool Ripterms::JavaHook::hook(jmethodID methodID, i2i_detour_t detour) if (hk.method == method) return true; } + + + method->set_dont_inline(true); int* flags = (int*)method->get_access_flags(); *flags |= (NO_COMPILE); @@ -61,6 +65,8 @@ bool Ripterms::JavaHook::hook(jmethodID methodID, i2i_detour_t detour) Ripterms::p_env->DeleteLocalRef(owner); method = *(HotSpot::Method**)methodID; + + method->set_dont_inline(true); flags = (int*)method->get_access_flags(); *flags |= (NO_COMPILE); diff --git a/Ripterms/Hook/JavaHook.h b/Ripterms/Hook/JavaHook.h index 9b112ea..b0269dd 100644 --- a/Ripterms/Hook/JavaHook.h +++ b/Ripterms/Hook/JavaHook.h @@ -8,7 +8,7 @@ namespace Ripterms::JavaHook template inline void set_return_value(bool* cancel, T return_value) { - *(T*)((void**)cancel + 8) = return_value; + *(T*)((void**)cancel + 8) = return_value; //see asm code to understand that } //param from left to right (arg0 beeing this for non static methods) diff --git a/Ripterms/Mappings/mappings_forge_1_7_10.h b/Ripterms/Mappings/mappings_forge_1_7_10.h index a6b2bbc..230e782 100644 --- a/Ripterms/Mappings/mappings_forge_1_7_10.h +++ b/Ripterms/Mappings/mappings_forge_1_7_10.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -751,6 +756,18 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/NetworkManager", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + "static": false + } + ] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_16_5.h b/Ripterms/Mappings/mappings_lunar_1_16_5.h index af7b62b..3ef451a 100644 --- a/Ripterms/Mappings/mappings_lunar_1_16_5.h +++ b/Ripterms/Mappings/mappings_lunar_1_16_5.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -733,6 +738,18 @@ R"( "fields": [], "methods": [ ] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/Connection", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/protocol/Packet;)V", + "static": false + } + ] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_19_4.h b/Ripterms/Mappings/mappings_lunar_1_19_4.h index 2deb92f..7e97f79 100644 --- a/Ripterms/Mappings/mappings_lunar_1_19_4.h +++ b/Ripterms/Mappings/mappings_lunar_1_19_4.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -738,6 +743,18 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/Connection", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/protocol/Packet;)V", + "static": false + } + ] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_7_10.h b/Ripterms/Mappings/mappings_lunar_1_7_10.h index 44ffabb..d1e9ae0 100644 --- a/Ripterms/Mappings/mappings_lunar_1_7_10.h +++ b/Ripterms/Mappings/mappings_lunar_1_7_10.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -751,6 +756,18 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/NetworkManager", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + "static": false + } + ] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_8_9.h b/Ripterms/Mappings/mappings_lunar_1_8_9.h index cf71cff..0f7d406 100644 --- a/Ripterms/Mappings/mappings_lunar_1_8_9.h +++ b/Ripterms/Mappings/mappings_lunar_1_8_9.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -762,6 +767,18 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/NetworkManager", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + "static": false + } + ] } } )"; diff --git a/Ripterms/Mappings/mappings_vanilla_1_8_9.h b/Ripterms/Mappings/mappings_vanilla_1_8_9.h index ce0dce0..4f3cce5 100644 --- a/Ripterms/Mappings/mappings_vanilla_1_8_9.h +++ b/Ripterms/Mappings/mappings_vanilla_1_8_9.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -761,6 +766,18 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "ek", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "a", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lff;)V", + "static": false + } + ] } } )"; diff --git a/Ripterms/Modules/AimAssist.cpp b/Ripterms/Modules/AimAssist.cpp index b0010a0..3548ed8 100644 --- a/Ripterms/Modules/AimAssist.cpp +++ b/Ripterms/Modules/AimAssist.cpp @@ -186,7 +186,7 @@ void Ripterms::Modules::AimAssist::renderGUI() ImGui::SliderFloat("Max Distance", &max_distance, 1.0f, 6.0f, "%.1f"); ImGui::SliderFloat("Max Angle", &max_angle, 10.0f, 180.0f, "%.1f"); ImGui::SliderFloat("Multiplier Yaw", &multiplier, 0.1f, 2.0f, "%.1f"); - ImGui::SliderFloat("Multiplier Pitch", &multiplierPitch, 0.1f, 2.0f, "%.1f"); + ImGui::SliderFloat("Multiplier Pitch", &multiplierPitch, 0.0f, 2.0f, "%.1f"); ImGui::EndGroup(); } } diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index 573ec4a..5ad37cb 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -41,6 +41,10 @@ void Ripterms::Modules::IModule::onGetClientModName(JNIEnv* env, bool* cancel) { } +void Ripterms::Modules::IModule::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) +{ +} + void Ripterms::Modules::IModule::onKeyBind(int keyBind) { if (!keyBind || keyBind != this->keyBind) return; @@ -135,6 +139,25 @@ static void getClientModName_callback(HotSpot::frame* frame, HotSpot::Thread* th return; } +static void channelRead0_callback(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) +{ + if (!Ripterms::p_env) return; + JNIEnv* env = thread->get_env(); + + Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 2), env); + ChannelHandlerContext context(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env); + NetworkManager this_networkManager(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); + + for (const std::pair>& category : Ripterms::Modules::categories) + { + for (Ripterms::Modules::IModule* module : category.second) + { + module->onChannelRead0(env, this_networkManager, context, packet, cancel); + } + } + return; +} + void Ripterms::Modules::setupEventHooks() { Ripterms::JavaClassV2 NetHandlerPlayClient("net/minecraft/client/network/NetHandlerPlayClient"); @@ -160,6 +183,10 @@ void Ripterms::Modules::setupEventHooks() Ripterms::JavaClassV2 ClientBrandRetriever("net/minecraft/client/ClientBrandRetriever"); jmethodID getClientModName = ClientBrandRetriever.getMethodID("getClientModName"); Ripterms::JavaHook::hook(getClientModName, getClientModName_callback); + + Ripterms::JavaClassV2 NetworkManager("net/minecraft/network/NetworkManager"); + jmethodID channelRead0 = NetworkManager.getMethodID("channelRead0"); + Ripterms::JavaHook::hook(channelRead0, channelRead0_callback); } void Ripterms::Modules::runAll() @@ -189,3 +216,41 @@ void Ripterms::Modules::cleanAll() void Ripterms::Modules::ESP::render() { } + +void Ripterms::Modules::AttackLag::renderGUI() +{ + static bool display_options = false; + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("AttackLag", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); + if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) + display_options = !display_options; + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 30.0f); + if (ImGui::ArrowButton("aimopt", ImGuiDir_Down)) + display_options = !display_options; + if (display_options) + { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10.0f); + ImGui::BeginGroup(); + ImGui::SliderInt("Packet Receive delay ms", &delay, 10, 1000, "%d"); + ImGui::EndGroup(); + } +} + +void Ripterms::Modules::AttackLag::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) +{ + if (lag) + { + std::this_thread::sleep_for(std::chrono::milliseconds(delay)); + lag = false; + } +} + +void Ripterms::Modules::AttackLag::onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) +{ + if (!enabled) return; + lag = true; +} diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index f6f3767..549586b 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -13,6 +13,7 @@ #include #include #include +#include "../../net/minecraft/network/NetworkManager/NetworkManager.h" namespace Ripterms { @@ -33,6 +34,7 @@ namespace Ripterms virtual void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel); virtual void onGetMouseOver(JNIEnv* env, float partialTicks, bool* cancel); virtual void onGetClientModName(JNIEnv* env, bool* cancel); + virtual void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel); void onKeyBind(int keyBind); protected: @@ -56,7 +58,7 @@ namespace Ripterms float max_distance = 6.0f; float max_angle = 80.0f; float multiplier = 1.0f; - float multiplierPitch = 0.5f; + float multiplierPitch = 0.0f; EntityPlayer prev_selected_target{ Ripterms::p_env, true }; }; @@ -269,9 +271,20 @@ namespace Ripterms float partialTicks = 1.0f; }; + class AttackLag : public IModule + { + public: + void renderGUI() override; + void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) override; + void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; + private: + std::atomic lag = false; + int delay = 250; + }; + inline std::map> categories = { - {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack()}}, + {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack(), new AttackLag()}}, {"Player", {new FastPlace(), new Blink(), new LegitScaffold(), new NoFall()}}, {"Movement", {new Velocity(), new Sprint(), new Glide(), new VelocityFly(), new Speed()}}, {"Render", {new Xray(), new FullBright(), new ESP()}}, diff --git a/io/netty/ChannelHandlerContext/ChannelHandlerContext.cpp b/io/netty/ChannelHandlerContext/ChannelHandlerContext.cpp new file mode 100644 index 0000000..e69de29 diff --git a/io/netty/ChannelHandlerContext/ChannelHandlerContext.h b/io/netty/ChannelHandlerContext/ChannelHandlerContext.h new file mode 100644 index 0000000..4a83c79 --- /dev/null +++ b/io/netty/ChannelHandlerContext/ChannelHandlerContext.h @@ -0,0 +1,10 @@ +#pragma once +#include "../../../java/lang/Object/Object.h" + +class ChannelHandlerContext : public Object +{ +public: + using Object::Object; +protected: + inline static Ripterms::JavaClassV2 ChannelHandlerContextClass{ "io/netty/channel/ChannelHandlerContext" }; +}; \ No newline at end of file diff --git a/net/minecraft/network/NetworkManager/NetworkManager.cpp b/net/minecraft/network/NetworkManager/NetworkManager.cpp new file mode 100644 index 0000000..903fb43 --- /dev/null +++ b/net/minecraft/network/NetworkManager/NetworkManager.cpp @@ -0,0 +1,7 @@ +#include "NetworkManager.h" + +void NetworkManager::channelRead0(ChannelHandlerContext& context, Packet& packet) +{ + if (!instance) return; + env->CallVoidMethod(instance, NetworkManagerClass.getMethodID("channelRead0"), context.getInstance(), packet.getInstance()); +} diff --git a/net/minecraft/network/NetworkManager/NetworkManager.h b/net/minecraft/network/NetworkManager/NetworkManager.h new file mode 100644 index 0000000..bc839df --- /dev/null +++ b/net/minecraft/network/NetworkManager/NetworkManager.h @@ -0,0 +1,14 @@ +#pragma once +#include "../../../../java/lang/Object/Object.h" +#include "../../../../io/netty/ChannelHandlerContext/ChannelHandlerContext.h" +#include "../Packet/Packet.h" + +class NetworkManager : public Object +{ +public: + using Object::Object; + + void channelRead0(ChannelHandlerContext& context, Packet& packet); +protected: + inline static Ripterms::JavaClassV2 NetworkManagerClass{ "net/minecraft/network/NetworkManager" }; +}; \ No newline at end of file From 1fbcbb25f147e850e9a949caad983eb5a1bbab2b Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 19:55:09 +0100 Subject: [PATCH 02/14] u --- Ripterms/Modules/Modules.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 549586b..33e7910 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -278,7 +278,7 @@ namespace Ripterms void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) override; void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; private: - std::atomic lag = false; + bool lag = false; int delay = 250; }; From f61fcd0cd39b4ffd49969134fc12706508027cd6 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 20:08:42 +0100 Subject: [PATCH 03/14] fixed backtrack --- Ripterms/Hook/JavaHook.cpp | 8 ++++++-- Ripterms/Modules/BackTrack.cpp | 5 +++-- Ripterms/Modules/Modules.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Ripterms/Hook/JavaHook.cpp b/Ripterms/Hook/JavaHook.cpp index 9dcbdf8..c83c84c 100644 --- a/Ripterms/Hook/JavaHook.cpp +++ b/Ripterms/Hook/JavaHook.cpp @@ -162,12 +162,16 @@ void common_detour(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) if (state == HotSpot::_thread_in_Java) thread->set_thread_state(HotSpot::_thread_in_native); else return; + + JNIEnv* env = nullptr; + if (Ripterms::p_jvm->GetEnv((void**)&env, JNI_VERSION_1_8) != JNI_OK || !env) return; + { - Ripterms::JNIFrame jni_frame(thread->get_env(), 30); + Ripterms::JNIFrame jni_frame(thread->get_env(), 5); hk.detour(frame, thread, cancel); } thread->set_thread_state(HotSpot::_thread_in_Java); - break; + return; } } } diff --git a/Ripterms/Modules/BackTrack.cpp b/Ripterms/Modules/BackTrack.cpp index 880e33c..bacfc27 100644 --- a/Ripterms/Modules/BackTrack.cpp +++ b/Ripterms/Modules/BackTrack.cpp @@ -40,7 +40,8 @@ void Ripterms::Modules::BackTrack::run() Ripterms::Maths::Vector3d maxbb(bb.getMaxX(), bb.getMaxY(), bb.getMaxZ()); minbb = minbb - vector; maxbb = maxbb - vector; - bb.setMinX(minbb.x); bb.setMinY(minbb.y); bb.setMinZ(minbb.z); - bb.setMaxX(maxbb.x); bb.setMaxY(maxbb.y); bb.setMaxZ(maxbb.z); + + bb.setMinX(min(minbb.x, bb.getMinX())); bb.setMinY(min(minbb.y, bb.getMinY())); bb.setMinZ(min(minbb.z, bb.getMinZ())); + bb.setMaxX(max(maxbb.x, bb.getMaxX())); bb.setMaxY(max(maxbb.y, bb.getMaxY())); bb.setMaxZ(max(maxbb.z, bb.getMaxZ())); } } \ No newline at end of file diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 33e7910..07eb39f 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -27,7 +27,7 @@ namespace Ripterms virtual void render(); virtual void disable(); - inline static std::atomic onAddToSendQueueNoEvent = false; + inline static bool onAddToSendQueueNoEvent = false; virtual void onAddToSendQueue(JNIEnv* env, NetHandlerPlayClient& sendQueue, Packet& packet, bool* cancel); virtual void onUpdateWalkingPlayer(JNIEnv* env, EntityPlayerSP& this_player, bool* cancel); From 0bdd9f02491783a7e9a7a130f98e5ebd7f1e63f1 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 20:34:20 +0100 Subject: [PATCH 04/14] Added NoMiss --- README.md | 1 + Ripterms/Hook/JavaHook.cpp | 6 +-- Ripterms/Mappings/mappings_forge_1_7_10.h | 6 +++ Ripterms/Mappings/mappings_lunar_1_16_5.h | 6 +++ Ripterms/Mappings/mappings_lunar_1_19_4.h | 6 +++ Ripterms/Mappings/mappings_lunar_1_7_10.h | 6 +++ Ripterms/Mappings/mappings_lunar_1_8_9.h | 6 +++ Ripterms/Mappings/mappings_vanilla_1_8_9.h | 6 +++ Ripterms/Modules/Modules.cpp | 44 ++++++++++++++++++++++ Ripterms/Modules/Modules.h | 11 +++++- 10 files changed, 94 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 314a592..31c508b 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Change mappings to add new versions - Speed - BackTrack (set the hitbox of the target to a previous position) - AttackLag (delay received packet when attacking someone) +- NoMiss ![image](https://github.com/Lefraudeur/RiptermsGhost/assets/91006387/39690baa-859a-4ea2-a9b0-dfbc8cbfe472) diff --git a/Ripterms/Hook/JavaHook.cpp b/Ripterms/Hook/JavaHook.cpp index c83c84c..a7e11fe 100644 --- a/Ripterms/Hook/JavaHook.cpp +++ b/Ripterms/Hook/JavaHook.cpp @@ -158,14 +158,14 @@ void common_detour(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) { if (hk.method == frame->get_method()) { + JNIEnv* env = nullptr; + if (Ripterms::p_jvm->GetEnv((void**)&env, JNI_VERSION_1_8) != JNI_OK || !env || env != thread->get_env()) return; + HotSpot::JavaThreadState state = thread->get_thread_state(); if (state == HotSpot::_thread_in_Java) thread->set_thread_state(HotSpot::_thread_in_native); else return; - JNIEnv* env = nullptr; - if (Ripterms::p_jvm->GetEnv((void**)&env, JNI_VERSION_1_8) != JNI_OK || !env) return; - { Ripterms::JNIFrame jni_frame(thread->get_env(), 5); hk.detour(frame, thread, cancel); diff --git a/Ripterms/Mappings/mappings_forge_1_7_10.h b/Ripterms/Mappings/mappings_forge_1_7_10.h index 230e782..6020fd5 100644 --- a/Ripterms/Mappings/mappings_forge_1_7_10.h +++ b/Ripterms/Mappings/mappings_forge_1_7_10.h @@ -519,6 +519,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", + "static": true } ], "methods": [] diff --git a/Ripterms/Mappings/mappings_lunar_1_16_5.h b/Ripterms/Mappings/mappings_lunar_1_16_5.h index 3ef451a..8f2294f 100644 --- a/Ripterms/Mappings/mappings_lunar_1_16_5.h +++ b/Ripterms/Mappings/mappings_lunar_1_16_5.h @@ -502,6 +502,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/world/phys/HitResult$Type;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/world/phys/HitResult$Type;", + "static": true } ], "methods": [] diff --git a/Ripterms/Mappings/mappings_lunar_1_19_4.h b/Ripterms/Mappings/mappings_lunar_1_19_4.h index 7e97f79..49af3f9 100644 --- a/Ripterms/Mappings/mappings_lunar_1_19_4.h +++ b/Ripterms/Mappings/mappings_lunar_1_19_4.h @@ -502,6 +502,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/world/phys/HitResult$Type;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/world/phys/HitResult$Type;", + "static": true } ], "methods": [] diff --git a/Ripterms/Mappings/mappings_lunar_1_7_10.h b/Ripterms/Mappings/mappings_lunar_1_7_10.h index d1e9ae0..a1d767d 100644 --- a/Ripterms/Mappings/mappings_lunar_1_7_10.h +++ b/Ripterms/Mappings/mappings_lunar_1_7_10.h @@ -519,6 +519,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", + "static": true } ], "methods": [] diff --git a/Ripterms/Mappings/mappings_lunar_1_8_9.h b/Ripterms/Mappings/mappings_lunar_1_8_9.h index 0f7d406..5357535 100644 --- a/Ripterms/Mappings/mappings_lunar_1_8_9.h +++ b/Ripterms/Mappings/mappings_lunar_1_8_9.h @@ -513,6 +513,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", + "static": true } ], "methods": [] diff --git a/Ripterms/Mappings/mappings_vanilla_1_8_9.h b/Ripterms/Mappings/mappings_vanilla_1_8_9.h index 4f3cce5..6e298f0 100644 --- a/Ripterms/Mappings/mappings_vanilla_1_8_9.h +++ b/Ripterms/Mappings/mappings_vanilla_1_8_9.h @@ -513,6 +513,12 @@ R"( "obfuscated": "b", "signature": "Lauh$a;", "static": true + }, + { + "name": "MISS", + "obfuscated": "a", + "signature": "Lauh$a;", + "static": true } ], "methods": [] diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index 5ad37cb..578e799 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -45,6 +45,10 @@ void Ripterms::Modules::IModule::onChannelRead0(JNIEnv* env, NetworkManager& thi { } +void Ripterms::Modules::IModule::onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) +{ +} + void Ripterms::Modules::IModule::onKeyBind(int keyBind) { if (!keyBind || keyBind != this->keyBind) return; @@ -158,6 +162,23 @@ static void channelRead0_callback(HotSpot::frame* frame, HotSpot::Thread* thread return; } +static void clickMouse_callback(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) +{ + if (!Ripterms::p_env) return; + JNIEnv* env = thread->get_env(); + + Minecraft theMinecraft(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); + + for (const std::pair>& category : Ripterms::Modules::categories) + { + for (Ripterms::Modules::IModule* module : category.second) + { + module->onClickMouse(env, theMinecraft, cancel); + } + } + return; +} + void Ripterms::Modules::setupEventHooks() { Ripterms::JavaClassV2 NetHandlerPlayClient("net/minecraft/client/network/NetHandlerPlayClient"); @@ -187,6 +208,10 @@ void Ripterms::Modules::setupEventHooks() Ripterms::JavaClassV2 NetworkManager("net/minecraft/network/NetworkManager"); jmethodID channelRead0 = NetworkManager.getMethodID("channelRead0"); Ripterms::JavaHook::hook(channelRead0, channelRead0_callback); + + Ripterms::JavaClassV2 Minecraft("net/minecraft/client/Minecraft"); + jmethodID clickMouse = Minecraft.getMethodID("clickMouse"); + Ripterms::JavaHook::hook(clickMouse, clickMouse_callback); } void Ripterms::Modules::runAll() @@ -254,3 +279,22 @@ void Ripterms::Modules::AttackLag::onAttackTargetEntityWithCurrentItem(JNIEnv* e if (!enabled) return; lag = true; } + +void Ripterms::Modules::NoMiss::renderGUI() +{ + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("NoMiss", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); +} + +void Ripterms::Modules::NoMiss::onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) +{ + if (!enabled) return; + if (theMinecraft.getObjectMouseOver().getType().isEqualTo(MovingObjectType::getType("MISS"))) + { + Ripterms::JavaHook::set_return_value(cancel, 0); + *cancel = true; + } +} diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 07eb39f..31f492d 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -14,6 +14,7 @@ #include #include #include "../../net/minecraft/network/NetworkManager/NetworkManager.h" +#include "../../net/minecraft/client/Minecraft/Minecraft.h" namespace Ripterms { @@ -35,6 +36,7 @@ namespace Ripterms virtual void onGetMouseOver(JNIEnv* env, float partialTicks, bool* cancel); virtual void onGetClientModName(JNIEnv* env, bool* cancel); virtual void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel); + virtual void onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel); void onKeyBind(int keyBind); protected: @@ -282,9 +284,16 @@ namespace Ripterms int delay = 250; }; + class NoMiss : public IModule + { + public: + void renderGUI() override; + void onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) override; + }; + inline std::map> categories = { - {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack(), new AttackLag()}}, + {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack(), new AttackLag(), new NoMiss()}}, {"Player", {new FastPlace(), new Blink(), new LegitScaffold(), new NoFall()}}, {"Movement", {new Velocity(), new Sprint(), new Glide(), new VelocityFly(), new Speed()}}, {"Render", {new Xray(), new FullBright(), new ESP()}}, From f9d36927b3ec15ca0c1ce724bc2463290851077c Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 20:59:01 +0100 Subject: [PATCH 05/14] nvm random crash --- Ripterms/Hook/JavaHook.cpp | 4 +--- Ripterms/Modules/Blink.cpp | 1 - Ripterms/Modules/Modules.cpp | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Ripterms/Hook/JavaHook.cpp b/Ripterms/Hook/JavaHook.cpp index a7e11fe..f56429a 100644 --- a/Ripterms/Hook/JavaHook.cpp +++ b/Ripterms/Hook/JavaHook.cpp @@ -154,13 +154,11 @@ void* find_correct_hook_place(void* _i2i_entry) void common_detour(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) { + if (!(*(void**)thread->get_env())) return; for (HookedMethod& hk : hooked_methods) { if (hk.method == frame->get_method()) { - JNIEnv* env = nullptr; - if (Ripterms::p_jvm->GetEnv((void**)&env, JNI_VERSION_1_8) != JNI_OK || !env || env != thread->get_env()) return; - HotSpot::JavaThreadState state = thread->get_thread_state(); if (state == HotSpot::_thread_in_Java) thread->set_thread_state(HotSpot::_thread_in_native); diff --git a/Ripterms/Modules/Blink.cpp b/Ripterms/Modules/Blink.cpp index 2489e5f..c14d0ad 100644 --- a/Ripterms/Modules/Blink.cpp +++ b/Ripterms/Modules/Blink.cpp @@ -30,7 +30,6 @@ void Ripterms::Modules::Blink::onAddToSendQueue(JNIEnv* env, NetHandlerPlayClien sendPackets(sendQueue); return; } - Ripterms::JavaHook::set_return_value(cancel, 0); *cancel = true; packets.push_back(Packet(packet, env, true)); } diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index 578e799..d823bf5 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -294,7 +294,6 @@ void Ripterms::Modules::NoMiss::onClickMouse(JNIEnv* env, Minecraft& theMinecraf if (!enabled) return; if (theMinecraft.getObjectMouseOver().getType().isEqualTo(MovingObjectType::getType("MISS"))) { - Ripterms::JavaHook::set_return_value(cancel, 0); *cancel = true; } } From 4dc60e644a3879a199e5b74dcb6ceb02c1f0f368 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 21:15:13 +0100 Subject: [PATCH 06/14] wtf --- Ripterms/Modules/BackTrack.cpp | 4 +++- Ripterms/Modules/HitBoxes.cpp | 5 ++++- Ripterms/Modules/Modules.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Ripterms/Modules/BackTrack.cpp b/Ripterms/Modules/BackTrack.cpp index bacfc27..510a93c 100644 --- a/Ripterms/Modules/BackTrack.cpp +++ b/Ripterms/Modules/BackTrack.cpp @@ -31,9 +31,11 @@ void Ripterms::Modules::BackTrack::run() if (!timer.isElapsed()) return; + Ripterms::Maths::Vector3d thePlayerPos = Ripterms::cache->thePlayer.getPosition(); for (EntityPlayer& player : Ripterms::cache->playerEntities.toVector()) { - if (player.isEqualTo(Ripterms::cache->thePlayer)) continue; + if (!player.isValid() || player.isEqualTo(Ripterms::cache->thePlayer)) continue; + if ((player.getPosition() - thePlayerPos).distance() > 6.0) continue; Ripterms::Maths::Vector3d vector = player.getMovementVector(partialTicks); AxisAlignedBB bb = player.getBoundingBox(); Ripterms::Maths::Vector3d minbb(bb.getMinX(), bb.getMinY(), bb.getMinZ()); diff --git a/Ripterms/Modules/HitBoxes.cpp b/Ripterms/Modules/HitBoxes.cpp index 2866d53..b1de275 100644 --- a/Ripterms/Modules/HitBoxes.cpp +++ b/Ripterms/Modules/HitBoxes.cpp @@ -29,12 +29,15 @@ void Ripterms::Modules::HitBoxes::run() if (!enabled || !timer.isElapsed()) return; - Ripterms::Maths::Vector3d thePlayer_position = cache->thePlayer.getPosition(); + Ripterms::Maths::Vector3d thePlayerPos = Ripterms::cache->thePlayer.getPosition(); for (EntityPlayer& target : cache->playerEntities.toVector()) { + if (!target.isValid()) continue; if (target.isEqualTo(cache->thePlayer)) continue; + if ((target.getPosition() - thePlayerPos).distance() > 6.0) continue; + AxisAlignedBB target_bb = target.getBoundingBox(); if diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index d823bf5..ed9738b 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -292,7 +292,7 @@ void Ripterms::Modules::NoMiss::renderGUI() void Ripterms::Modules::NoMiss::onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) { if (!enabled) return; - if (theMinecraft.getObjectMouseOver().getType().isEqualTo(MovingObjectType::getType("MISS"))) + if (theMinecraft.getObjectMouseOver().getType().isEqualTo(MovingObjectType::getType("MISS", env))) { *cancel = true; } From 378a90d39670fb6027a9fbd8a6b104b1ea279c1a Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 21:21:11 +0100 Subject: [PATCH 07/14] backtrack random crash fix ig --- Ripterms/Modules/BackTrack.cpp | 2 +- Ripterms/Modules/HitBoxes.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Ripterms/Modules/BackTrack.cpp b/Ripterms/Modules/BackTrack.cpp index 510a93c..5a86888 100644 --- a/Ripterms/Modules/BackTrack.cpp +++ b/Ripterms/Modules/BackTrack.cpp @@ -35,7 +35,7 @@ void Ripterms::Modules::BackTrack::run() for (EntityPlayer& player : Ripterms::cache->playerEntities.toVector()) { if (!player.isValid() || player.isEqualTo(Ripterms::cache->thePlayer)) continue; - if ((player.getPosition() - thePlayerPos).distance() > 6.0) continue; + if (player.getTicksExisted() < 10 || (player.getPosition() - thePlayerPos).distance() > 6.0) continue; Ripterms::Maths::Vector3d vector = player.getMovementVector(partialTicks); AxisAlignedBB bb = player.getBoundingBox(); Ripterms::Maths::Vector3d minbb(bb.getMinX(), bb.getMinY(), bb.getMinZ()); diff --git a/Ripterms/Modules/HitBoxes.cpp b/Ripterms/Modules/HitBoxes.cpp index b1de275..6ea0c5f 100644 --- a/Ripterms/Modules/HitBoxes.cpp +++ b/Ripterms/Modules/HitBoxes.cpp @@ -36,7 +36,7 @@ void Ripterms::Modules::HitBoxes::run() if (!target.isValid()) continue; if (target.isEqualTo(cache->thePlayer)) continue; - if ((target.getPosition() - thePlayerPos).distance() > 6.0) continue; + if (target.getTicksExisted() < 10 || (target.getPosition() - thePlayerPos).distance() > 6.0) continue; AxisAlignedBB target_bb = target.getBoundingBox(); From 55e5ae9a79b5859040fb4de1215eea372de7efbd Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 21:28:35 +0100 Subject: [PATCH 08/14] u --- Ripterms/Cache/Cache.cpp | 2 +- Ripterms/Modules/AimAssist.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Ripterms/Cache/Cache.cpp b/Ripterms/Cache/Cache.cpp index d5e3522..bafa75f 100644 --- a/Ripterms/Cache/Cache.cpp +++ b/Ripterms/Cache/Cache.cpp @@ -13,7 +13,7 @@ bool Ripterms::Cache::fillCache() return false; } thePlayer = theMinecraft.getThePlayer(); - if (!thePlayer.isValid()) + if (!thePlayer.isValid() || thePlayer.getTicksExisted() < 10) { is_valid = false; return false; diff --git a/Ripterms/Modules/AimAssist.cpp b/Ripterms/Modules/AimAssist.cpp index 3548ed8..3eba5ef 100644 --- a/Ripterms/Modules/AimAssist.cpp +++ b/Ripterms/Modules/AimAssist.cpp @@ -28,7 +28,7 @@ void Ripterms::Modules::AimAssist::run() for (EntityPlayer& target : Ripterms::cache->playerEntities.toVector()) { - if (target.isEqualTo(cache->thePlayer)) + if (!target.isValid() || target.isEqualTo(cache->thePlayer) || target.getTicksExisted() < 10) continue; AxisAlignedBB targetBB = target.getBoundingBox(); From 726f2793df2d0b73ec5923dc38b9b280b66bc6a0 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Fri, 23 Feb 2024 21:38:45 +0100 Subject: [PATCH 09/14] added BlockOnAttack --- README.md | 1 + Ripterms/Modules/Glide.cpp | 1 - Ripterms/Modules/Modules.cpp | 18 ++++++++++++++++++ Ripterms/Modules/Modules.h | 9 ++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 31c508b..547a52a 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Change mappings to add new versions - BackTrack (set the hitbox of the target to a previous position) - AttackLag (delay received packet when attacking someone) - NoMiss +- BlockOnAttack ![image](https://github.com/Lefraudeur/RiptermsGhost/assets/91006387/39690baa-859a-4ea2-a9b0-dfbc8cbfe472) diff --git a/Ripterms/Modules/Glide.cpp b/Ripterms/Modules/Glide.cpp index afad272..b78d8ea 100644 --- a/Ripterms/Modules/Glide.cpp +++ b/Ripterms/Modules/Glide.cpp @@ -2,7 +2,6 @@ void Ripterms::Modules::Glide::renderGUI() { - static bool display_options = false; ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); ImGui::Checkbox("Glide", &enabled); diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index ed9738b..da3904c 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -297,3 +297,21 @@ void Ripterms::Modules::NoMiss::onClickMouse(JNIEnv* env, Minecraft& theMinecraf *cancel = true; } } + +void Ripterms::Modules::BlockOnAttack::renderGUI() +{ + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("BlockOnAttack", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); +} + +void Ripterms::Modules::BlockOnAttack::onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) +{ + if (!enabled) return; + POINT cursorPos{}; + GetCursorPos(&cursorPos); + PostMessageA(Ripterms::window, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(cursorPos.x, cursorPos.y)); + PostMessageA(Ripterms::window, WM_RBUTTONUP, MK_RBUTTON, MAKELPARAM(cursorPos.x, cursorPos.y)); +} diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 31f492d..9f20ed2 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -291,9 +291,16 @@ namespace Ripterms void onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) override; }; + class BlockOnAttack : public IModule + { + public: + void renderGUI() override; + void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; + }; + inline std::map> categories = { - {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack(), new AttackLag(), new NoMiss()}}, + {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack(), new AttackLag(), new NoMiss(), new BlockOnAttack()}}, {"Player", {new FastPlace(), new Blink(), new LegitScaffold(), new NoFall()}}, {"Movement", {new Velocity(), new Sprint(), new Glide(), new VelocityFly(), new Speed()}}, {"Render", {new Xray(), new FullBright(), new ESP()}}, From 8c117f99a946f51264eea1844647c562790a5cc2 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Sat, 24 Feb 2024 19:35:22 +0100 Subject: [PATCH 10/14] modified module manager --- Ripterms/GUI/GUI.cpp | 31 +++++++++--------- Ripterms/Hook/JavaHook.cpp | 12 ++----- Ripterms/Modules/Modules.cpp | 61 +++++++++++++++++++----------------- Ripterms/Modules/Modules.h | 43 +++++++++++++++++++------ Ripterms/Modules/Test.cpp | 4 +-- 5 files changed, 86 insertions(+), 65 deletions(-) diff --git a/Ripterms/GUI/GUI.cpp b/Ripterms/GUI/GUI.cpp index 11e45af..fad835a 100644 --- a/Ripterms/GUI/GUI.cpp +++ b/Ripterms/GUI/GUI.cpp @@ -76,9 +76,9 @@ static LRESULT CALLBACK detour_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA if (msg == WM_KEYDOWN) { - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* m : category.second) + for (Ripterms::Modules::IModule* m : category.modules) { m->onKeyBind(wParam); } @@ -161,9 +161,9 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) ImGuiWindowFlags_NoBackground); { Ripterms::JNIFrame jni_frame(Ripterms::p_env, 30); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* m : category.second) + for (Ripterms::Modules::IModule* m : category.modules) { m->render(); } @@ -212,28 +212,29 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) } ImGui::EndChild(); - static std::string current_tab = "Combat"; + static uint8_t current_category_id = 0; + constexpr uint8_t settings_id = sizeof(Ripterms::Modules::categories) / sizeof(Ripterms::Modules::Category); ImGui::SetCursorPosY(55); ImGui::BeginChild("##categories", ImVec2(100, 345), 0, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); { ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.f); - for (const std::pair>& category : Ripterms::Modules::categories) + for (uint8_t i = 0; i < sizeof(Ripterms::Modules::categories) / sizeof(Ripterms::Modules::Category); ++i) { - bool is_selected = category.first == current_tab; + bool is_selected = i == current_category_id; if(is_selected) ImGui::PushStyleColor(ImGuiCol_Button, Ripterms::GUI::color_active_tab); - if (ImGui::Button(category.first.c_str(), Ripterms::GUI::category_button_size)) - current_tab = category.first; + if (ImGui::Button(Ripterms::Modules::categories[i].name, Ripterms::GUI::category_button_size)) + current_category_id = i; if (is_selected) ImGui::PopStyleColor(); } ImGui::SetCursorPos(ImVec2(0, ImGui::GetWindowSize()[1] - Ripterms::GUI::category_button_size[1])); - if (current_tab == "Settings") { ImGui::PushStyleColor(ImGuiCol_Button, Ripterms::GUI::color_active_tab); } - if (ImGui::Button("Settings", Ripterms::GUI::category_button_size)) { current_tab = "Settings"; } - if (current_tab == "Settings") { ImGui::PopStyleColor(); } + if (current_category_id == settings_id) { ImGui::PushStyleColor(ImGuiCol_Button, Ripterms::GUI::color_active_tab); } + if (ImGui::Button("Settings", Ripterms::GUI::category_button_size)) { current_category_id = settings_id; } + if (current_category_id == settings_id) { ImGui::PopStyleColor(); } ImGui::PopStyleVar(); } @@ -244,7 +245,7 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) ImGui::SetCursorPosX(115); ImGui::BeginChild("##modules"); { - if (current_tab == "Settings") + if (current_category_id == settings_id) { ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); @@ -298,11 +299,11 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) else { ImGui::SetCursorPos(ImVec2(4, 2)); - ImGui::Text(current_tab.c_str()); + ImGui::Text(Ripterms::Modules::categories[current_category_id].name); ImGui::Separator(); { Ripterms::JNIFrame jni_frame(Ripterms::p_env, 30); - for (Ripterms::Modules::IModule* module : Ripterms::Modules::categories[current_tab]) + for (Ripterms::Modules::IModule* module : Ripterms::Modules::categories[current_category_id].modules) { module->renderGUI(); } diff --git a/Ripterms/Hook/JavaHook.cpp b/Ripterms/Hook/JavaHook.cpp index f56429a..af1e572 100644 --- a/Ripterms/Hook/JavaHook.cpp +++ b/Ripterms/Hook/JavaHook.cpp @@ -154,20 +154,12 @@ void* find_correct_hook_place(void* _i2i_entry) void common_detour(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) { - if (!(*(void**)thread->get_env())) return; + if (!(*(void**)thread->get_env()) || thread->get_thread_state() != HotSpot::_thread_in_Java) return; for (HookedMethod& hk : hooked_methods) { if (hk.method == frame->get_method()) { - HotSpot::JavaThreadState state = thread->get_thread_state(); - if (state == HotSpot::_thread_in_Java) - thread->set_thread_state(HotSpot::_thread_in_native); - else return; - - { - Ripterms::JNIFrame jni_frame(thread->get_env(), 5); - hk.detour(frame, thread, cancel); - } + hk.detour(frame, thread, cancel); thread->set_thread_state(HotSpot::_thread_in_Java); return; } diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index da3904c..4294c86 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -61,13 +61,14 @@ static void addToSendQueue_callback(HotSpot::frame* frame, HotSpot::Thread* thre if (Ripterms::Modules::IModule::onAddToSendQueueNoEvent) return; JNIEnv* env = thread->get_env(); - NetHandlerPlayClient sendQueue(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); - Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env); + NetHandlerPlayClient sendQueue(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onAddToSendQueue(env, sendQueue, packet, cancel); } } @@ -81,9 +82,9 @@ static void getMouseOver_callback(HotSpot::frame* frame, HotSpot::Thread* thread JNIEnv* env = thread->get_env(); float f = Ripterms::JavaHook::get_primitive_param_at(frame, 1); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { module->onGetMouseOver(env, f, cancel); } @@ -96,13 +97,14 @@ static void attackTargetEntityWithCurrentItem_callback(HotSpot::frame* frame, Ho if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - EntityPlayer this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); - Entity entity(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env); + EntityPlayer this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + Entity entity(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onAttackTargetEntityWithCurrentItem(env, this_player, entity, cancel); } } @@ -115,12 +117,13 @@ static void onUpdateWalkingPlayer_callback(HotSpot::frame* frame, HotSpot::Threa if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - EntityPlayerSP this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); + EntityPlayerSP this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onUpdateWalkingPlayer(env, this_player, cancel); } } @@ -133,10 +136,11 @@ static void getClientModName_callback(HotSpot::frame* frame, HotSpot::Thread* th if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onGetClientModName(env, cancel); } } @@ -148,14 +152,15 @@ static void channelRead0_callback(HotSpot::frame* frame, HotSpot::Thread* thread if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 2), env); - ChannelHandlerContext context(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env); - NetworkManager this_networkManager(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); + NetworkManager this_networkManager(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + ChannelHandlerContext context(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env, true); + Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 2), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onChannelRead0(env, this_networkManager, context, packet, cancel); } } @@ -167,12 +172,13 @@ static void clickMouse_callback(HotSpot::frame* frame, HotSpot::Thread* thread, if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - Minecraft theMinecraft(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); + Minecraft theMinecraft(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onClickMouse(env, theMinecraft, cancel); } } @@ -216,9 +222,9 @@ void Ripterms::Modules::setupEventHooks() void Ripterms::Modules::runAll() { - for (const std::pair>& category : categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (IModule* m : category.second) + for (IModule* m : category.modules) { m->run(); } @@ -227,12 +233,11 @@ void Ripterms::Modules::runAll() void Ripterms::Modules::cleanAll() { - for (const std::pair>& category : categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (IModule* m : category.second) + for (IModule* m : category.modules) { m->disable(); - delete m; } } } diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 9f20ed2..3edd643 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -11,8 +11,9 @@ #include "../../net/minecraft/world/World/World.h" #include "../../net/minecraft/client/entity/EntityPlayerSP/EntityPlayerSP.h" #include -#include #include +#include +#include #include "../../net/minecraft/network/NetworkManager/NetworkManager.h" #include "../../net/minecraft/client/Minecraft/Minecraft.h" @@ -60,7 +61,7 @@ namespace Ripterms float max_distance = 6.0f; float max_angle = 80.0f; float multiplier = 1.0f; - float multiplierPitch = 0.0f; + float multiplierPitch = 0.4f; EntityPlayer prev_selected_target{ Ripterms::p_env, true }; }; @@ -270,7 +271,7 @@ namespace Ripterms void renderGUI() override; void run() override; private: - float partialTicks = 1.0f; + float partialTicks = 0.3f; }; class AttackLag : public IModule @@ -281,7 +282,7 @@ namespace Ripterms void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; private: bool lag = false; - int delay = 250; + int delay = 420; }; class NoMiss : public IModule @@ -298,13 +299,35 @@ namespace Ripterms void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; }; - inline std::map> categories = + + class Category + { + public: + Category(const char* name, std::vector&& modules) : name(name), modules(std::move(modules)) {} + Category(const Category& cat) = delete; + ~Category() { for (IModule* module : modules) delete module; } + + template || ...))>> + inline static Category create(const char* name) + { + std::vector modules{}; + modules.reserve(sizeof...(T)); + (modules.push_back(new T()), ...); + return Category(name, std::move(modules)); + } + + const char* name; + std::vector modules; + private: + }; + + inline Category categories[] = { - {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack(), new AttackLag(), new NoMiss(), new BlockOnAttack()}}, - {"Player", {new FastPlace(), new Blink(), new LegitScaffold(), new NoFall()}}, - {"Movement", {new Velocity(), new Sprint(), new Glide(), new VelocityFly(), new Speed()}}, - {"Render", {new Xray(), new FullBright(), new ESP()}}, - {"Whatever", {new ClientBrandChanger(), new Test()}} + Category::create("Combat"), + Category::create ("Player"), + Category::create("Movement"), + Category::create("Render"), + Category::create("Whatever") }; void setupEventHooks(); diff --git a/Ripterms/Modules/Test.cpp b/Ripterms/Modules/Test.cpp index 076016e..9079bf0 100644 --- a/Ripterms/Modules/Test.cpp +++ b/Ripterms/Modules/Test.cpp @@ -60,6 +60,8 @@ void Ripterms::Modules::Test::renderGUI() //0000000003121341 //0x261 + std::cout << Ripterms::p_env->functions->CallBooleanMethod << '\n'; + /* std::thread a([mid] { JNIEnv* env = Ripterms::get_current_thread_env(); @@ -74,7 +76,5 @@ void Ripterms::Modules::Test::renderGUI() }); a.detach(); */ - - Ripterms::cache->thePlayer.getSendQueue().addToSendQueue(C03PacketPlayer::newObject(true)); } } \ No newline at end of file From b1a32f86b2575647274156ddaa4d65c2dde3bd24 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Sat, 24 Feb 2024 19:47:06 +0100 Subject: [PATCH 11/14] fixed code mistakes --- Ripterms/Modules/Modules.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 3edd643..239f553 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -303,11 +303,10 @@ namespace Ripterms class Category { public: - Category(const char* name, std::vector&& modules) : name(name), modules(std::move(modules)) {} Category(const Category& cat) = delete; ~Category() { for (IModule* module : modules) delete module; } - template || ...))>> + template && ...))>> inline static Category create(const char* name) { std::vector modules{}; @@ -319,12 +318,13 @@ namespace Ripterms const char* name; std::vector modules; private: + Category(const char* name, std::vector&& modules) : name(name), modules(std::move(modules)) {} }; inline Category categories[] = { Category::create("Combat"), - Category::create ("Player"), + Category::create("Player"), Category::create("Movement"), Category::create("Render"), Category::create("Whatever") From 2b9cb7812a0c302643fbe01c6748778edb7d8e26 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Sun, 25 Feb 2024 00:19:06 +0100 Subject: [PATCH 12/14] added velocityPacket (lunar 1.8 only for now) --- Ripterms Ghost.vcxproj | 2 + Ripterms Ghost.vcxproj.filters | 6 +++ Ripterms/Mappings/mappings_lunar_1_8_9.h | 36 ++++++++++++++ Ripterms/Modules/Modules.cpp | 23 +++++++++ Ripterms/Modules/Modules.h | 9 +++- net/minecraft/entity/Entity/Entity.cpp | 6 +++ net/minecraft/entity/Entity/Entity.h | 1 + .../S12PacketEntityVelocity.cpp | 49 +++++++++++++++++++ .../S12PacketEntityVelocity.h | 20 ++++++++ 9 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp create mode 100644 net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h diff --git a/Ripterms Ghost.vcxproj b/Ripterms Ghost.vcxproj index 405dbda..3f61840 100644 --- a/Ripterms Ghost.vcxproj +++ b/Ripterms Ghost.vcxproj @@ -209,6 +209,7 @@ + @@ -280,6 +281,7 @@ + diff --git a/Ripterms Ghost.vcxproj.filters b/Ripterms Ghost.vcxproj.filters index e5f5c93..d5f78e3 100644 --- a/Ripterms Ghost.vcxproj.filters +++ b/Ripterms Ghost.vcxproj.filters @@ -249,6 +249,9 @@ Fichiers sources + + Fichiers sources + @@ -425,5 +428,8 @@ Fichiers d%27en-tĂȘte + + Fichiers d%27en-tĂȘte + \ No newline at end of file diff --git a/Ripterms/Mappings/mappings_lunar_1_8_9.h b/Ripterms/Mappings/mappings_lunar_1_8_9.h index 5357535..39cbc8c 100644 --- a/Ripterms/Mappings/mappings_lunar_1_8_9.h +++ b/Ripterms/Mappings/mappings_lunar_1_8_9.h @@ -364,6 +364,12 @@ R"( "obfuscated": "prevRotationPitch", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "entityId", + "signature": "I", + "static": false } ], "methods": [ @@ -785,6 +791,36 @@ R"( "static": false } ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "entityID", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "motionX", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "motionY", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "motionZ", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index 4294c86..d367d61 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -3,6 +3,7 @@ #include #include "../../net/minecraft/network/play/client/C03PacketPlayer/C03PacketPlayer.h" #include "../Hook/JavaHook.h" +#include "../../net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h" void Ripterms::Modules::IModule::run() { @@ -320,3 +321,25 @@ void Ripterms::Modules::BlockOnAttack::onAttackTargetEntityWithCurrentItem(JNIEn PostMessageA(Ripterms::window, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(cursorPos.x, cursorPos.y)); PostMessageA(Ripterms::window, WM_RBUTTONUP, MK_RBUTTON, MAKELPARAM(cursorPos.x, cursorPos.y)); } + +void Ripterms::Modules::VelocityPacket::renderGUI() +{ + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("VelocityPacket", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); +} + +void Ripterms::Modules::VelocityPacket::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) +{ + if (!enabled) return; + if (!packet.isValid()) return; + if (!packet.instanceOf(Ripterms::JavaClassV2("net/minecraft/network/play/server/S12PacketEntityVelocity").get_jclass(env))) return; + + S12PacketEntityVelocity velocityPacket(packet, env); + if (velocityPacket.getEntityID() != Minecraft::getTheMinecraft(env).getThePlayer().getEntityId()) return; + velocityPacket.setMotionX(0); + velocityPacket.setMotionY(0); + velocityPacket.setMotionZ(0); +} diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 239f553..252f352 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -299,6 +299,13 @@ namespace Ripterms void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; }; + class VelocityPacket : public IModule + { + public: + void renderGUI() override; + void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) override; + }; + class Category { @@ -325,7 +332,7 @@ namespace Ripterms { Category::create("Combat"), Category::create("Player"), - Category::create("Movement"), + Category::create("Movement"), Category::create("Render"), Category::create("Whatever") }; diff --git a/net/minecraft/entity/Entity/Entity.cpp b/net/minecraft/entity/Entity/Entity.cpp index c41cc07..5f3be26 100644 --- a/net/minecraft/entity/Entity/Entity.cpp +++ b/net/minecraft/entity/Entity/Entity.cpp @@ -121,6 +121,12 @@ Entity Entity::getRidingEntity() const ); } +int Entity::getEntityId() const +{ + if (!instance) return 0; + return env->GetIntField(instance, EntityClass.getFieldID("entityId")); +} + void Entity::setPosition(const Ripterms::Maths::Vector3d& position) { if (!instance) return; diff --git a/net/minecraft/entity/Entity/Entity.h b/net/minecraft/entity/Entity/Entity.h index 4649539..ebac666 100644 --- a/net/minecraft/entity/Entity/Entity.h +++ b/net/minecraft/entity/Entity/Entity.h @@ -23,6 +23,7 @@ class Entity : public Object AxisAlignedBB getBoundingBox() const; float getEyeHeight() const; Entity getRidingEntity() const; + int getEntityId() const; void setPosition(const Ripterms::Maths::Vector3d& position); void setRidingEntity(Entity& entity); diff --git a/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp new file mode 100644 index 0000000..dd7fd1c --- /dev/null +++ b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp @@ -0,0 +1,49 @@ +#include "S12PacketEntityVelocity.h" + +int S12PacketEntityVelocity::getEntityID() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("entityID")); +} + +int S12PacketEntityVelocity::getMotionX() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionX")); +} + +int S12PacketEntityVelocity::getMotionY() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionY")); +} + +int S12PacketEntityVelocity::getMotionZ() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionZ")); +} + +void S12PacketEntityVelocity::setEntityID(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("entityID"), (jint)value); +} + +void S12PacketEntityVelocity::setMotionX(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionX"), (jint)value); +} + +void S12PacketEntityVelocity::setMotionY(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionY"), (jint)value); +} + +void S12PacketEntityVelocity::setMotionZ(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionZ"), (jint)value); +} diff --git a/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h new file mode 100644 index 0000000..d3b5919 --- /dev/null +++ b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h @@ -0,0 +1,20 @@ +#pragma once +#include "../../../Packet/Packet.h" + +class S12PacketEntityVelocity : public Packet +{ +public: + using Packet::Packet; + + int getEntityID() const; + int getMotionX() const; + int getMotionY() const; + int getMotionZ() const; + + void setEntityID(int value); + void setMotionX(int value); + void setMotionY(int value); + void setMotionZ(int value); +private: + inline static Ripterms::JavaClassV2 S12PacketEntityVelocityClass{ "net/minecraft/network/play/server/S12PacketEntityVelocity" }; +}; \ No newline at end of file From f796743f41cf0eeb90daf20544ecbb077c90544e Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Sun, 25 Feb 2024 01:04:45 +0100 Subject: [PATCH 13/14] added velocityPacket for other versions --- Ripterms/Mappings/mappings_forge_1_7_10.h | 36 ++++++++++++++++++++++ Ripterms/Mappings/mappings_lunar_1_16_5.h | 36 ++++++++++++++++++++++ Ripterms/Mappings/mappings_lunar_1_19_4.h | 36 ++++++++++++++++++++++ Ripterms/Mappings/mappings_lunar_1_7_10.h | 36 ++++++++++++++++++++++ Ripterms/Mappings/mappings_vanilla_1_8_9.h | 36 ++++++++++++++++++++++ Ripterms/Modules/Modules.cpp | 23 ++++++++++++-- Ripterms/Modules/Modules.h | 4 +++ java/lang/Object/Object.h | 2 ++ 8 files changed, 206 insertions(+), 3 deletions(-) diff --git a/Ripterms/Mappings/mappings_forge_1_7_10.h b/Ripterms/Mappings/mappings_forge_1_7_10.h index 6020fd5..8ae3624 100644 --- a/Ripterms/Mappings/mappings_forge_1_7_10.h +++ b/Ripterms/Mappings/mappings_forge_1_7_10.h @@ -376,6 +376,12 @@ R"( "obfuscated": "field_70127_C", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "field_145783_c", + "signature": "I", + "static": false } ], "methods": [ @@ -774,6 +780,36 @@ R"( "static": false } ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "field_149417_a", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "field_149415_b", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "field_149416_c", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "field_149414_d", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_16_5.h b/Ripterms/Mappings/mappings_lunar_1_16_5.h index 8f2294f..10a3087 100644 --- a/Ripterms/Mappings/mappings_lunar_1_16_5.h +++ b/Ripterms/Mappings/mappings_lunar_1_16_5.h @@ -340,6 +340,12 @@ R"( "obfuscated": "xRotO", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "id", + "signature": "I", + "static": false } ], "methods": [ @@ -756,6 +762,36 @@ R"( "static": false } ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/protocol/game/ClientboundSetEntityMotionPacket", + "fields": [ + { + "name": "entityID", + "obfuscated": "id", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "xa", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "ya", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "za", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_19_4.h b/Ripterms/Mappings/mappings_lunar_1_19_4.h index 49af3f9..037c72e 100644 --- a/Ripterms/Mappings/mappings_lunar_1_19_4.h +++ b/Ripterms/Mappings/mappings_lunar_1_19_4.h @@ -340,6 +340,12 @@ R"( "obfuscated": "xRotO", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "id", + "signature": "I", + "static": false } ], "methods": [ @@ -761,6 +767,36 @@ R"( "static": false } ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/protocol/game/ClientboundSetEntityMotionPacket", + "fields": [ + { + "name": "entityID", + "obfuscated": "id", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "xa", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "ya", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "za", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_7_10.h b/Ripterms/Mappings/mappings_lunar_1_7_10.h index a1d767d..a19e0cc 100644 --- a/Ripterms/Mappings/mappings_lunar_1_7_10.h +++ b/Ripterms/Mappings/mappings_lunar_1_7_10.h @@ -376,6 +376,12 @@ R"( "obfuscated": "prevRotationPitch", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "entityId", + "signature": "I", + "static": false } ], "methods": [ @@ -774,6 +780,36 @@ R"( "static": false } ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "field_149417_a", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "field_149415_b", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "field_149416_c", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "field_149414_d", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_vanilla_1_8_9.h b/Ripterms/Mappings/mappings_vanilla_1_8_9.h index 6e298f0..8040782 100644 --- a/Ripterms/Mappings/mappings_vanilla_1_8_9.h +++ b/Ripterms/Mappings/mappings_vanilla_1_8_9.h @@ -364,6 +364,12 @@ R"( "obfuscated": "B", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "c", + "signature": "I", + "static": false } ], "methods": [ @@ -784,6 +790,36 @@ R"( "static": false } ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "a", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "b", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "c", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "d", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index d367d61..b39d8c5 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -324,11 +324,28 @@ void Ripterms::Modules::BlockOnAttack::onAttackTargetEntityWithCurrentItem(JNIEn void Ripterms::Modules::VelocityPacket::renderGUI() { + static bool display_options = false; ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); ImGui::Checkbox("VelocityPacket", &enabled); ImGui::PopStyleVar(); ImGui::PopStyleVar(); + + if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) + display_options = !display_options; + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 30.0f); + if (ImGui::ArrowButton("aimopt", ImGuiDir_Down)) + display_options = !display_options; + if (display_options) + { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10.0f); + ImGui::BeginGroup(); + ImGui::SliderFloat("motionX multiplier", &motionX_multiplier, -2.0f, 2.0f, "%.2f"); + ImGui::SliderFloat("motionY multiplier", &motionY_multiplier, -2.0f, 2.0f, "%.2f"); + ImGui::SliderFloat("motionZ multiplier", &motionZ_multiplier, -2.0f, 2.0f, "%.2f"); + ImGui::EndGroup(); + } } void Ripterms::Modules::VelocityPacket::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) @@ -339,7 +356,7 @@ void Ripterms::Modules::VelocityPacket::onChannelRead0(JNIEnv* env, NetworkManag S12PacketEntityVelocity velocityPacket(packet, env); if (velocityPacket.getEntityID() != Minecraft::getTheMinecraft(env).getThePlayer().getEntityId()) return; - velocityPacket.setMotionX(0); - velocityPacket.setMotionY(0); - velocityPacket.setMotionZ(0); + velocityPacket.setMotionX(int(velocityPacket.getMotionX() * motionX_multiplier)); + velocityPacket.setMotionY(int(velocityPacket.getMotionY() * motionY_multiplier)); + velocityPacket.setMotionZ(int(velocityPacket.getMotionZ() * motionZ_multiplier)); } diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index 252f352..9957afc 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -304,6 +304,10 @@ namespace Ripterms public: void renderGUI() override; void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) override; + private: + float motionX_multiplier; + float motionY_multiplier; + float motionZ_multiplier; }; diff --git a/java/lang/Object/Object.h b/java/lang/Object/Object.h index af9b33c..4090e9e 100644 --- a/java/lang/Object/Object.h +++ b/java/lang/Object/Object.h @@ -7,8 +7,10 @@ class Object { public: //make global if you want to preserve the reference accross local frames, //so if you want to reuse it in another Modules::run() call + //becareful to set correct env when in hooks Object(jobject instance, JNIEnv* env = Ripterms::p_env, bool is_global=false); Object(const Object& other_Object); + //becareful to set correct env when in hooks Object(JNIEnv* env = Ripterms::p_env, bool is_global = false); ~Object(); From fda7ef82149e889c97ef2299181072dddaa38d75 Mon Sep 17 00:00:00 2001 From: Lefraudeur Date: Sun, 25 Feb 2024 01:11:44 +0100 Subject: [PATCH 14/14] update readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 547a52a..45b0da6 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Change mappings to add new versions - Reach (uses constant pool editing) - Left Clicker - Full Bright -- Velocity +- Velocity / VelocityPacket (uses channelRead0 event) - Client Brand Changer (modifies the getClientModName return value) (to troll staffs lol, sent to the server on login and displayed by some anticheats) - Blink (hooks and cancels addToSendQueue) - FastPlace @@ -58,9 +58,9 @@ Insert to open the gui / end key to self destruct - onUpdateWalkingPlayer - onAttackTargetEntityWithCurrentItem - onChannelRead0 (edit received packets) -##### ⚠java method hooking is still unreliable, and might cause a crash on some methods +##### ⚠java method hooking is still unreliable, and might cause crash the game on some methods -To test it, just build the project with visual studio 2022, and inject the dll using any injector (process hacker, extreme injector...). +To test it, just build the project with visual studio 2022 (compile on x64 Release config), and inject the dll using any injector (process hacker, extreme injector...). You can also take a look at RiptermsInjector: https://github.com/Lefraudeur/RiptermsInjector Help would be appreciated, this repo is here to share your knowledge with other people. You can also make suggestions. (open an issue or a pull request to dev branch)