Guest User

EnderWall Developmental

a guest
Mar 11th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. local function scan(msg)
  2. local file = tostring(msg)
  3.  
  4. local function redraw()
  5. local GUI = {
  6. "---------------------------------------------------",
  7. " EnderWall is scanning "..file.."...",
  8. "---------------------------------------------------"
  9. }
  10. for k,v in pairs(GUI) do
  11. print(v)
  12. end
  13. end
  14.  
  15. local threatTable = {}
  16. local fileTable = {}
  17. local banStrings = {"startup","fs","delete"}
  18. local removeChars = {
  19. "/",
  20. ",",
  21. "{",
  22. "'",
  23. '"',
  24. "~",
  25. "`",
  26. "!",
  27. "@",
  28. "#",
  29. "=",
  30. ":",
  31. ";",
  32. "-",
  33. "?",
  34. "^",
  35. "&",
  36. "*",
  37. ">",
  38. "<",
  39. "+",
  40. "|"
  41. }
  42. if not fs.exists(file) then return print("No such file") end
  43. local handle = fs.open(file,"r")
  44. local lines = handle.readLine()
  45. for lines in handle.readLine do
  46. local newLine = string.lower(lines)
  47. for i = 1,#removeChars do
  48. lines = string.gsub(newLine,removeChars[i],"")
  49. newLine = string.lower(lines)
  50. end
  51. table.insert(fileTable,newLine)
  52. for i = 1,#banStrings do
  53. if string.find(newLine,banStrings[i]) then
  54. table.insert(threatTable,newLine)
  55. end
  56. end
  57. end
  58. term.clear()
  59. term.setCursorPos(1,1)
  60. for k,v in pairs(fileTable) do
  61. redraw()
  62. print(v)
  63. sleep(0.01)
  64. term.clear()
  65. term.setCursorPos(1,1)
  66. end
  67. if #threatTable >0 then
  68. term.clear()
  69. term.setCursorPos(1,1)
  70. print(#threatTable.." threats detected")
  71. print("Threats stored in 'Threat_Data'")
  72. local handle = fs.open("Threat_Data","w")
  73. for i = 1,#threatTable do
  74. handle.writeLine(threatTable[i])
  75. end
  76. handle.close()
  77. end
  78. end
  79. scan(read())
Advertisement
Add Comment
Please, Sign In to add comment