From a150b18042517257ff8177995bfcef4bf020712d Mon Sep 17 00:00:00 2001 From: Phoenix404 <41524861+Phoenix4O4@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:55:51 +0300 Subject: [PATCH 1/4] telemetry update --- code/modules/integrated_electronics/core/printer.dm | 2 +- code/modules/tgui_panel/telemetry.dm | 4 ++-- config/bluemoon/discord.txt | 3 +++ modular_bluemoon/phoenix404/code/entries.dm | 3 +++ .../phoenix404/modules/tgui_panel/telemetry.dm | 7 +++++++ tgstation.dme | 1 + 6 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 modular_bluemoon/phoenix404/modules/tgui_panel/telemetry.dm diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index ee6e7d2b13806..014a52dfc515c 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -122,7 +122,7 @@ return var/client/client = user.client - if (CONFIG_GET(flag/use_exp_tracking) && client && client.get_exp_living(TRUE) < 480) // Player with less than 8 hours playtime is using this machine. + if (CONFIG_GET(flag/use_exp_tracking) && client && client.get_exp_living(TRUE) < 60 HOURS) // Player with less than 60 hours playtime is using this machine. if(client.next_circuit_grief_warning < world.time) var/turf/T = get_turf(src) client.next_circuit_grief_warning = world.time + 15 MINUTES // Wait 15 minutes before alerting admins again diff --git a/code/modules/tgui_panel/telemetry.dm b/code/modules/tgui_panel/telemetry.dm index 98ba1f14b8b2b..4f7a6339dc208 100644 --- a/code/modules/tgui_panel/telemetry.dm +++ b/code/modules/tgui_panel/telemetry.dm @@ -75,7 +75,7 @@ CHECK_TICK // This fucker has a history of playing on a banned account. if(found) - var/msg = "[key_name(client)] has a banned account in connection history! (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" - message_admins(msg) + var/msg = "[key_name(client)] has a banned account in connection history! https://iphub.info/?ip=[client.address] (Actual: [client.ckey], [client.address], [client.computer_id] ) (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" + suspect_message_to_admin_chat(msg) log_admin_private(msg) log_suspicious_login(msg, access_log_mirror = FALSE) diff --git a/config/bluemoon/discord.txt b/config/bluemoon/discord.txt index 21554be393360..6bde353eeaf50 100644 --- a/config/bluemoon/discord.txt +++ b/config/bluemoon/discord.txt @@ -15,3 +15,6 @@ BOT_ICON https://cdn.discordapp.com/attachments/1049298549550100480/128745238766 RANDOMIZING_MESSAGE_FOR_VIDEO Check this video!> RANDOMIZING_MESSAGE_FOR_VIDEO Did you see that? RANDOMIZING_MESSAGE_FOR_VIDEO OH shi~~ + +## Chat for suspicious login log +#CHAT_SUSPECT_LOGIN diff --git a/modular_bluemoon/phoenix404/code/entries.dm b/modular_bluemoon/phoenix404/code/entries.dm index d1a3e10b42cac..f4e3fc74eb213 100644 --- a/modular_bluemoon/phoenix404/code/entries.dm +++ b/modular_bluemoon/phoenix404/code/entries.dm @@ -8,3 +8,6 @@ /datum/config_entry/str_list/randomizing_message_for_video default = list() + +/datum/config_entry/string/chat_suspect_login + diff --git a/modular_bluemoon/phoenix404/modules/tgui_panel/telemetry.dm b/modular_bluemoon/phoenix404/modules/tgui_panel/telemetry.dm new file mode 100644 index 0000000000000..95c42a76af62d --- /dev/null +++ b/modular_bluemoon/phoenix404/modules/tgui_panel/telemetry.dm @@ -0,0 +1,7 @@ +// Proc for sending Suspicious Logins to Admin Chat +/proc/suspect_message_to_admin_chat(msg) + message_admins(msg) + var/suspect_chat_channel_tag = CONFIG_GET(string/chat_suspect_login) + if (suspect_chat_channel_tag) + var/tgs_msg = new /datum/tgs_message_content(msg) + send2chat(tgs_msg, suspect_chat_channel_tag) diff --git a/tgstation.dme b/tgstation.dme index bc89f63e65d8a..ae4953c321c6d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4562,6 +4562,7 @@ #include "modular_bluemoon\phoenix404\modules\player_ranks\code\player_rank_controller\_player_rank_controller.dm" #include "modular_bluemoon\phoenix404\modules\player_ranks\code\player_rank_controller\mentor_controller.dm" #include "modular_bluemoon\phoenix404\modules\player_ranks\code\player_rank_controller\subsystem\player_ranks.dm" +#include "modular_bluemoon\phoenix404\modules\tgui_panel\telemetry.dm" #include "modular_bluemoon\phoenix404\modules\vending\_vending.dm" #include "modular_bluemoon\phoenix404\modules\vending\assist.dm" #include "modular_bluemoon\phoenix404\modules\vending\autodrobe.dm" From f75c0aeb0f342af1978480470369396abe0cbe1a Mon Sep 17 00:00:00 2001 From: Phoenix404 <41524861+Phoenix4O4@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:18:50 +0300 Subject: [PATCH 2/4] additional comments, and guest checking --- code/modules/admin/IsBanned.dm | 25 ++++++++++++++----------- code/modules/tgui_panel/telemetry.dm | 4 ++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 825e2d83c7874..e0488f8201294 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -6,7 +6,7 @@ #define STICKYBAN_MAX_EXISTING_USER_MATCHES 5 //ie, users who were connected before the ban triggered #define STICKYBAN_MAX_ADMIN_MATCHES 2 -/world/IsBanned(key,address,computer_id,type,real_bans_only=FALSE) +/world/IsBanned(key, address, computer_id, type, real_bans_only=FALSE, guest_ban_check=TRUE) // BLUEMOON EDIT: TELEMETRY var/static/key_cache = list() if(!real_bans_only) if(key_cache[key] >= REALTIMEOFDAY) @@ -52,16 +52,19 @@ key_cache[key] = 0 return list("reason"="whitelist", "desc" = "\nReason: You are not on the white list for this server") - //Guest Checking - if(!real_bans_only && IsGuestKey(key)) - if (CONFIG_GET(flag/guest_ban)) - log_access("Failed Login: [key] - Guests not allowed") - key_cache[key] = 0 - return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.") - if (CONFIG_GET(flag/panic_bunker) && SSdbcore.Connect()) - log_access("Failed Login: [key] - Guests not allowed during panic bunker") - key_cache[key] = 0 - return list("reason"="guest", "desc"="\nReason: Sorry but the server is currently not accepting connections from never before seen players or guests. If you have played on this server with a byond account before, please log in to the byond account you have played from.") + // BLUEMOON EDIT START: TELEMETRY + // Guest Checking + if(guest_ban_check) // Check if guest_ban_check is enabled + if(!real_bans_only && IsGuestKey(key)) + if (CONFIG_GET(flag/guest_ban)) + log_access("Failed Login: [key] - Guests not allowed") + key_cache[key] = 0 + return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.") + if (CONFIG_GET(flag/panic_bunker) && SSdbcore.Connect()) + log_access("Failed Login: [key] - Guests not allowed during panic bunker") + key_cache[key] = 0 + return list("reason"="guest", "desc"="\nReason: Sorry but the server is currently not accepting connections from never before seen players or guests. If you have played on this server with a byond account before, please log in to the byond account you have played from.") + // BLUEMOON EDIT END: TELEMETRY //Population Cap Checking var/extreme_popcap = CONFIG_GET(number/extreme_popcap) diff --git a/code/modules/tgui_panel/telemetry.dm b/code/modules/tgui_panel/telemetry.dm index 4f7a6339dc208..7c3b04b20fda4 100644 --- a/code/modules/tgui_panel/telemetry.dm +++ b/code/modules/tgui_panel/telemetry.dm @@ -69,13 +69,13 @@ // Check for a malformed history object if (!row || row.len < 3 || (!row["ckey"] || !row["address"] || !row["computer_id"])) return - if (world.IsBanned(row["ckey"], row["address"], row["computer_id"], real_bans_only = TRUE)) + if (world.IsBanned(row["ckey"], row["address"], row["computer_id"], real_bans_only = TRUE, guest_ban_check=FALSE)) found = row break CHECK_TICK // This fucker has a history of playing on a banned account. if(found) var/msg = "[key_name(client)] has a banned account in connection history! https://iphub.info/?ip=[client.address] (Actual: [client.ckey], [client.address], [client.computer_id] ) (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" - suspect_message_to_admin_chat(msg) + suspect_message_to_admin_chat(msg) // BLUEMOON EDIT: Telemetry log_admin_private(msg) log_suspicious_login(msg, access_log_mirror = FALSE) From a3110f4a62fc585360d9e4466ed14a681475a3bd Mon Sep 17 00:00:00 2001 From: Phoenix404 <41524861+Phoenix4O4@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:25:50 +0300 Subject: [PATCH 3/4] perm check --- code/modules/tgui_panel/telemetry.dm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/modules/tgui_panel/telemetry.dm b/code/modules/tgui_panel/telemetry.dm index 7c3b04b20fda4..b2cebe0218e1a 100644 --- a/code/modules/tgui_panel/telemetry.dm +++ b/code/modules/tgui_panel/telemetry.dm @@ -74,8 +74,11 @@ break CHECK_TICK // This fucker has a history of playing on a banned account. + // BLUEMOON EDIT START: Telemetry if(found) - var/msg = "[key_name(client)] has a banned account in connection history! https://iphub.info/?ip=[client.address] (Actual: [client.ckey], [client.address], [client.computer_id] ) (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" - suspect_message_to_admin_chat(msg) // BLUEMOON EDIT: Telemetry - log_admin_private(msg) - log_suspicious_login(msg, access_log_mirror = FALSE) + if(client && !client.holder.check_for_rights(R_PERMISSIONS)) + var/msg = "[key_name(client)] has a banned account in connection history! https://iphub.info/?ip=[client.address] (Actual: [client.ckey], [client.address], [client.computer_id] ) (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" + suspect_message_to_admin_chat(msg) + log_admin_private(msg) + log_suspicious_login(msg, access_log_mirror = FALSE) + // BLUEMOON EDIT END: Telemetry From f803cb1869875fca813c8aee13fc31109079b973 Mon Sep 17 00:00:00 2001 From: Phoenix404 <41524861+Phoenix4O4@users.noreply.github.com> Date: Sun, 22 Dec 2024 10:46:48 +0300 Subject: [PATCH 4/4] small revert --- code/modules/admin/IsBanned.dm | 24 +++++++++++------------- code/modules/tgui_panel/telemetry.dm | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index e0488f8201294..d2fe45e3964cd 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -6,7 +6,7 @@ #define STICKYBAN_MAX_EXISTING_USER_MATCHES 5 //ie, users who were connected before the ban triggered #define STICKYBAN_MAX_ADMIN_MATCHES 2 -/world/IsBanned(key, address, computer_id, type, real_bans_only=FALSE, guest_ban_check=TRUE) // BLUEMOON EDIT: TELEMETRY +/world/IsBanned(key, address, computer_id, type, real_bans_only=FALSE) var/static/key_cache = list() if(!real_bans_only) if(key_cache[key] >= REALTIMEOFDAY) @@ -52,19 +52,17 @@ key_cache[key] = 0 return list("reason"="whitelist", "desc" = "\nReason: You are not on the white list for this server") - // BLUEMOON EDIT START: TELEMETRY // Guest Checking - if(guest_ban_check) // Check if guest_ban_check is enabled - if(!real_bans_only && IsGuestKey(key)) - if (CONFIG_GET(flag/guest_ban)) - log_access("Failed Login: [key] - Guests not allowed") - key_cache[key] = 0 - return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.") - if (CONFIG_GET(flag/panic_bunker) && SSdbcore.Connect()) - log_access("Failed Login: [key] - Guests not allowed during panic bunker") - key_cache[key] = 0 - return list("reason"="guest", "desc"="\nReason: Sorry but the server is currently not accepting connections from never before seen players or guests. If you have played on this server with a byond account before, please log in to the byond account you have played from.") - // BLUEMOON EDIT END: TELEMETRY + if(!real_bans_only && IsGuestKey(key)) + if (CONFIG_GET(flag/guest_ban)) + log_access("Failed Login: [key] - Guests not allowed") + key_cache[key] = 0 + return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.") + if (CONFIG_GET(flag/panic_bunker) && SSdbcore.Connect()) + log_access("Failed Login: [key] - Guests not allowed during panic bunker") + key_cache[key] = 0 + return list("reason"="guest", "desc"="\nReason: Sorry but the server is currently not accepting connections from never before seen players or guests. If you have played on this server with a byond account before, please log in to the byond account you have played from.") + //Population Cap Checking var/extreme_popcap = CONFIG_GET(number/extreme_popcap) diff --git a/code/modules/tgui_panel/telemetry.dm b/code/modules/tgui_panel/telemetry.dm index b2cebe0218e1a..a3f4461e7856d 100644 --- a/code/modules/tgui_panel/telemetry.dm +++ b/code/modules/tgui_panel/telemetry.dm @@ -69,14 +69,14 @@ // Check for a malformed history object if (!row || row.len < 3 || (!row["ckey"] || !row["address"] || !row["computer_id"])) return - if (world.IsBanned(row["ckey"], row["address"], row["computer_id"], real_bans_only = TRUE, guest_ban_check=FALSE)) + if (world.IsBanned(row["ckey"], row["address"], row["computer_id"], real_bans_only = TRUE)) found = row break CHECK_TICK // This fucker has a history of playing on a banned account. // BLUEMOON EDIT START: Telemetry if(found) - if(client && !client.holder.check_for_rights(R_PERMISSIONS)) + if(!client?.holder?.check_for_rights(R_PERMISSIONS)) var/msg = "[key_name(client)] has a banned account in connection history! https://iphub.info/?ip=[client.address] (Actual: [client.ckey], [client.address], [client.computer_id] ) (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" suspect_message_to_admin_chat(msg) log_admin_private(msg)