Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vr = "v1.0"
- viruses = {"Nubware", "Decay Virus", "Binary Virus", "Fry Virus", "Flamer"}
- infectedfiles = 0
- j = shell.getRunningProgram()
- while true do
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(19, 1)
- term.setTextColor(colors.orange)
- term.write("ViProc")
- term.setCursorPos(10, 1)
- term.setBackgroundColor(colors.gray)
- for i = 1, 19 do
- x, y = term.getCursorPos()
- term.write(" ")
- y = y+1
- term.setCursorPos(x, y)
- end
- term.setCursorPos(34, 1)
- for i = 1, 19 do
- x, y = term.getCursorPos()
- term.write(" ")
- y = y+1
- term.setCursorPos(x, y)
- end
- term.setCursorPos(14, 4)
- term.setBackgroundColor(colors.red)
- term.write(" ")
- term.setCursorPos(14, 7)
- term.write(" ")
- term.setCursorPos(14, 10)
- term.write(" ")
- term.setCursorPos(14, 13)
- term.write(" ")
- term.setTextColor(colors.blue)
- term.setCursorPos(20, 4)
- term.write("Scan")
- term.setCursorPos(17, 7)
- term.write("Wipe Computer")
- term.setCursorPos(17, 10)
- term.write("Known Viruses")
- term.setCursorPos(17, 13)
- term.write("Control Panel")
- ev, button, posx, posy = os.pullEvent("mouse_click")
- if posx > 13 and posx < 29 and posy > 3 and posy < 5 then
- term.clear()
- term.setCursorPos(1,1)
- --Keywords to look for in files
- bad = {"function print", "hacked", "virus", "infected", "hacker", "keylog", "hack", "infect"}
- --DO NOT EDIT PAST THIS LINE
- gb = 1
- badfiles = {}
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.lightBlue)
- term.write("ViProc "..vr)
- term.setCursorPos(1, 2)
- term.setTextColor(colors.yellow)
- --Make the dots move!
- for i = 1, 2 do
- term.write("Scanning for viruses.")
- sleep(0.5)
- term.clearLine()
- term.setCursorPos(1,2)
- term.write("Scanning for viruses..")
- sleep(0.5)
- term.clearLine()
- term.setCursorPos(1,2)
- term.write("Scanning for viruses...")
- sleep(0.5)
- term.clearLine()
- term.setCursorPos(1,2)
- end
- --Scan all files, looking for keywords
- s = fs.list("/")
- for _, v in pairs(s) do
- if fs.isDir(v) == false then
- h = fs.open(v, "r")
- g = h.readAll()
- h.close()
- for i = 1, #bad do
- --If it finds a keyword in the file and the file is not startup
- if string.find(g, bad[i]) and v ~= j then
- --Make sure it doesnt appear twice
- for i = 1, #badfiles do
- if v == badfiles[i] then
- gb = 0
- end
- end
- if gb == 1 then
- table.insert(badfiles, v)
- infectedfiles = infectedfiles+1
- end
- end
- end
- end
- end
- term.setCursorPos(25, 1)
- term.setTextColor(colors.cyan)
- term.write("Number of infected files:")
- term.setTextColor(colors.orange)
- term.setCursorPos(25, 2)
- term.write(infectedfiles)
- sleep(2)
- if infectedfiles ~= 0 then
- term.setCursorPos(15, 4)
- print("Infected files:")
- term.setCursorPos(1, 5)
- textutild.pagesTabluate(badfiles)
- term.setCursorPos(1, 18)
- term.setTextColor(colors.orange)
- term.write("Press Y to delete these files or")
- term.setCursorPos(1, 19)
- term.write("press any other key to continue to the menu")
- ev, p1 = os.pullEvent("key")
- if p1 == keys.y then
- for i = 1, #badfiles do
- fs.delete(badfiles[i])
- end
- term.setCursorPos(1, 2)
- term.setTextColor(colors.black)
- print("Files deleted")
- sleep(1)
- end
- else
- term.setTextColor(colors.orange)
- term.setCursorPos(1, 19)
- term.write("Press any key to continue")
- os.pullEvent("key")
- end
- elseif posx > 13 and posx < 29 and posy > 6 and posy < 8 then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.lightBlue)
- term.write("ViProc "..vr)
- term.setCursorPos(1, 2)
- term.setTextColor(colors.blue)
- print("Wiping computer...")
- term.setBackgroundColor(colors.green)
- term.setCursorPos(2, 9)
- for i = 1, 40 do
- term.write(" ")
- sleep(0.1)
- end
- term.setBackgroundColor(colors.red)
- term.setCursorPos(16, 10)
- term.setTextColor(colors.orange)
- term.write("Computer cleared.")
- term.setCursorPos(1, 19)
- term.setTextColor(colors.gray)
- l = shell.programs()
- s = fs.list("/")
- for _, v in pairs(s) do
- if v ~= j and fs.isDir(v) == false and fs.isReadOnly(v) == false then
- fs.delete(v)
- end
- end
- for _, v in pairs(l) do
- if v ~= j then
- fs.delete(v)
- end
- end
- term.setCursorPos(1, 19)
- term.write("Press any key to continue")
- os.pullEvent()
- elseif posx > 13 and posx < 29 and posy > 9 and posy < 11 then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.lightBlue)
- term.write("ViProc "..vr)
- term.setTextColor(colors.orange)
- term.setCursorPos(19, 3)
- term.write("Known Viruses:")
- term.setCursorPos(1, 4)
- textutils.pagedTabulate( viruses )
- term.setCursorPos(1, 19)
- term.setTextColor(colors.blue)
- term.write("Press any key to continue")
- os.pullEvent("key")
- elseif posx > 13 and posx < 29 and posy > 12 and posy < 14 then
- while true do
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setCursorPos(18,2)
- term.setTextColor(colors.lightBlue)
- term.write("Control Panel")
- term.setTextColor(colors.yellow)
- term.setCursorPos(15, 4)
- term.setBackgroundColor(colors.cyan)
- term.write(" ")
- term.setCursorPos(15, 7)
- term.write(" ")
- term.setCursorPos(19, 4)
- term.write("Edit files")
- term.setCursorPos(20, 7)
- term.write("Shell")
- ev, button, x, y = os.pullEvent("mouse_click")
- if x > 14 and x < 33 and y > 3 and y < 5 then
- term.clear()
- term.setCursorPos(2, 1)
- term.setTextColor(colors.yellow)
- term.write("Enter the file path:")
- term.setCursorPos(2, 2)
- term.setBackgroundColor(colors.blue)
- term.write(" ")
- term.setCursorPos(2,2)
- term.setTextColor(colors.white)
- local path = read()
- shell.run("edit "..path)
- elseif x > 14 and x < 33 and y > 6 and y < 8 then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.yellow)
- term.clear()
- term.setCursorPos(1,1)
- shell.run("rom/programs/shell")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment