lurquhar1221

Disk Applying Program

Feb 2nd, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.    By lurquhar1221
  3.    Why I created this:
  4.     Because I needed a program that checked disks,
  5.     So people could apply to RedBlueInk.
  6.     This program checks the disk and if it has anything malicious,
  7.     It spits it back out.
  8. ]]
  9.  
  10. local malicous = {
  11.   "getfenv",
  12.   "setfenv",
  13.   "os.shutdown",
  14.   "os.reboot",
  15.   "shell.exit",
  16.   "loadstring",
  17. }
  18.  
  19. local diskPath = "drive_54"
  20.  
  21. local inverted = true
  22.  
  23. local rsSide = "top"
  24.  
  25. rs.setOutput(rsSide,inverted)
  26.  
  27. while true do
  28.   sleep(0)
  29.   if fs.exists('disk') then
  30.     for n,v in pairs(fs.list('disk')) do
  31.       if endProg then
  32.         break
  33.       end
  34.       local file = fs.open('disk/'..v,'r')
  35.       local data = file.readAll()
  36.       file.close()
  37.       sleep(0)
  38.       for i,k in pairs(malicous) do
  39.         if data:match(k) then
  40.           disk.eject(drivePath)
  41.           endProg = true
  42.           break
  43.         end
  44.       end
  45.     end
  46.   if not endProg then
  47.     rs.setOutput(rsSide, not inverted)
  48.     sleep(2)
  49.     rs.setOutput(rsSide, inverted)
  50.   end
  51.   sleep(0.1)
  52. end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment