SHARE
TWEET

[ComputerCraft] GreaseMonkey Virus Cleaner

Frekvens1 Jul 19th, 2019 (edited) 257 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This will remove a nasty virus from the computer and put it back in shape.
  2. -- URL to virus: http://www.computercraft.info/forums2/index.php?/topic/1102-a-decent-evalquine-resident-virus/
  3. -- Pastebin: A51AN5xC
  4.  
  5. -- Run the following code on the infected machine:
  6. -- ' /rom/programs/http/pastebin.lua run hnF94pw2 '
  7.  
  8. local infectedFiles = 0
  9. local cleanFiles = 0
  10.  
  11. if (fs.exists("SafeDisk.lua")) then
  12.     fs.delete("SafeDisk.lua")
  13. end
  14.  
  15. local FileList = fs.list("") -- Table with all the files and directories available
  16. for _, file in ipairs(FileList) do
  17.     local reader = fs.open(file, "r") -- Try to open the file, errors if directory
  18.     if reader then -- Is a file
  19.         local content = reader.readAll() -- Read contents from file
  20.         local isInfected = string.find(content, "xpayload" ) -- Checks if the file is infected
  21.  
  22.         reader.close()
  23.         if isInfected then
  24.             fs.delete(file)
  25.             infectedFiles = infectedFiles + 1
  26.         else
  27.             cleanFiles = cleanFiles + 1
  28.         end    
  29.     end
  30. end
  31.  
  32. settings.set("shell.allow_disk_startup", false)
  33. settings.save(".settings")
  34.  
  35. if (fs.exists("SafeDisk.lua")) then
  36.     fs.delete("SafeDisk.lua")
  37. end
  38.  
  39. local h = fs.open("SafeDisk.lua", "w")
  40. h.write('local filePath = "/disk/startup"\n')
  41. h.write('if not fs.exists(filePath) then filePath = "/disk/startup.lua" end\n')
  42. h.write('if fs.exists(filePath) then\n')
  43. h.write('   local reader = fs.open(filePath, "r") if not reader then return end -- Abort if it isnt a file\n')
  44. h.write('   local content = reader.readAll() if not content then return end -- Abort if no content\n')
  45. h.write('   local isInfected = string.find(content, "xpayload" ) -- Checks if the file is infected\n')
  46. h.write('   if isInfected then\n')
  47. h.write('       fs.delete(filePath)\n')
  48. h.write('       print("Attempted to clean infected disk!")\n')
  49. h.write('   else\n')
  50. h.write('       shell.run(filePath)\n')
  51. h.write('   end\n')
  52. h.write('end\n')
  53. h.close()
  54.  
  55. if (fs.exists("startup")) then
  56.     fs.delete("startup")
  57. end
  58.  
  59. h = fs.open("startup", "w")
  60. -- Prints the log output at reboot
  61. h.write("print(\"Cleaned up '"..infectedFiles.."' files from the system!\")")
  62. h.write("print(\"A total of '"..cleanFiles.."' clean files where found!\")")
  63. h.write('print("Safe disk boot installed!")')
  64.  
  65. -- Installs the SafeDisk software. Lets you reboot up safely.
  66. h.write('h = fs.open("startup", "w")')
  67. h.write("h.write('shell.run(\"SafeDisk.lua\") -- Runs disk IF it isnt this virus.')")
  68. h.write("h.close()")
  69. h.close()
  70.  
  71. os.reboot() -- Takes a reboot real fast, as the virus will install itself after a second.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top