Advertisement
GO0GL3_CHR0M3

NigfuscatorPart2

Jun 5th, 2019
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. ]]
  2. --
  3.  
  4. function Obfuscate(scr)
  5. --concat
  6. local concat = function(...) return table.concat({...}, "") end
  7. --stringDump1
  8. local function dumpString(x) return concat("\"", x:gsub(".", function(d) return "\\" .. string.byte(d) end), "\"") end
  9. --stringDump2
  10. local function dumpString2(x)
  11. local x2 = "\""
  12. local x3 = ""
  13. for _,__ in x:gmatch("%[(=*)%[(.-)%]%1%]") do
  14. x3 = __:gsub(".", function(d) return "\\" .. string.byte(d) end)
  15. end
  16. return concat(x2, x3, x2)
  17. end
  18. --stringDump3
  19. local function dumpString3(x)
  20. return(x:gsub(".", function(bb) return "\\" .. bb:byte() end) or thing .. "\"")
  21. end
  22. --Bye comments
  23.  
  24. scr = scr:gsub("(%-%-%[(=*)%[.-%]%2%])", "")
  25. scr = scr:gsub("(%-%-[^\r\n]*)", "")
  26. --Functions rename
  27.  
  28. local chars ="1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1I1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1I1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1I1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1"
  29. local taken = { }
  30. taken[""] = true
  31. local function GetReplacement()
  32. local s = ""
  33. while taken[s] do
  34. for i = 1, math.random(20, 60) do
  35. local c = chars:sub(i,i)
  36. s = s..c
  37. end
  38. end
  39.  
  40. taken[s] = true
  41. return(customVarNames[math.random(1,#customVarNames)].. s)
  42. end
  43. local library = {}
  44. --wipe strings
  45. for each in scr:gmatch('"(%w+)"') do
  46. scr = scr:gsub('"'..each..'"', "'"..dumpString3(each).."'")
  47. end
  48.  
  49.  
  50.  
  51. --local functions
  52. for fType in scr:gmatch("local%s*function%s*([%w_]+)%(") do
  53. local replacement = GetReplacement()
  54. if #fType > 5 then
  55. library[fType] = replacement
  56. scr = scr:gsub("function " .. fType, "function " .. replacement)
  57. end
  58.  
  59. end
  60.  
  61. for fCall in scr:gmatch("([%w_]+)%s*%(") do
  62. if library[fCall] then
  63. scr = scr:gsub(fCall .. '(', library[fCall] .. '(')
  64. end
  65. end
  66.  
  67. --not local function
  68.  
  69. for fType in scr:gmatch("%s*function%s*([%w_]+)%(") do
  70. local replacement = GetReplacement()
  71. if #fType > 5 then
  72. library[fType] = replacement
  73. scr = scr:gsub("function " .. fType, "function " .. replacement)
  74. end
  75. end
  76.  
  77. for fCall in scr:gmatch("([%w_]+)%s*%(") do
  78. if library[fCall] then
  79. scr = scr:gsub(fCall .. '(', library[fCall] .. '(')
  80. end
  81. end
  82.  
  83. --Var rename
  84.  
  85. local function isKeyword(s)
  86. local s2 = 'and break do else elseif end false for function if in local nil not or repeat return then true until'
  87. for w in s2:gmatch("(%w+)") do
  88. if w == s then return true end
  89. end
  90. return false
  91. end
  92.  
  93. for each in scr:gmatch("local%s*([%w_]*)%s*=%s") do
  94. if #each > 3 and not isKeyword(each) then
  95. local varName = GetReplacement()
  96. scr = scr:gsub(each," "..varName)
  97. end
  98. end
  99.  
  100. for i,v in pairs(funcrename) do
  101. local pp = GetReplacement()
  102. funcrename[i]= pp
  103. end
  104. local setlist = ""
  105. for i,v in pairs(funcrename) do
  106. setlist = setlist..("local "..v.."="..i.."; ")
  107. scr = scr:gsub(i, v)
  108. end
  109. scr=setlist..scr
  110. scr = scr:gsub(" %s+", " ")
  111. scr = scr:gsub("\n%s", " ")
  112.  
  113. --Done
  114. print(scr)
  115. end
  116.  
  117. do Obfuscate(Script)end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement