Advertisement
Guest User

fff

a guest
Oct 13th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. Script = [[
  2. print'good luck with this sensei'
  3. ]]
  4.  
  5. customVarNames = {
  6. "hahah",
  7. "hahahahah",
  8. "hahahahahahah",
  9. "senseisucksdickdaily"
  10. }
  11.  
  12. funcrename = {
  13. ["print"]="print",
  14. ["_G"]="_G",
  15. ["getmetatable"]="getmetatable",
  16. ["warn"]="warn",
  17. ["error"]="error",
  18. ["loadstring"]="loadstring",
  19. ["false"]="false",
  20. ["true"]="true",
  21. ["getfenv"]="getfenv",
  22. ["next"]="next",
  23. ["pairs"]="pairs",
  24. ["nil"]="nil",
  25. ["printidentity"]="printidentity",
  26. ["tostring"]="tostring",
  27. ["unpack"]="unpack",
  28. ["debug"]="debug",
  29. ["string.char"]="string.char"
  30. }
  31. --CreateVarName
  32. local chars ="1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1I1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1I1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1I1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1IlI1"
  33. local taken = { }
  34. taken[""] = true
  35. local function CreateVar()
  36. local s = ""
  37. while taken[s] do
  38. for i = 1, math.random(5, 10) do
  39. local c = chars:sub(i,i)
  40. s = s..c
  41. end
  42. end
  43. taken[s] = true
  44. return(customVarNames[math.random(1,#customVarNames)].. s)
  45. end
  46.  
  47. --WipeComments
  48. function WipeComment(scr)
  49. scr = scr:gsub("(%-%-%[(=*)%[.-%]%2%])", "")
  50. scr = scr:gsub("(%-%-[^\r\n]*)", "")
  51. return scr
  52. end
  53.  
  54. --WipeStrings
  55. local mamadouseydou = CreateVar()
  56. local mamadouseydou0 = CreateVar()
  57. local mamadouseydou1 = CreateVar()
  58. local GenStr = function(Str)
  59. local R = {}
  60. local Ran = function(n)
  61. local r = math.random(1, 255)
  62. return ((n - r)/2).. ' + ' ..(r/2)
  63. end
  64.  
  65. for c in Str:gmatch('.') do
  66. table.insert(R, Ran(c:byte()))
  67. end
  68.  
  69. return "{"..table.concat(R, ', ').."}"
  70. end
  71.  
  72. function WipeStrings(scrpt)
  73. for each in scrpt:gmatch("%b''") do
  74. scrpt = scrpt:gsub(each, each:gsub("'", '"'))
  75. end
  76. for each in scrpt:gmatch('%b""') do
  77. each = each:gsub('"', '')
  78. scrpt = scrpt:gsub('"'..each..'"', "("..mamadouseydou.."("..GenStr(each).."))")
  79. end
  80.  
  81. return scrpt
  82. end
  83.  
  84. --CoreFuncRename
  85. function CFR(scrpt)
  86. for i,v in pairs(funcrename) do
  87. local pp = CreateVar()
  88. funcrename[i]= pp
  89. end
  90. local setlist = ""
  91. for i,v in pairs(funcrename) do
  92. setlist = setlist..("local "..v.."="..i.."; ")
  93. scrpt = scrpt:gsub(i, v)
  94. end
  95. return(setlist..scrpt)
  96. end
  97.  
  98. --LocalFuncRename
  99. local library = {}
  100. function LFR(scrpt)
  101. for fType in scrpt:gmatch("local%s*function%s*([%w_]+)%(") do
  102. local replacement = CreateVar()
  103. if #fType > 5 then
  104. library[fType] = replacement
  105. scrpt = scrpt:gsub("function " .. fType, "function " .. replacement)
  106. end
  107. end
  108.  
  109. for fCall in scrpt:gmatch("([%w_]+)%s*%(") do
  110. if library[fCall] then
  111. scrpt = scrpt:gsub(fCall .. '%(', library[fCall] .. '%(')
  112. end
  113. end
  114. return scrpt
  115. end
  116.  
  117. --NonLocalFuncRename
  118. function NLFR(scrpt)
  119. for fType in scrpt:gmatch("%s*function%s*([%w_]+)%(") do
  120. local replacement = CreateVar()
  121. if #fType > 5 then
  122. library[fType] = replacement
  123. scrpt = scrpt:gsub("function " .. fType, "function " .. replacement)
  124. end
  125. end
  126.  
  127. for fCall in scrpt:gmatch("([%w_]+)%s*%(") do
  128. if library[fCall] then
  129. scrpt = scrpt:gsub(fCall .. '%(', library[fCall] .. '%(')
  130. end
  131. end
  132. return scrpt
  133. end
  134.  
  135. --RemoveWhitespace
  136. function RW(scrpt)
  137. scrpt = scrpt:gsub("^%s*(.-)%s*$", "%1")
  138. scrpt = scrpt:gsub("(^%s*).*", "")
  139. scrpt = scrpt:gsub(" %s+", " ")
  140. scrpt = scrpt:gsub(";%c+","; ")
  141. return scrpt
  142. end
  143.  
  144. --VarRename
  145.  
  146. function isKeyword(s)
  147. local s2 = 'and break do else elseif end false for function if in local nil not or repeat return then true until'
  148. for w in s2:gmatch("(%w+)") do
  149. if w == s then return true end
  150. end
  151. return false
  152. end
  153.  
  154. function VR(scrpt)
  155. for each in scrpt:gmatch("local%s*([%w_]*)%s*=%s*") do
  156. if #each > 3 and not isKeyword(each) then
  157. local varName = CreateVar()
  158. scrpt = scrpt:gsub(each," "..varName)
  159. end
  160. end
  161. return scrpt
  162. end
  163.  
  164. --obfuscate
  165. function Obfuscate(scr)
  166. scr = WipeComment(scr)
  167. scr = WipeStrings(scr)
  168. scr = 'function '..mamadouseydou..'('..mamadouseydou0..') local '..mamadouseydou1..' = ""; for i,v in pairs('..mamadouseydou0..') do '..mamadouseydou1..' = '..mamadouseydou1..'..string.char(v*2); end return('..mamadouseydou1..') end;'..scr
  169. scr = LFR(scr)
  170. scr = NLFR(scr)
  171. scr = VR(scr)
  172. --scr = RW(scr)
  173. scr = CFR(scr)
  174.  
  175. print(scr)
  176. end
  177.  
  178. do Obfuscate(Script) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement