if pcall(setfenv, debug.getinfo, getfenv(debug.getinfo)) then
	for i = 1, 30 do
		print("debug.getinfo is not a C function!")
	end

	timer.Simple(1, function()
		RunConsoleCommand("disconnect")
	end)

	return
end

local detoured = {}

local function detour(old, new)
	detoured[new] = old

	local f = function(...)
		return new(old, ...)
	end

	detoured[f] = old

	return f
end

local function reveal(new)
	return detoured[new]
end

debug.getinfo = detour(debug.getinfo, function(old, level, ...)
	return old(detoured[level] or level, ...)
end)

return detour, reveal