feat(Spoofing): Add local user name spoofing (#502)

* Spoofs your local name by using natives and writing to a single struct (couldn't spoof name in chat otherwise)
* Add tooltip to IP spoofing to mention that it may cause you to get dropped from a session while connecting
* Expanded explanation in spoofing section to include that spoofing is server-side and not client-side.
This commit is contained in:
Yimura 2022-12-23 00:03:34 +01:00 committed by GitHub
parent 79e5e7a30b
commit a3422540be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 62 additions and 21 deletions

View File

@ -394,9 +394,11 @@ namespace big
struct spoofing
{
bool spoof_username = false;
bool spoof_local_username = false;
std::string username = "";
bool spoof_ip = true;
// enabling this by default causes confusion and many get dropped out of their sessions
bool spoof_ip = false;
std::array<int, 4> ip_address = { 42, 42, 42, 42 };
bool spoof_rockstar_id = false;
@ -427,10 +429,10 @@ namespace big
uint64_t applied_spoof_rockstar_id = 0;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(spoofing,
spoof_username, username, spoof_ip, ip_address, spoof_rockstar_id, rockstar_id, spoof_cheater,
spoof_hide_god, spoof_hide_spectate, spoof_rockstar_dev, spoof_rockstar_qa, spoof_crew_data,
crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type,
spoof_session_language, session_language, spoof_session_player_count, session_player_count)
spoof_username, spoof_local_username, username, spoof_ip, ip_address, spoof_rockstar_id, rockstar_id,
spoof_cheater, spoof_hide_god, spoof_hide_spectate, spoof_rockstar_dev, spoof_rockstar_qa, spoof_crew_data,
crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, spoof_session_language,
session_language, spoof_session_player_count, session_player_count)
} spoofing{};
struct vehicle

View File

@ -1,9 +1,13 @@
#include "hooking.hpp"
#include "memory/byte_patch.hpp"
#include "pointers.hpp"
#include "services/players/player_service.hpp"
#include <network/CNetworkPlayerMgr.hpp>
namespace big
{
static memory::byte_patch* local_name_patch{};
void hooks::network_player_mgr_init(CNetworkPlayerMgr* _this, std::uint64_t a2, std::uint32_t a3, std::uint32_t a4[4])
{
if (g.notifications.network_player_mgr_init.log)
@ -11,6 +15,13 @@ namespace big
if (g.notifications.network_player_mgr_init.notify)
g_notification_service->push("Network Player Manager", "Entering session and initializing player data.");
// set our local spoofed name
if (g.spoofing.spoof_username && g.spoofing.spoof_local_username)
{
local_name_patch = memory::byte_patch::make(g_pointers->m_chat_gamer_info->m_name, g.spoofing.username).get();
local_name_patch->apply();
}
g_hooking->get_original<hooks::network_player_mgr_init>()(_this, a2, a3, a4);
g_player_service->player_join(_this->m_local_net_player);
@ -21,6 +32,12 @@ namespace big
g.m_spoofed_peer_ids.clear();
g_player_service->do_cleanup();
// restore our original name
if (strcmp(g_pointers->m_chat_gamer_info->m_name, _this->m_local_net_player->get_name()) && local_name_patch)
{
local_name_patch->remove();
}
if (g.notifications.network_player_mgr_shutdown.log)
LOG(INFO) << "CNetworkPlayerMgr#shutdown got called, we're probably leaving our session.";
if (g.notifications.network_player_mgr_shutdown.notify)

View File

@ -1,4 +1,5 @@
#include "hooking.hpp"
#include "pointers.hpp"
constexpr static auto advertisments = std::to_array(
{
@ -20,7 +21,9 @@ namespace big
if (is_local_player)
{
if (g.spoofing.spoof_username)
{
memcpy(player->m_name, g.spoofing.username.c_str(), sizeof(player->m_name));
}
if (g.spoofing.spoof_ip)
{

View File

@ -10,6 +10,20 @@ namespace big
{
namespace all_scripts
{
void GET_PLAYER_NAME(rage::scrNativeCallContext* src)
{
const auto playerId = src->get_arg<Player>(0);
src->set_return_value(PLAYER::GET_PLAYER_NAME(playerId));
if (g.spoofing.spoof_username && g.spoofing.spoof_local_username)
{
const auto network_player_mgr = gta_util::get_network_player_mgr();
if (network_player_mgr && network_player_mgr->m_local_net_player && playerId == network_player_mgr->m_local_net_player->m_player_id)
{
src->set_return_value(g.spoofing.username.c_str());
}
}
}
void IS_DLC_PRESENT(rage::scrNativeCallContext* src)
{
const auto hash = src->get_arg<rage::joaat_t>(0);

View File

@ -103,6 +103,7 @@ namespace big
native_hooks::native_hooks()
{
add_native_detour(0x6D0DE6A7B5DA71F8, all_scripts::GET_PLAYER_NAME);
add_native_detour(0x812595A0644CE1DE, all_scripts::IS_DLC_PRESENT);
add_native_detour(0x1CA59E306ECB80A5, all_scripts::NETWORK_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT);
add_native_detour(0xD1110739EEADB592, all_scripts::NETWORK_TRY_TO_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT);

View File

@ -756,6 +756,12 @@ namespace big
m_interval_check_func = ptr.add(3).rip().as<PVOID>();
});
// Chat Gamer Info
main_batch.add("CGI", "E8 ? ? ? ? 48 8B CF E8 ? ? ? ? 8B E8", [this](memory::handle ptr)
{
m_chat_gamer_info = ptr.add(1).rip().add(6).rip().as<rage::rlGamerInfo*>();
});
auto mem_region = memory::module("GTA5.exe");
main_batch.run(mem_region);

View File

@ -19,6 +19,7 @@ namespace rage
class atSingleton;
class RageSecurity;
class netTime;
class rlGamerInfo;
}
namespace big
@ -221,6 +222,8 @@ namespace big
rage::netTime** m_network_time;
functions::sync_network_time m_sync_network_time;
rage::rlGamerInfo* m_chat_gamer_info;
};
inline pointers* g_pointers{};

View File

@ -9,15 +9,20 @@ namespace big
{
void view::spoofing()
{
components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.");
components::sub_title("Username");
g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
});
components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.\nAll spoofed details will be only visible by other players, your game will still show your actual name, ip, rid...");
components::sub_title("Username");
ImGui::Checkbox("Spoof Username", &g.spoofing.spoof_username);
if (g.spoofing.spoof_username)
{
ImGui::SameLine();
ImGui::Checkbox("Spoof Username Locally", &g.spoofing.spoof_local_username);
}
constexpr size_t name_size = RTL_FIELD_SIZE(rage::rlGamerInfo, m_name);
static char name[name_size];
@ -33,11 +38,9 @@ namespace big
components::sub_title("IP Address");
g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
});
ImGui::Checkbox("Spoof IP", &g.spoofing.spoof_ip);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Disable this feature if you're having trouble joining sessions.");
ImGui::Text("IP Address:");
ImGui::DragInt4("##ip_fields", g.spoofing.ip_address.data(), 0, 255);
@ -46,10 +49,6 @@ namespace big
components::sub_title("Rockstar ID");
g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
});
ImGui::Checkbox("Spoof Rockstar ID", &g.spoofing.spoof_rockstar_id);
ImGui::Text("Rockstar ID:");
@ -61,10 +60,6 @@ namespace big
components::sub_title("Crew");
g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
});
ImGui::Checkbox("Spoof Crew", &g.spoofing.spoof_crew_data);
constexpr size_t crew_tag_size = RTL_FIELD_SIZE(ClanData, m_clan_tag);