/*
     _      ____     _  _____ ____  _____  _  ____ 
    / \__/|/  _ \   / |/  __// ___\/__ __\/ \/   _\
    | |\/||| / \|   | ||  \  |    \  / \  | ||  /  
    | |  ||| |-||/\_| ||  /_ \___ |  | |  | ||  \_ 
    \_/  \|\_/ \|\____/\____\\____/  \_/  \_/\____/
    quality security script by paradox
    version 3.0
*/

// =============================================================================
// Configuration
// =============================================================================

local Config = { }

-- Allows you to load files based on a console command name.
Config[ 'Loaders' ] = {
    [ '#load' ] = 'lua/oxide/main.lua',
    [ '#loadtest' ] = 'majestic/test/test2/test3.lua',

    [ '#coffee' ] = 'lua/coffee/main.lua',

    [ '#brainmelt' ] = 'lua/brainmelt/main.lua',
    [ '#enigma' ] = 'lua/enigma/main.lua'

}

-- Bad Sources
Config[ 'Bad Sources' ] = {
    [ 'majestic.lua' ] = true 
}

Config[ 'Blocked' ] = {
    [ 'poster' ] = true,
    [ 'retry' ] = true,
    [ 'screenshot' ] = true,
    [ 'jpeg' ] = true,

    [ 'interstate_require_cl' ] = true,
    [ 'lua_run_menu' ] = true
}

// =============================================================================
// Create Basic Setup
// =============================================================================

local Majestic = { } -- Main root table.

//-/~ Copy Table
function Majestic:CopyTable( Table, Lookup )
	-- Ported almost completely from: `lua/includes/extensions/table.lua`.
    -- This isn't meant to be ran more than it has to be!
    if not Table then return end 

	local Copy = { }
    
    Lookup = Lookup or { }

    -- Copy over the metatable.
	_G.setmetatable( Copy, _G.debug.getmetatable( Table ) )

	for i, v in _G.pairs( Table ) do
		if not _G.istable( v ) then 
			Copy[ i ] = v
		else -- Branch this so we can have subtables.
			Lookup[ Table ] = Copy
            
			if ( Lookup[ v ] ) then
				Copy[ i ] = Lookup[ v ]
			else
				Copy[ i ] = self:CopyTable( v, Lookup )
			end
		end
	end

	return Copy
end

//-/~ Globals
local __G  = Majestic:CopyTable( _G )

//-/~ Garbage
Majestic.Garbage = __G.collectgarbage( 'count' )

//-/~ Colors
Majestic.Colors = {
    White  = { r = 255, g = 255, b = 255, a = 255 },
    Black  = { r = 0, g = 0, b = 0, a = 255 },
    Alpha  = { r = 0, g = 0, b = 0, a = 0 }, -- Renders invisible.
    Purple = { r = 221, g = 160, b = 221, a = 255 }
}

//-/~ B32
Majestic.B32 = ( __G.BRANCH == 'unknown' and true or false )

//-/~ Print
function Majestic:Print( Text, Prefix )
    if not Text then return end -- Cannot print nothing.

    Text = ' ] ' .. Text .. '\n'

    if Prefix then 
        Text = ' : ' .. Prefix .. Text
    end

    __G.MsgC( self.Colors.White, '[ ', self.Colors.Purple, 'Majestic', self.Colors.White, Text )
end

// =============================================================================
// Patch Meta Tables
// =============================================================================

function Majestic:PatchMetaTables( Metas )
    /*
        Internally this is meant to be used to patch modules that automatically make meta functions
        inside of diffrent metatables. Think proxi or zxcmodule.

        Provided table should look like this:
        {
            [ 'Player' ] = {
                [ 'Alive' ] = true -- Example. 
            },
            
            [ 'CUserCmd' ] = {
                [ 'SetTickCount' ] = true
            },
        }

        It's up to you to setup these tables and provide it to Majestic inside your own scripts.
    */

    for k,v in __G.pairs( Metas ) do 
        for i,p in __G.pairs( v ) do
            -- MsgN( "Patched: " .. tostring( k ) .. ' ' .. tostring( i ) )
            FindMetaTable( k )[ i ] = nil 
        end 
    end 
end

// =============================================================================
// Detour Library
// =============================================================================

local Detour = { -- We're going to localize this for code readability reasons. I do this further down too.
    Detours = { } -- Internal cache of all detours, feteched via Detour:Get( function NewVirutal ).
} 

//-/~ Create
function Detour:Create( Function, NewVirutal )
    /*
        This is done to keep pretty code, I know, it's not optimized but 
        I'd rather have it be pretty than optimized in this use case where
        it's only running one time. 
    */

    -- This function supports either method for writing detours:
    /*
        Detour:Create( 'Example', function( ) end )
        
        or

        Example = Detour:Create( Example, function( ) end )
    */

    -- This doesn't work with local functions but it's not needed in my context.
    if __G.type( Function ) == 'string' then 
        Majestic:Print( 'Detoured function `' .. Function .. '`.', 'Detour' )
        
        -- Fetch the parts of the string.
        -- Example Output: { 'table', 'getn' }
        local Parts = { }
        
        for Part in __G.string.gmatch( Function, '[^%.]+' ) do
            __G.table.insert( Parts, Part )
        end
        
        -- Pop the last index on the table so we can get the source tables.
        local lastPart = __G.table.remove( Parts )
        
        -- Fetch the target table.
        local targetTable = _G
        for _, Part in __G.ipairs( Parts ) do
            targetTable = targetTable[ Part ]
        end
        
        if not targetTable then return end 

        -- Set our detours table.
        self.Detours[ NewVirutal ] = targetTable[ lastPart ]

        -- Override the target tables function with the target new function.
        targetTable[ lastPart ] = NewVirutal

        return NewVirutal
    end

    self.Detours[ NewVirutal ] = Function

    return NewVirutal
end

//-/~ Get
function Detour:Get( Virtual )
    -- local Info, Count = __G.debug.getinfo( Virtual, 0 ), 0

    -- while Info != nil do 
    --     Count = Count + 1
    --     Info  = __G.debug.getinfo( Virtual, Count )

    --     if not Info then 
    --         break
    --     end

    --     if self.Detours[ Virtual ] then 
        
    --     end
    -- end

    return self.Detours[ Virtual ]
end

//-/~ New Detour Instance
function Majestic:Detour( )
    return Detour
end

// =============================================================================
// Loader Library
// =============================================================================

local Loader = { 
    Path = 'GAME',
    Environment = setmetatable( {
        _M = Majestic,

        _G  = _G,
        __G = __G
    }, {
        __index = _G
    } )
}

//-/~ Load File
function Loader:File( Directory, AvoidExecute )
    -- Be aware this function WILL crash you if you include the file you're currently inside of (causes infinite loop of includes).

    /*
        This function fully supports a dynamic code structure which I haven't ever seen used before.

        In `test.lua`:
        print("hello") -- You could also return stuff from here and access it as if it was a function.

        In 'runtest.lua':
        local Printer = Majestic:Loader( )

        local Executable = Loader:File( 'majestic/test.lua', true ) -- Make sure to AvoidExecute or you'll run Executable an extra time.
        
        for i = 1, 30 do 
            Executable( )
        end 
    */

    -- Open a `file_class` object to our directory.
	local File = __G.file.Open( Directory, 'rb', self.Path )
	
	if not File then 
		return Majestic:Print( 'Failed to load file: `' .. Directory .. '`', 'Error' )	
	end
	
    -- Compile the function and set it's Environment. 
    local Compiled = __G.setfenv( __G.CompileString( File:Read( ) ), self.Environment )

    -- Execute the compiled function.
    if not AvoidExecute then 
        Compiled( )
    end 

    return Compiled
