Lua-FiveM-Malware-Guard
Lua FiveM Malware Guard: A powerful resources extension for FiveM servers owners to enhance server security by preventing unauthorized Lua functions, managing resource permissions, and receiving real-time alerts via Discord webhooks.
Lua FiveM Malware Guard is a security-focused resources extension for FiveM servers owners. It is designed to prevent the usage of Lua functions such as os.execute, os.getenv, io.popen etc., and sensitive FiveM native functions in resources, and it allows the server owner to assign permissions to each resource to specify which functions are allowed. The resource also includes a Discord webhook system for alerting administrators of trigger attempts, with three levels of alerts: normal, high, and very high.
- Demo
- Features
- Usage Steps
- ToDo List
- Functions Covered
- How to Contribute
- Contact
- License
- Disclaimer and Limitations
- Prevent the usage of sensitive Lua functions and sensitive FiveM native functions.
- Control resource-level permissions for specific functions.
- Discord webhook integration for real-time alerts.
- Three levels of alerts (normal, high, very high).
- Zero Dependencies.
- Compatibility with All Frameworks, Whether you're using ESX, QBCore, vRP, or any other framework.
- Cross-Platform Compatibility with both Windows and Linux.
- Anti-Debugging and Override System.
-
Locate the
citizen/scripting/resource_init.lua
file within your FiveM server build files. -
Replace the existing
resource_init.lua
file with the one provided in this project. This ensures that theprotection.lua
file is loaded for all resources on your server. -
Navigate to the specific resource you want to protect.
-
Add the
protection.lua
file to the resource folder you wish to secure. -
Open the
protection.lua
file and configure your settings, including Discord webhook URLs and the functions allowed for this script. -
Copy the configured
protection.lua
file and paste it into any resource you want to protect. Be sure to adjust the settings as needed for each resource.
If you're interested in contributing to FiveM SecurityGuard, here are some tasks that need attention. Feel free to pick an item from the list, work on it, and submit a pull request. If you have new ideas or find issues not listed here, please open an issue to discuss them.
- Add more functions to enhance security coverage.
- Create Client Side functions security system, By using the TriggerServerEvent native to check.
- Explore the possibility of supporting other programming languages, such as JavaScript (JS) and C#.
- Implement additional security checks for the functions.
- Enhance the permission management system.
- Address any identified security vulnerabilities or bugs.
- Investigate and fix reported bugs or issues.
Here is a list of functions covered by Lua FiveM Malware Guard with descriptions and links to relevant documentation:
-
io.popen
- Description: Opens a pipe to execute a command and returns a file handle.
- Lua Documentation
-
os.execute
- Description: Executes an operating system command.
- Lua Documentation
-
os.clock
- Description: Returns an approximation of the amount in seconds of CPU time used by the program.
- Lua Documentation
-
os.getenv
- Description: Retrieves the value of an environment variable.
- Lua Documentation
-
os.remove
- Description: Removes a file or directory.
- Lua Documentation
-
os.rename
- Description: Renames a file or directory.
- Lua Documentation
-
io.read
- Description: Reads from a file.
- Lua Documentation
-
io.open
- Description: Opens a file or returns a new file handle.
- Lua Documentation
-
io.close
- Description: Closes the given file.
- Lua Documentation
-
io.input
- Description: Sets the default input file.
- Lua Documentation
-
io.write
- Description: Writes to the default output file.
- Lua Documentation
-
io.stdin
- Description: The standard input file.
- Lua Documentation
-
io.stdout
- Description: The standard output file.
- Lua Documentation
-
io.stderr
- Description: The standard error file.
- Lua Documentation
-
debug.getinfo
- Description: Retrieves information about a function.
- Lua Documentation
-
debug.getlocal
- Description: Gets information about a local variable.
- Lua Documentation
-
debug.getupvalue
- Description: Gets the value of an upvalue from a function.
- Lua Documentation
-
debug.sethook
- Description: Sets a new hook function for debugging. The hook function can be used to trace function calls, lines of code, or other events in Lua scripts.
- Lua Documentation
...
-
GetCurrentServerEndpoint
- Description: Returns the endpoint URL of the current server.
- FiveM Documentation
-
StartResource
- Description: Starts a specified resource.
- FiveM Documentation
-
StopResource
- Description: Stops a specified resource.
- FiveM Documentation
-
SetResourceKvpFloat
- Description: Sets a floating-point key-value pair for a resource.
- FiveM Documentation
-
SetResourceKvpFloatNoSync
- Description: Sets a floating-point key-value pair for a resource without synchronizing.
- FiveM Documentation
-
SetResourceKvpInt
- Description: Sets an integer key-value pair for a resource. This function is commonly used to store integer data associated with a resource.
- FiveM Documentation
-
SetResourceKvpIntNoSync
- Description: Sets an integer key-value pair for a resource without synchronizing it across the network. Use this function when you do not need to send the update to other clients.
- FiveM Documentation
-
SetResourceKvpNoSync
- Description: Sets a key-value pair for a resource without synchronizing it across the network. Use this function when you do not need to send the update to other clients.
- FiveM Documentation
-
SetResourceKvp
- Description: Sets a key-value pair for a resource. This function allows you to store various types of data associated with a resource.
- FiveM Documentation
-
SetHttpHandler
- Description: Sets a custom HTTP handler for resource-specific HTTP requests. You can use this function to customize the behavior of HTTP requests made by your resource.
- FiveM Documentation
-
SetMapName
- Description: Sets the map name for the server. This function is used to change the displayed map name in the server browser.
- FiveM Documentation
-
SetGameType
- Description: Sets the game type for the server. This function is used to change the displayed game type in the server browser.
- FiveM Documentation
-
SetConvar
- Description: Sets the value of a convar for the server. Convars are variables used for server configuration and settings.
- FiveM Documentation
-
GetConvar
- Description: Retrieves the value of a convar for the server. Use this function to access the value of a convar.
- FiveM Documentation
-
SetConvarReplicated
- Description: Sets the value of a convar for the server and replicates it to all connected clients.
- FiveM Documentation
-
SetConvarServerInfo
- Description: Sets a convar as a server info convar. Server info convars are used to display additional information about the server in the server browser.
- FiveM Documentation
-
SaveResourceFile
- Description: Saves a file within a resource. This function is used to create or update files within a resource's directory.
- FiveM Documentation
-
GetGameName
- Description: Retrieves the name of the game currently being played on the server.
- FiveM Documentation
-
GetGameBuildNumber
- Description: Retrieves the build number of the game currently being played on the server.
- FiveM Documentation
-
GetCurrentResourceName
- Description: Retrieves the name of the currently executing resource.
- FiveM Documentation
-
PerformHttpRequest
- Description: Performs an HTTP request from the server to a specified URL. This function allows you to make HTTP requests and handle the response.
- FiveM Documentation
-
DeleteFunctionReference
- Description: Deletes a reference to a specific function. This function is used to remove function references created with
DuplicateFunctionReference
. - FiveM Documentation
- Description: Deletes a reference to a specific function. This function is used to remove function references created with
-
DeleteResourceKvp
- Description: Deletes a key-value pair associated with a resource. This function removes a KVP (Key-Value Pair) associated with the current resource.
- FiveM Documentation
-
DeleteResourceKvpNoSync
- Description: Deletes a key-value pair associated with a resource without synchronizing it across the network.
- FiveM Documentation
-
DuplicateFunctionReference
- Description: Creates a duplicate reference to a specified function. This function is used to duplicate function references and store them for later use.
- FiveM Documentation
-
EnableEnhancedHostSupport
- Description: Enables enhanced host support for the server. This function allows for enhanced support for certain host features.
- FiveM Documentation
-
ExecuteCommand
- Description: Executes a console command on the server. Use this function to execute server-side console commands.
- FiveM Documentation
-
FlushResourceKvp
- Description: Flushes all key-value pairs associated with the current resource. This function removes all KVPs associated with the resource.
- FiveM Documentation
-
GetHashKey
- Description: Retrieves the hash value for a string. This function calculates a hash value for the input string.
- FiveM Documentation
-
GetHostId
- Description: Retrieves the host identifier of the server. This function returns the host ID of the server.
- FiveM Documentation
-
GetNumResources
- Description: Retrieves the number of loaded resources on the server. This function returns the total number of loaded resources.
- FiveM Documentation
-
GetPasswordHash
- Description: Retrieves the hashed password of a player using their server ID.
- FiveM Documentation
-
GetPlayerEndpoint
- Description: Retrieves the endpoint (IP and port) of a player.
- FiveM Documentation
-
GetPlayerIdentifier
- Description: Retrieves a player's identifier (license, steam, ip, etc.) based on their server ID.
- FiveM Documentation
-
GetNumPlayerIdentifiers
- Description: Retrieves the number of identifiers associated with a player.
- FiveM Documentation
-
GetNumPlayerIndices
- Description: Retrieves the number of player indices on the server.
- FiveM Documentation
-
GetNumPlayerTokens
- Description: Retrieves the number of player tokens (server ID) on the server.
- FiveM Documentation
-
GetNumResourceMetadata
- Description: Retrieves the number of metadata entries for a resource.
- FiveM Documentation
-
GetPlayerName
- Description: Retrieves the name of a player based on their server ID.
- FiveM Documentation
-
GetPlayerToken
- Description: Retrieves a player's token (server ID) based on their server ID.
- FiveM Documentation
-
GetResourcePath
- Description: Retrieves the path of a resource on the server.
- FiveM Documentation
-
LoadPlayerCommerceData
- Description: Loads commerce data for a player.
- FiveM Documentation
-
LoadPlayerCommerceDataExt
- Description: Loads extended commerce data for a player.
- FiveM Documentation
-
LoadResourceFile
- Description: Loads a file from a resource and returns its contents as a string.
- FiveM Documentation
-
NetworkGetEntityFromNetworkId
- Description: Retrieves an entity (object or ped) based on its network ID.
- FiveM Documentation
-
NetworkGetEntityOwner
- Description: Retrieves the owner (player) of a networked entity (object or ped).
- FiveM Documentation
-
NetworkGetFirstEntityOwner
- Description: Retrieves the owner (player) of the first networked entity (object or ped) found.
- FiveM Documentation
-
NetworkGetNetworkIdFromEntity
- Description: Retrieves the network ID of a networked entity (object or ped).
- FiveM Documentation
-
NetworkGetVoiceProximityOverride
- Description: Retrieves the voice proximity override level for a player.
- FiveM Documentation
-
RegisterConsoleListener
- Description: Registers a console command listener callback function.
- FiveM Documentation
-
RegisterResourceAsset
- Description: Registers a file or directory as a resource asset.
- FiveM Documentation
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and test thoroughly.
- Create a pull request with a clear description of your changes.
- Open an Issue: If you encounter a technical issue or have a specific request related to the project.
- Compliance and Problem Reporting: For compliance-related matters or to report any problems contact via Email: [email protected].
- Discord Community: Join M3LM Games vibrant Discord community for chatting with fellow contributors, planning and showcasing your achievements, and inquiring.
-
This project, Lua FiveM Malware Guard, is intended solely for educational and informational purposes. It is designed to provide a better understanding of potential security vulnerabilities within the FiveM platform and to help prevent the misuse of certain functions. The project's creators and contributors do not endorse or encourage any illegal or unethical activities, including but not limited to hacking, cheating, or any actions that violate the terms of service of the FiveM platform or the Laws.
-
Users of this project are responsible for their own actions and are expected to adhere to all applicable laws and regulations. The project's creators and contributors are not responsible for any misuse, harm, or legal consequences resulting from the use of this project.
-
It is essential to use this project responsibly and ethically, respecting the rules and policies of the FiveM platform and any relevant local, state, or federal laws. If you choose to use this project, you do so at your own risk, and the project's creators and contributors shall not be held liable for any actions or consequences arising from its use.
-
By using this project, you acknowledge and agree to the terms of this disclaimer. If you do not agree with these terms, you should refrain from using or contributing to this project.