From 24955f901936fcb63574bb96e9d2126ed51e7b3f Mon Sep 17 00:00:00 2001 From: Rxann <80224521+Rxann@users.noreply.github.com> Date: Wed, 5 Apr 2023 12:57:28 -0400 Subject: [PATCH] feat: Admin checking protection (#1187) --- src/core/data/admin_rids.hpp | 6 ++++++ .../player_management/assign_physical_index.cpp | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/core/data/admin_rids.hpp diff --git a/src/core/data/admin_rids.hpp b/src/core/data/admin_rids.hpp new file mode 100644 index 00000000..93785e39 --- /dev/null +++ b/src/core/data/admin_rids.hpp @@ -0,0 +1,6 @@ +#pragma once +#include +namespace big +{ + const std::vector admin_rids = {67241866, 89288299, 88439202, 179848415, 184360405, 184359255, 182860908, 117639172, 142582982, 115642993, 100641297, 116815567, 88435319, 64499496, 174623946, 174626867, 151972200, 115643538, 144372813, 88047835, 115670847, 173426004, 170727774, 93759254, 174247774, 151975489, 146999560, 179930265, 88435236, 179936743, 179848203, 151158634, 174623904, 179936852, 117639190, 93759401, 103814653, 121970978, 174623951, 174624061, 10552062, 174625194, 174625307, 174625407, 174625552, 174625647, 138273823, 138302559, 139813495, 88435916, 174875493, 171094021, 173213117, 171093866, 88435362, 137601710, 103054099, 104041189, 99453882, 104432921, 147604980, 130291558, 141884823, 131037988, 153219155, 155527062, 114982881, 119266383, 119958356, 216820, 121397532, 121698158, 18965281, 56778561, 63457, 121943600, 123017343, 123849404, 127448079, 129159629, 127403483, 174194059, 131973478, 64234321, 62409944, 64074298, 133709045, 134412628, 137579070, 137714280, 137851207, 130291511, 138075198, 137663665, 9284553, 147111499, 6597634, 23659342, 23659354, 103318524, 132521200, 107713114, 107713060, 23659353, 57233573, 111439945, 81691532, 77205006, 25695975, 24646485, 49770174, 146452200, 54468359, 54462116, 53309582, 85593421, 21088063, 50850475, 31586721, 56583239, 20158753, 20158751, 23659351, 91031119, 91003708, 16396170, 16396157, 16396148, 16396141, 16396133, 16396126, 16396118, 16396107, 16396096, 16396091, 16396080, 16395850, 16395840, 16395850, 16395782, 16395773, 22577458, 22577440, 22577121, 16395782, 20158757, 20158757, 117641111, 173200071, 196222661, 179654627, 214327469, 213560223, 179608067, 209260139, 195489237, 209260788, 201693153, 211750362, 211702584, 211532217, 24037237, 77817603, 205951017, 89705641, 179848153, 193975449, 201727585, 201693153, 193972138, 192796203, 201693551, 204071275, 67241866, 174754789, 135811063, 64624133, 89705672, 89797943, 191415974, 28776717, 41352312, 56176623}; +} \ No newline at end of file diff --git a/src/hooks/player_management/assign_physical_index.cpp b/src/hooks/player_management/assign_physical_index.cpp index c0ff0913..20f5263c 100644 --- a/src/hooks/player_management/assign_physical_index.cpp +++ b/src/hooks/player_management/assign_physical_index.cpp @@ -1,3 +1,4 @@ +#include "core/data/admin_rids.hpp" #include "fiber_pool.hpp" #include "gta_util.hpp" #include "hooking.hpp" @@ -8,8 +9,10 @@ #include + namespace big { + void* hooks::assign_physical_index(CNetworkPlayerMgr* netPlayerMgr, CNetGamePlayer* player, uint8_t new_index) { const auto* net_player_data = player->get_net_data(); @@ -42,7 +45,14 @@ namespace big g_player_service->player_join(player); if (net_player_data) { - if (g.notifications.player_join.above_map && *g_pointers->m_is_session_started)// prevent loading screen spam + auto found = std::find(admin_rids.begin(), admin_rids.end(), net_player_data->m_gamer_handle.m_rockstar_id); + if (found != admin_rids.end()) + { + g_notification_service->push_warning("Potential Admin Found!", + std::format("{} has been detected as admin", net_player_data->m_name)); + LOG(WARNING) << net_player_data->m_name << " (" << net_player_data->m_gamer_handle.m_rockstar_id << ") has been detected as admin"; + } + if (g.notifications.player_join.above_map && *g_pointers->m_is_session_started) // prevent loading screen spam notify::player_joined(player); if (g.notifications.player_join.log) @@ -93,4 +103,5 @@ namespace big } return result; } + }