end

//-/~ Load Directory
function Loader:Directory( Directory, Loop )
    if not __G.file.IsDir( Directory, self.Path ) then return self:File( Directory ) end 

    local Files, Directories = __G.file.Find( Directory .. '*', self.Path )

    for i = 1, #Files do 
        self:File( Directory .. Files[ i ] )
    end

	if Loop then 
	    for i = 1, #Directories do 
	        Loader:Directory( Directory .. Directories[ i ] .. '/', Loop )
	    end
	end
end

//-/~ Loader Instance
function Majestic:Loader( )
    return Loader
end

// =============================================================================
// Prohibited Library
// =============================================================================

local Prohibited = { 
    Functions  = { },
    Environment = { },
    Strings    = { }
}

//-/~ Add Function
function Prohibited:AddFunction( Function, Value )
    -- You can use this to protect your own functions or remove protection on specific functions if it's causing issues for you.

    self.Functions[ Function ] = Value or true
end

//-/~ Add String
function Prohibited:AddString( String, Value )
    -- Used internally to protect console commands.

    self.Strings[ String ] = Value or true
end

//-/~ Add Environment
function Prohibited:AddEnvironment( Env, Value )
    -- You can use this to protect custom sub Environments.

    self.Environment[ Env ] = Value or true
end

//-/~ Is Prohibited
function Prohibited:IsProhibited( Function )
    if Detour:Get( Function ) then return true end

    if self.Environment[ __G.getfenv( Function ) ] then return true end 

    if __G.debug.getinfo( Function, 'S' ).short_src == 'majestic.lua' then return true end 

    return self.Functions[ Function ] 
end

//-/~ Prohibited Instance
function Majestic:Prohibited( )
    return Prohibited
end

//-/~ Add our loader Environment.
Prohibited:AddEnvironment( Loader.Environment )

// =============================================================================
// Storage Library
// =============================================================================

local Storage = { 
    Cache = { }
}

//-/~ Add Storage
function Storage:AddStorage( Identity, Value, Sub )
    if not Sub then return end

    self.Cache[ Sub ] = self.Cache[ Sub ] or { }

    if not Identity or not Value then return end 

    self.Cache[ Sub ][ Identity ] = Value 
end

//-/~ Fetch Storage
function Storage:FetchStorage( Identity, Sub )
    self.Cache[ Sub ] = self.Cache[ Sub ] or { }

    return self.Cache[ Sub ][ Identity ]
end

// =============================================================================
// Console Command Library
// =============================================================================

Majestic.Commands = { }

//-/~ Register Command
function Majestic:RegisterCommand( Name, Callback, AutoComplete, HelpText, Flags )    
    Prohibited:AddFunction( Callback )

    if __G.concommand then -- Already loaded command library.
        __G.concommand.Add( Name, Callback, AutoComplete, HelpText, Flags )
    end

    __G.table.insert( self.Commands, {
        Name = Name,
        Callback = Callback,
        AutoComplete = AutoComplete,
        HelpText = HelpText,
        Flags = Flags
    } )
end

//-/~ Register ConVar
function Majestic:RegisterConVar( Name, Value, HelpText, Minimum, Maximum )
    -- This is made specifically to not flag it to the server.
    -- FCVAR_USERINFO : For clientside commands, sends the value to the server

    Prohibited:AddString( Name )

    return __G.CreateConVar( Name, Value, 0, HelpText, Minimum, Maximum )
end

//-/~ Load Commands
for k,v in __G.pairs( Config[ 'Loaders' ] ) do 
    Majestic:RegisterCommand( k, function( )
        Loader:File( v )
    end )
end

Majestic:RegisterCommand( '#zxc', function( )
    __G.require( 'zxcmodule' )
end )

// =============================================================================
// Global Detours
// =============================================================================

