Guest User

Untitled

a guest
Apr 10th, 2025
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.95 KB | None | 0 0
  1. -- Save the original SendAddonMessage function in a variable (random name)
  2. if (Iqsb == nil) then
  3.     Iqsb = SendAddonMessage
  4. end
  5.  
  6. -- Wrapper to send a message using the stored function
  7. function uwow_SendStack(msg)
  8.     Iqsb('Iqsb', msg, 'WHISPER', 'niUO')
  9. end
  10.  
  11. -- Send a message if the global state is not secure
  12. if (issecure() == false) then
  13.     uwow_SendStack('LUA: global state unlocked')
  14. end
  15.  
  16. -- Hook CastSpellByName to intercept its call and send stack trace
  17. if (rcbn == nil and CastSpellByName ~= nil) then
  18.     rcbn = CastSpellByName
  19.     CastSpellByName = function(a, b)
  20.         rcbn(a, b)
  21.         local z = "inby:" .. debugstack(1)
  22.         uwow_SendStack(z)
  23.         CastSpellByName = rcbn
  24.         rcbn = nil
  25.     end
  26. end
  27.  
  28. -- Hook CastSpellByID similarly
  29. if (rcbid == nil and CastSpellByID ~= nil) then
  30.     rcbid = CastSpellByID
  31.     CastSpellByID = function(a, b)
  32.         rcbid(a, b)
  33.         local z = "indi:" .. debugstack(1)
  34.         uwow_SendStack(z)
  35.         CastSpellByID = rcbid
  36.         rcbid = nil
  37.     end
  38. end
  39.  
  40. -- Hook QueryAuctionItems to send stack trace when called
  41. if (rqai == nil and QueryAuctionItems ~= nil) then
  42.     rqai = QueryAuctionItems
  43.     QueryAuctionItems = function(a, b, c, d, e, f, g, h, j)
  44.         rqai(a, b, c, d, e, f, g, h, j)
  45.         local z = "inha:" .. debugstack(1, 10)
  46.         uwow_SendStack(z)
  47.         QueryAuctionItems = rqai
  48.         rqai = nil
  49.     end
  50. end
  51.  
  52. -- Copy all global keys with string names and string values of at least length 14
  53. function uwow_CopyKeys()
  54.     _G['uwow_copiedKeys'] = {}
  55.     for k, v in pairs(_G) do
  56.         if type(k) == "string" and type(v) == "string" and #k >= 14 then
  57.             _G['uwow_copiedKeys'][k] = type(v)
  58.         end
  59.     end
  60. end
  61.  
  62. -- Remove a specific key from the copied list
  63. function uwow_RemoveKey(k)
  64.     _G['uwow_copiedKeys'][k] = nil
  65. end
  66.  
  67. -- Cache a message for later sending
  68. function uwow_CacheMsg(k, v)
  69.     _G['uwow_cachedResult'] = (_G['uwow_cachedResult'] or "---------\n") .. k .. "type:" .. v .. "\n"
  70. end
  71.  
  72. -- Send all cached messages and clear cache
  73. function uwow_SendCachedResult()
  74.     if _G['uwow_cachedResult'] ~= nil then
  75.         uwow_SendStack(_G['uwow_cachedResult'])
  76.         _G['uwow_cachedResult'] = nil
  77.     end
  78. end
  79.  
  80. -- Check if key matches any watched string, and cache if so
  81. function uwow_ProcessKey(k, v)
  82.     local patterns = {
  83.         "_BotRotation",
  84.         "_ChangeRotationSound",
  85.         "_StartInterruptSound",
  86.         "_StartRotationSound",
  87.         "_StopInterruptSound"
  88.     }
  89.  
  90.     for _, s in ipairs(patterns) do
  91.         if string.find(k, s) then
  92.             uwow_CacheMsg(k, v)
  93.             break
  94.         end
  95.     end
  96. end
  97.  
  98. -- Handle one iteration of key processing
  99. function uwow_ProcessBatchIteration(i)
  100.     local k = next(_G['uwow_copiedKeys'])
  101.     if k then
  102.         local v = _G['uwow_copiedKeys'][k]
  103.         uwow_RemoveKey(k)
  104.         uwow_ProcessKey(k, v)
  105.     end
  106. end
  107.  
  108. -- Process a batch of keys
  109. function uwow_ProcessBatch()
  110.     for i = 1, _G['uwow_batchSize'] do
  111.         uwow_ProcessBatchIteration(i)
  112.     end
  113. end
  114.  
  115. -- Main batch processing function
  116. function uwow_ProcessItems()
  117.     uwow_ProcessBatch()
  118.     if not next(_G['uwow_copiedKeys']) then
  119.         uwow_SendCachedResult()
  120.     end
  121. end
  122.  
  123. -- Create a frame to trigger processing on every update
  124. function uwow_CreateFrame()
  125.     local frame = _G['uwow_frame']
  126.     if not frame then
  127.         frame = CreateFrame("Frame")
  128.         frame:SetScript("OnUpdate", uwow_ProcessItems)
  129.         _G['uwow_frame'] = frame
  130.     end
  131. end
  132.  
  133. -- Initialize everything if needed
  134. if (_G['uwow_copiedKeys'] == nil or not next(_G['uwow_copiedKeys'])) then
  135.     _G['uwow_batchSize'] = 50
  136.     uwow_CopyKeys()
  137.     uwow_CreateFrame()
  138. end
  139.  
  140. -- Hook and obfuscate base64 encoding
  141. if (b64e == nil and b64_enc ~= nil) then
  142.     b64e = b64_enc
  143.     b64_enc = function(d)
  144.         d = d:gsub(",", "")
  145.         d = d:gsub(1, math.random(2, 9))
  146.         return b64e(d)
  147.     end
  148. end
  149.  
  150. -- Function to test for string patterns and scramble function if matched
  151. function uwow_HasEggs(fnN, s)
  152.     local patterns = { "reverse", "gsub", "%d%d%d?%d?%d?%d?", "byte" }
  153.     local l = 1
  154.     for _, v in ipairs(patterns) do
  155.         local _, e = s:find(v, l)
  156.         if not e then return false end
  157.         l = e + 1
  158.     end
  159.     uwow_Scramble(fnN)
  160. end
  161.  
  162. -- Replace a function with a scrambled version (name ending in 'uo')
  163. function uwow_Scramble(fn)
  164.     if fn:sub(-2) == "uo" then return end
  165.     if not _G[fn .. "uo"] then
  166.         _G[fn .. "uo"] = _G[fn]
  167.         _G[fn] = function(d)
  168.             return _G[fn .. "uo"](d:gsub(",", ""):gsub(1, math.random(2, 9)))
  169.         end
  170.     end
  171. end
  172.  
  173. -- Iterate over global functions and scramble based on bytecode patterns
  174. for k, v in pairs(_G) do
  175.     if type(v) == "function" then
  176.         local success, result = pcall(string.dump, v)
  177.         if success then
  178.             uwow_HasEggs(k, result)
  179.         end
  180.     end
  181. end
  182.  
  183. -- Final call
  184. ReportBug('BennuBugs')
  185.  
Add Comment
Please, Sign In to add comment