mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-07-18 18:42:59 +01:00
Paranoid logging and byond account age
Adds the PARANOIA_LOGGING setting to config.txt (and PANIC_BUNKER which was missing for some reason) and updates example. PARANOIA_LOGGING (also available as a verb for admins in Server) begins notifying admins of any 0day byond accounts, or users who have never joined before. For when you don't quite want to panic bunker. Also makes this information available in player panel. Requires SQL connection.
This commit is contained in:
@@ -46,9 +46,11 @@
|
||||
////////////////////////////////////
|
||||
//things that require the database//
|
||||
////////////////////////////////////
|
||||
var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days.
|
||||
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
|
||||
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
|
||||
var/player_age = "(Requires database)" //So admins know why it isn't working - Used to determine how old the account is - in days.
|
||||
var/related_accounts_ip = "(Requires database)" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
|
||||
var/related_accounts_cid = "(Requires database)" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
|
||||
var/account_join_date = "(Requires database)"
|
||||
var/account_age = "(Requires database)"
|
||||
|
||||
preload_rsc = PRELOAD_RSC
|
||||
|
||||
|
||||
@@ -162,8 +162,12 @@
|
||||
winset(src, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
|
||||
if(config.aggressive_changelog)
|
||||
src.changes()
|
||||
|
||||
|
||||
|
||||
if(config.paranoia_logging)
|
||||
if(isnum(player_age) && player_age == 0)
|
||||
log_and_message_admins("PARANOIA: [key_name(src)] has connected here for the first time.")
|
||||
if(isnum(account_age) && account_age <= 2)
|
||||
log_and_message_admins("PARANOIA: [key_name(src)] has a very new BYOND account ([account_age] days).")
|
||||
|
||||
//////////////
|
||||
//DISCONNECT//
|
||||
@@ -220,6 +224,12 @@
|
||||
player_age = text2num(query.item[2])
|
||||
break
|
||||
|
||||
account_join_date = sanitizeSQL(findJoinDate())
|
||||
if(account_join_date && dbcon.IsConnected())
|
||||
var/DBQuery/query_datediff = dbcon.NewQuery("SELECT DATEDIFF(Now(),'[account_join_date]')")
|
||||
if(query_datediff.Execute() && query_datediff.NextRow())
|
||||
account_age = text2num(query_datediff.item[1])
|
||||
|
||||
var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ip = '[address]'")
|
||||
query_ip.Execute()
|
||||
related_accounts_ip = ""
|
||||
@@ -363,3 +373,16 @@ client/verb/character_setup()
|
||||
set category = "Preferences"
|
||||
if(prefs)
|
||||
prefs.ShowChoices(usr)
|
||||
|
||||
/client/proc/findJoinDate()
|
||||
var/list/http = world.Export("http://byond.com/members/[ckey]?format=text")
|
||||
if(!http)
|
||||
log_world("Failed to connect to byond age check for [ckey]")
|
||||
return
|
||||
var/F = file2text(http["CONTENT"])
|
||||
if(F)
|
||||
var/regex/R = regex("joined = \"(\\d{4}-\\d{2}-\\d{2})\"")
|
||||
if(R.Find(F))
|
||||
. = R.group[1]
|
||||
else
|
||||
CRASH("Age check regex failed for [src.ckey]")
|
||||
|
||||
Reference in New Issue
Block a user