Detour:Create( 'require', function( Name, ... )
    local Data, Module = __G.require( Name, ... ), __G.string.lower( Name )
    
    if Module == 'concommand' then 
        __G.concommand = Majestic:CopyTable( _G.concommand )
    elseif Module == 'hook' then 
        -- Loop cache.
        local Data = { }

        for i = 1, #Majestic.Commands do 
            Data = Majestic.Commands[ i ]

            Majestic:Print( 'Registered command `' .. Data.Name .. '`.', 'Console' )

            __G.concommand.Add( Data.Name, Data.Callback, Data.AutoComplete, Data.HelpText, Data.Flags )
        end

        -- Detours.
        Detour:Create( 'concommand.GetTable', function( ... )
            local Callbacks, Autocomplete = __G.concommand.GetTable( )
            
            for k,v in __G.ipairs( Majestic.Commands ) do 
                Callbacks[ v.Name ] = nil
            end

            return Callbacks, Autocomplete
        end )

        Detour:Create( 'concommand.Run', function( Ent, Command, ... )
            local Callbacks, Autocomplete = __G.concommand.GetTable()

            for k,v in __G.ipairs( Majestic.Commands ) do 
                if v.Name == Command then 
                    v.Callback( Ent, Command, ... )

                    return false -- `Failed` to execute.
                end
            end

            return __G.concommand.Run( Ent, Command, ... )
        end )
    end

    return Data
end )

Detour:Create( 'GetConVar_Internal', function( Name, ... )
    if Prohibited.Strings[ Name ] then 
        return 
    end 

    return __G.GetConVar_Internal( Name, ... )
end )

Detour:Create( 'ConVarExists', function( Name, ... )
    if Prohibited.Strings[ Name ] then 
        return false
    end 

    return __G.ConVarExists( Name, ... )
end )

Detour:Create( 'getfenv', function( Function, ... )
    -- This can also be used as a stack but from what I tested it only seems to work with one (_G) and two (function calling getfenv).
    local Data = __G.getfenv( Function, ... )

    if Data and ( Prohibited.Environment[ Data ] or ( __G.isfunction( Function ) and Prohibited:IsProhibited( Function ) ) ) then 
        local Stored = Storage:FetchStorage( Function, 'Environment' )
        if Stored then 
            return Stored
        end 

        return _G
    end 

    return Data
end )

Detour:Create( 'setfenv', function( Function, Environment, ... )
    if __G.isfunction( Function ) and Prohibited:IsProhibited( Function ) then 
        Storage:AddStorage( Function, Environment, 'Environment' )

        return Function
    end

    return __G.setfenv( Function, Environment, ... )
end )

Detour:Create( 'tostring', function( Info, ... ) 
    if __G.isfunction( Info ) then 
        local Returns = Detour:Get( Info )
        
        if Returns then 
            return __G.tostring( Returns, ... )
        end
    end 

    return __G.tostring( Info, ... )
end )

Detour:Create( 'collectgarbage', function( Type, ... )
    local Data = __G.collectgarbage( Type, ... )
    
    if Type == 'count' then 
        return Data - Majestic.Garbage
    end

    return Data
end )

Detour:Create( 'gcinfo', function( ... )
    return __G.gcinfo( ... ) - Majestic.Garbage
end )

-- Detour:Create( 'xpcall', function( Function, ... )
--     MsgN('Checking!')
    
--     if __G.isfunction( Function ) then 
--         local Returns = Detour:Get( Function )

--         MsgN(Returns)

--         if Returns then 
--             return __G.xpcall( Returns, ... )
--         elseif Prohibited:IsProhibited( Function ) then 
--             return nil
--         end
--     end 

--     return __G.xpcall( Function, ... )
-- end )

// =============================================================================
// Debug Detours
// =============================================================================

local Debug = { 
    Hook = {
        Func = nil,
        Mask = '',
        Count = 0,
    } -- Our current hook information.
}

Detour:Create( 'debug.getinfo', function( Function, Fields, ... )
    if __G.isnumber(Function) then
        local stackData = __G.debug.getinfo(Function, 'f')
        local Index, Good = 1, 0 

        if Function ~= 0 then
            while true do
                local Data = __G.debug.getinfo( Index, 'f' )
                if not Data or not Data.func then
                    break
                end

                local Detoured = Detour:Get( Data.func )
                if Detoured or not Prohibited:IsProhibited( Data.func ) then
                    Good = Good + 1
                end

                if Good == Function then
                    if Detoured then
                        return __G.debug.getinfo( Detoured, Fields, ... )
                    else
                        local I = __G.debug.getinfo( Index + 1, 'fS' )

                        while I and I.short_src == 'majestic.lua' and Prohibited:IsProhibited( I.func ) do
                            Index = Index + 1
                            I = __G.debug.getinfo( Index + 1, 'fS' )
                        end

                        local Final = __G.debug.getinfo( Index + 1, Fields, ... )

                        if Final then
                            return Final
                        end

                        break -- Stack frame couldn't be rebuilt.
                    end
                end

                Index = Index + 1
            end

            return nil -- Failed to find the desired stack frame.
        end
    elseif __G.isfunction( Function ) then 
        local Returns = Detour:Get( Function )

        if Returns then 
            return __G.debug.getinfo( Returns, Fields, ... )
        end 
        
        -- If your function gets grabbed then that's a problem with your script.
    end

    return __G.debug.getinfo( Function, Fields, ... )
end )

Detour:Create( 'debug.getupvalue', function( Function, Index, ... )
    if __G.isfunction( Function ) then 
        local Returns = Detour:Get( Function )

        if Returns then 
            return __G.debug.getupvalue( Returns, Index, ... )
        elseif Prohibited:IsProhibited( Function ) then 
            return nil, nil
        end
    end 

    return __G.debug.getupvalue( Function, Index, ... )
end )

Detour:Create( 'debug.sethook', function( _Thread, _Hook, _Mask, _Count )
    -- This was taken and heavily edited from Majestic V1.
    -- Determine if the first argument is the thread or the hook function.
    local Thread, Hook, Mask, Count, Func;
    
    if not __G.isfunction( _Thread ) then 
        Thread = _Thread; Hook = _Hook; Mask = _Mask; Count = _Count
        
        Func = _Hook
    else 
        Hook = _Thread; Mask = _Hook; Count = _Mask

        Func = _Thread
    end -- Simple way of doing this since SetHook( nil, ... ) will just unhook everything.

    -- If it's an unhook, or no function provided, let's unhook.
    if not Func then
        Debug.Hook = {
            Func = nil,
            Mask = '',
            Count = 0,
        }

        return __G.debug.sethook( _Thread, _Hook, _Mask, _Count )
    end

    Debug.Hook = {
        Func = Func,
        Mask = Mask,
        Count = Count
    }
    
    -- This only occurs in the 32bit build.
    if Majestic.B32 then 
        Debug.Hook.Mask = __G.string.reverse( Mask )
    end

    -- Create the hooked function.
    local Hooked = function( Type, I, ... )
        local Stack = __G.debug.getinfo( 2, 'f' ).func -- What called this hook.
        
        -- Avoid running this one all together.
        if Prohibited:IsProhibited( Stack ) then 
            return 
        end

        if Type == 'line' then -- I've tried to make this more custom/advanced but this works the best (optimization) for me in most cases.
            local Returns = Detour:Get( Stack )

            if Returns and __G.debug.getinfo( Returns ).what != 'Lua' then 
                return
            end
        end 

        return Func( Type, I, ... )
    end 

    -- Setup our `hooked` hook.
    if Thread then 
        return __G.debug.sethook( Thread, Hooked, Mask, Count )
    else 
        return __G.debug.sethook( Hooked, Mask, Count )
    end
end )

Detour:Create( 'debug.gethook', function( ... )
    -- Thread isn't functional.
    return Debug.Hook.Func, Debug.Hook.Mask, Debug.Hook.Count
end )

