Advertisement
TheRockettek

Untitled

Feb 12th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. args = { ... }
  2. path = args[1]
  3.  
  4. special = {}
  5. special[40] = true
  6. special[41] = true
  7. special[46] = true
  8. special[37] = true
  9. special[43] = true
  10. special[45] = true
  11. special[42] = true
  12. special[63] = true
  13. special[91] = true
  14. special[94] = true
  15. special[36] = true
  16.  
  17. from = 33
  18. to = 126
  19.  
  20. nTbl = {}
  21. oTbl = {}
  22. for i=1,to-from+1,1 do
  23. nTbl[#nTbl+1] = (from+i)-1
  24. oTbl[#oTbl+1] = (from+i)-1
  25. end
  26.  
  27. sTbl = {}
  28. for i=1,#oTbl,1 do
  29. sNum = math.random(1,#oTbl)
  30. sTbl[#sTbl+1] = tonumber(oTbl[sNum])
  31. table.remove(oTbl,sNum)
  32. end
  33.  
  34. file = fs.open(path,"r")
  35. fileCont = file.readAll()
  36. file.close()
  37.  
  38. for i=1,#sTbl,1 do
  39. replaceChar = nTbl[i]
  40. withChar = sTbl[i]
  41. print(i .. ": " .. string.char(replaceChar) .. " => " .. string.char(withChar) .. "(" .. sTbl[i] .. ")")
  42. if special[nTbl[i]] == true then
  43. if sTbl[i] == 37 then
  44. fileCont = string.gsub(fileCont,"%" .. string.char(replaceChar),"%" .. string.char(withChar))
  45. else
  46. fileCont = string.gsub(fileCont,"%" .. string.char(replaceChar),string.char(withChar))
  47. end
  48. else
  49. if sTbl[i] == 37 then
  50. fileCont = string.gsub(fileCont,string.char(replaceChar),"%" .. string.char(withChar))
  51. else
  52. fileCont = string.gsub(fileCont,string.char(replaceChar),string.char(withChar))
  53. end
  54. end
  55. end
  56. str = ""
  57. for i,k in pairs(nTbl) do
  58. str = str .. k
  59. end
  60. print("Key: " .. str)
  61. fileWr = fs.open(path .. ".key","w")
  62. fileWr.write(str)
  63. fileWr.close()
  64.  
  65. fileWr = fs.open(path,"w")
  66. fileWr.write(fileCont)
  67. fileWr.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement