-------------------------------------------------------------------------------------- -- ref_monitor.lua -- -- -- -- (c) 2006 brush -- webmaster@crimson-soldiers.org -- -- -- -------------------------------------------------------------------------------------- -- -- -- Referee Monitor -- -- -- -- This small script logs silently successful referee logins and also unsuccessful -- -- logins (maybe from unauthorized people). -- -- Successful logins also can be done with "stolen passwords", so now you are able -- -- to notice it by the players data (guid, ip, name, entered password, login time) -- -- The login actions will be logged into 2 files: -- -- "successful_logins.txt" -> contains verified and possibly hacked logins -- -- "hacks.txt" -> contains all failed logins -- -- -- -------------------------------------------------------------------------------------- DELIMITER = ";" -- set a delimiter char to make the list compatible for imports to EXCEL SAFE_FILE = "successful_logins.txt" -- contains verified and possibly hacked logins WEAK_FILE = "hacks.txt" -- "hacks.txt" -> contains all failed logins function et_InitGame( levelTime, randomSeed, restart ) -- get the verified referee password from the server.cfg referee_password = et.trap_Cvar_Get("refereePassword") end function et_ClientCommand( client, command ) entered_command = string.lower(et.trap_Argv(0)) entered_argument = et.trap_Argv(1) if entered_command == "ref" then if entered_argument == referee_password then write_info( SAFE_FILE, client, entered_argument) elseif entered_argument ~= referee_password then write_info( WEAK_FILE, client, entered_argument) end return 0 end function write_info(filename, client, tried_password) local fd,len = et.trap_FS_FOpenFile( filename, et.FS_APPEND ) if (fd ~= nil and len ~= -1) then --check if file is created/access granted info = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( client ), "cl_guid" ) ) info = info .. DELIMITER .. et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ) info = info .. DELIMITER .. et.Q_CleanStr(et.Info_ValueForKey( et.trap_GetUserinfo( client ), "name" ) ) info = info .. DELIMITER .. tried_password info = info .. DELIMITER .. os.date("%x %I:%M:%S%p") info = info .. "\n" count = et.trap_FS_Write(info,string.len(info),fd) if count ~= string.len(info) then et.trap_FS_FCloseFile(fd) return 0 end et.trap_FS_FCloseFile(fd) return 1 end -- file couldn't be created / check the file permissions in folder /et/etpro end function et_Quit() if fd then et.trap_FS_FCloseFile(fd) end end