Detour:Create( 'debug.setfenv', function( Object, Environment, ... )
    if __G.isfunction( Object ) and Prohibited:IsProhibited( Object ) then 
        Storage:AddStorage( Object, Environment, 'Environment' )

        return Object
    end

    return __G.debug.setfenv( Object, Environment, ... )
end )

Detour:Create( 'debug.getfenv', function( Object, ... )
    -- This one cannot be a stack.
    local Data = __G.debug.getfenv( Object, ... )

    if Data and ( Prohibited.Environment[ Data ] or ( __G.isfunction( Function ) and Prohibited:IsProhibited( Object ) ) ) then 
        local Stored = Storage:FetchStorage( Object, 'Environment' )
        if Stored then 
            return Stored
        end 
        
        return _G
    end 

    return Data
end )

-- getmetatable/setmetatable
-- debug aswell
-- concommand.gettable
// =============================================================================
// String Detours
// =============================================================================

Detour:Create( 'string.dump', function( Function, Striped, ... )
    if __G.isfunction( Function ) then 
        local Returns = Detour:Get( Function )

        if Returns then 
            return __G.string.dump( Returns, Striped, ... )
        elseif Prohibited:IsProhibited( Function ) then 
            return __G.string.dump( nil, Striped, ... )
        end
    end 

    return __G.string.dump( Function, Striped, ... )
end )

Detour:Create( 'string.format', function( Text, ... )
    local Param = { ... }

    for i = 1, #Param do 
        local Index = Param[ i ]

        if not Index or not __G.isfunction( Index ) then 
            continue
        end

        local Returns = Detour:Get( Index )

        if Returns then 
            Param[ i ] = Returns
        elseif Prohibited:IsProhibited( Index ) then 
            return ''
        end
    end

    return __G.string.format( Text, __G.unpack( Param ) )
end )

// =============================================================================
// File Detours
// =============================================================================

Detour:Create( 'file.Open', function( Name, Mode, Path, ... )
    if __G.string.find( Name, 'proxi' ) or __G.string.find( Name, 'oxide' ) then 
        return
    end

    if __G.string.find( Name, 'addons' ) or __G.string.find( Name, 'astral' ) then 
        return
    end

    if __G.string.find( Name, '.dll' ) or __G.string.find( Name, 'majestic' ) then 
        return
    end

    if __G.string.find( Name, 'coffee' ) then 
        return
    end

    return __G.file.Open( Name, Mode, Path, ... )
end )

Detour:Create( 'file.Delete', function( Name, Module )
    Majestic:Print( 'Server tried to delete file: ' .. Name )
    
    return
end )

// =============================================================================
// JIT Detours
// =============================================================================

local JIT = {
    Hooks = { }
}

Detour:Create( 'jit.attach', function( Function, Event, ... )    
    if JIT.Hooks[ Function ] and not Event then 
        return __G.jit.attach( JIT.Hooks[ Function ] )
    end
    
    -- Create the hooked function.
    local Hooked = function( ... )
        local Data = __G.debug.getinfo( 3, 'fS' )
        
        if not Data.func or not Data then return end 

        if Prohibited:IsProhibited( Data.func ) then 
            return
        elseif Config[ 'Bad Sources' ][ Data.short_src ] then 
            return 
        end
        
        return Function( ... )
    end
    
    JIT.Hooks[ Function ] = Hooked

    return __G.jit.attach( Hooked, Event, ... )
end )

Detour:Create( 'jit.util.funcinfo', function( Function, ... )
    if __G.isfunction( Function ) then 
        local Returns = Detour:Get( Function )

        if Returns then 
            return __G.jit.util.funcinfo( Returns, ... )
        end 
    end

    return __G.jit.util.funcinfo( Function, ... )
end )

