From 9878aeaeb2b59f7bef2eafbadf34b34b2e8e37f3 Mon Sep 17 00:00:00 2001 From: R0adRa93 <42512379+r0adra93@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:01:36 -0500 Subject: [PATCH] Added PrepForSQL function (#914) performs a check to a string with expected patterns to be matched. --- server/functions.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/functions.lua b/server/functions.lua index c472b68..7df5403 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -414,3 +414,15 @@ end function QBCore.Functions.Notify(source, text, type, length) TriggerClientEvent('QBCore:Notify', source, text, type, length) end + +--- SQL Pattern Matching +function QBCore.Functions.PrepForSQL(source,data,pattern) + local src = source + local player = QBCore.Functions.GetPlayer(src) + local result = string.match(data, pattern) + if not result or string.len(result) ~= string.len(data) then + TriggerEvent('qb-log:server:CreateLog', 'anticheat', 'SQL Injection Attempted', 'red', string.format('%s Attempted a SQL Exploit!', player.PlayerData.license)) + return false + end + return true +end \ No newline at end of file