xXm0dzXx

ComputerCraft AntiVirus

Jun 5th, 2012
1,290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2. function scan(path)
  3. files = fs.list(path)
  4. for n=1,#files do
  5. if fs.isReadOnly(path.. "/" ..files[n]) then else
  6. if fs.isDir(path.. "/" ..files[n]) then
  7. scan(path.. "/" ..files[n])
  8. else
  9. local tLines = {}
  10. local file = io.open(path.. "/" ..files[n], "r")
  11. local line
  12. while true do
  13. line = file:read()
  14. if not line then break end
  15. tLines[#tLines+1] = line
  16. end
  17. file:close()
  18.  
  19. for i = 1,#tLines do
  20. if string.find(tLines[i], "os.shutdown()") then
  21. print(files[n].. "(Line #" ..i..") = Possible Shutdown Virus")
  22. elseif string.find(tLines[i], "os.reboot()") then
  23. print(files[n].. "(Line #" ..i..") = Possible Reboot Virus")
  24. end
  25. end
  26. end
  27. end
  28. end
  29. end
  30.  
  31. scan("/")
Advertisement
Add Comment
Please, Sign In to add comment