Skip to content

Commit 4449c45

Browse files
xLuxyqaisjp
authored andcommitted
runcode: add logging to crun and http
1 parent 3662da4 commit 4449c45

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

[admin]/runcode/server.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ addCommandHandler("crun",
6969
function (player, command, ...)
7070
local commandstring = table.concat({...}, " ")
7171
if player then
72+
outputChatBoxR(getPlayerName(player) .. " executed client-side command: " .. commandstring, false)
7273
return triggerClientEvent(player, "doCrun", rootElement, commandstring)
7374
else
7475
return runString(commandstring, false, false)
@@ -81,7 +82,8 @@ function httpRun(commandstring)
8182
if not user then outputDebugString ( "httpRun can only be called via http", 2 ) return end
8283

8384
-- check acl permission
84-
local objectName = "user." .. getAccountName(user)
85+
local accName = getAccountName(user)
86+
local objectName = "user." .. accName
8587

8688
if(not hasObjectPermissionTo(objectName, "command.srun", false)) then
8789
outputServerLog(getAccountName(user) .. " from " .. hostname .. " attempted to execute Lua code with missing acl permission (command.srun)")
@@ -106,6 +108,9 @@ function httpRun(commandstring)
106108
--It failed.
107109
return "Error: "..results[2]
108110
end
111+
112+
outputChatBoxR("[HTTP] " .. accName .. " from " .. hostname .. " executed command: " .. commandstring, false)
113+
109114
if not notReturned then
110115
local resultsString = ""
111116
local first = true

0 commit comments

Comments
 (0)