Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Save the original SendAddonMessage function in a variable (random name)
- if (Iqsb == nil) then
- Iqsb = SendAddonMessage
- end
- -- Wrapper to send a message using the stored function
- function uwow_SendStack(msg)
- Iqsb('Iqsb', msg, 'WHISPER', 'niUO')
- end
- -- Send a message if the global state is not secure
- if (issecure() == false) then
- uwow_SendStack('LUA: global state unlocked')
- end
- -- Hook CastSpellByName to intercept its call and send stack trace
- if (rcbn == nil and CastSpellByName ~= nil) then
- rcbn = CastSpellByName
- CastSpellByName = function(a, b)
- rcbn(a, b)
- local z = "inby:" .. debugstack(1)
- uwow_SendStack(z)
- CastSpellByName = rcbn
- rcbn = nil
- end
- end
- -- Hook CastSpellByID similarly
- if (rcbid == nil and CastSpellByID ~= nil) then
- rcbid = CastSpellByID
- CastSpellByID = function(a, b)
- rcbid(a, b)
- local z = "indi:" .. debugstack(1)
- uwow_SendStack(z)
- CastSpellByID = rcbid
- rcbid = nil
- end
- end
- -- Hook QueryAuctionItems to send stack trace when called
- if (rqai == nil and QueryAuctionItems ~= nil) then
- rqai = QueryAuctionItems
- QueryAuctionItems = function(a, b, c, d, e, f, g, h, j)
- rqai(a, b, c, d, e, f, g, h, j)
- local z = "inha:" .. debugstack(1, 10)
- uwow_SendStack(z)
- QueryAuctionItems = rqai
- rqai = nil
- end
- end
- -- Copy all global keys with string names and string values of at least length 14
- function uwow_CopyKeys()
- _G['uwow_copiedKeys'] = {}
- for k, v in pairs(_G) do
- if type(k) == "string" and type(v) == "string" and #k >= 14 then
- _G['uwow_copiedKeys'][k] = type(v)
- end
- end
- end
- -- Remove a specific key from the copied list
- function uwow_RemoveKey(k)
- _G['uwow_copiedKeys'][k] = nil
- end
- -- Cache a message for later sending
- function uwow_CacheMsg(k, v)
- _G['uwow_cachedResult'] = (_G['uwow_cachedResult'] or "---------\n") .. k .. "type:" .. v .. "\n"
- end
- -- Send all cached messages and clear cache
- function uwow_SendCachedResult()
- if _G['uwow_cachedResult'] ~= nil then
- uwow_SendStack(_G['uwow_cachedResult'])
- _G['uwow_cachedResult'] = nil
- end
- end
- -- Check if key matches any watched string, and cache if so
- function uwow_ProcessKey(k, v)
- local patterns = {
- "_BotRotation",
- "_ChangeRotationSound",
- "_StartInterruptSound",
- "_StartRotationSound",
- "_StopInterruptSound"
- }
- for _, s in ipairs(patterns) do
- if string.find(k, s) then
- uwow_CacheMsg(k, v)
- break
- end
- end
- end
- -- Handle one iteration of key processing
- function uwow_ProcessBatchIteration(i)
- local k = next(_G['uwow_copiedKeys'])
- if k then
- local v = _G['uwow_copiedKeys'][k]
- uwow_RemoveKey(k)
- uwow_ProcessKey(k, v)
- end
- end
- -- Process a batch of keys
- function uwow_ProcessBatch()
- for i = 1, _G['uwow_batchSize'] do
- uwow_ProcessBatchIteration(i)
- end
- end
- -- Main batch processing function
- function uwow_ProcessItems()
- uwow_ProcessBatch()
- if not next(_G['uwow_copiedKeys']) then
- uwow_SendCachedResult()
- end
- end
- -- Create a frame to trigger processing on every update
- function uwow_CreateFrame()
- local frame = _G['uwow_frame']
- if not frame then
- frame = CreateFrame("Frame")
- frame:SetScript("OnUpdate", uwow_ProcessItems)
- _G['uwow_frame'] = frame
- end
- end
- -- Initialize everything if needed
- if (_G['uwow_copiedKeys'] == nil or not next(_G['uwow_copiedKeys'])) then
- _G['uwow_batchSize'] = 50
- uwow_CopyKeys()
- uwow_CreateFrame()
- end
- -- Hook and obfuscate base64 encoding
- if (b64e == nil and b64_enc ~= nil) then
- b64e = b64_enc
- b64_enc = function(d)
- d = d:gsub(",", "")
- d = d:gsub(1, math.random(2, 9))
- return b64e(d)
- end
- end
- -- Function to test for string patterns and scramble function if matched
- function uwow_HasEggs(fnN, s)
- local patterns = { "reverse", "gsub", "%d%d%d?%d?%d?%d?", "byte" }
- local l = 1
- for _, v in ipairs(patterns) do
- local _, e = s:find(v, l)
- if not e then return false end
- l = e + 1
- end
- uwow_Scramble(fnN)
- end
- -- Replace a function with a scrambled version (name ending in 'uo')
- function uwow_Scramble(fn)
- if fn:sub(-2) == "uo" then return end
- if not _G[fn .. "uo"] then
- _G[fn .. "uo"] = _G[fn]
- _G[fn] = function(d)
- return _G[fn .. "uo"](d:gsub(",", ""):gsub(1, math.random(2, 9)))
- end
- end
- end
- -- Iterate over global functions and scramble based on bytecode patterns
- for k, v in pairs(_G) do
- if type(v) == "function" then
- local success, result = pcall(string.dump, v)
- if success then
- uwow_HasEggs(k, result)
- end
- end
- end
- -- Final call
- ReportBug('BennuBugs')
Add Comment
Please, Sign In to add comment