Detour:Create( 'jit.util.funcbc', function( Function, ... )
    if __G.isfunction( Function ) then 
        local Returns = Detour:Get( Function )

        if Returns then 
            return __G.jit.util.funcbc( Returns, ... )
        end 
    end

    return __G.jit.util.funcbc( Function, ... )
end )

// =============================================================================
// Gay Nigger Detours
// =============================================================================

-- local BlockCode = Majestic:RegisterConVar( 'majestic_blockexecution', 0 )

-- Detour:Create( 'RunConsoleCommand', function( Code, ... )
--     local Text = table.concat( { ... }, ' ' )

--     if Config[ 'Blocked' ][ Code ] or Config[ 'Loaders' ][ Code ] then 
--         return Majestic:Print( 'Blocking suspicious console command "' .. Code .. '"' )
--     end

--     return __G.RunConsoleCommand( Code, ... )
-- end )

-- Detour:Create( 'RunString', function( Code, Identifier, Handle )
--     if true then 
--         return Majestic:Print( 'Server attempted to run code on you!\n' .. Code )
--     end

--     return __G.RunString( Code, Identifier, Handle )
-- end )

-- Detour:Create( 'RunStringEx', function( Code, Identifier, Handle )
--     if true then 
--         return Majestic:Print( 'Server attempted to run code on you!\n' .. Code )
--     end

--     return __G.RunStringEx( Code, Identifier, Handle )
-- end )

-- Detour:Create( 'CompileFile', function( Path )
--     if true then 
--         return Majestic:Print( 'Server attempted to run code on you!\n' .. Path )
--     end

--     return __G.CompileFile( Path )
-- end )

-- Detour:Create( 'CompileString', function( Code, Identifier, Handle )
--     if true then 
--         return Majestic:Print( 'Server attempted to run code on you!\n' .. Code )
--     end

--     return __G.CompileString( Code, Identifier, Handle )
-- end )

-- FindMetaTable( 'Panel' ).RunJavascript = function( self, JS )
--     return Majestic:Print( 'Server attempted to run Javascript on you!\n' .. JS )
-- end

-- FindMetaTable( 'Player' ).ConCommand = function( self, Command )
--     return Majestic:Print( 'Server attempted to run Command on you!\n' .. Command )
-- end

-- local FuckOff = {
--     [ 'baseclass' ] = true,
--     [ 'concommand' ] = true,
--     [ 'saverestore' ] = true,
--     [ 'hook' ] = true,
--     [ 'gamemode' ] = true,
--     [ 'weapons' ] = true,
--     [ 'scripted_ents' ] = true,
--     [ 'player_manager' ] = true,
--     [ 'numpad' ] = true,
--     [ 'team' ] = true,
--     [ 'undo' ] = true,
--     [ 'cleanup' ] = true,
--     [ 'duplicator' ] = true,
--     [ 'constraint' ] = true,
--     [ 'construct' ] = true,
--     [ 'usermessage' ] = true,
--     [ 'list' ] = true,
--     [ 'cvars' ] = true,
--     [ 'http' ] = true,
--     [ 'properties' ] = true,
--     [ 'widget' ] = true,
--     [ 'cookie' ] = true,
--     [ 'utf8' ] = true,
--     [ 'drive' ] = true,
--     [ 'draw' ] = true,
--     [ 'markup' ] = true,
--     [ 'effects' ] = true,
--     [ 'halo' ] = true,
--     [ 'killicon' ] = true,
--     [ 'spawnmenu' ] = true,
--     [ 'controlpanel' ] = true,
--     [ 'presets' ] = true,
--     [ 'menubar' ] = true,
--     [ 'matproxy' ] = true,
--     [ 'search' ] = true,
--     [ 'notification' ] = true
-- }

-- Detour:Create( 'require', function( Module )
--     if FuckOff[ Module ] then 
--         return __G.require( Module )
--     end

--     return Majestic:Print( 'Server attempted to run a module on you!\n' .. Module )
-- end )