Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function scan(msg)
- local file = tostring(msg)
- local function redraw()
- local GUI = {
- "---------------------------------------------------",
- " EnderWall is scanning "..file.."...",
- "---------------------------------------------------"
- }
- for k,v in pairs(GUI) do
- print(v)
- end
- end
- local threatTable = {}
- local fileTable = {}
- local banStrings = {"startup","fs","delete"}
- local removeChars = {
- "/",
- ",",
- "{",
- "'",
- '"',
- "~",
- "`",
- "!",
- "@",
- "#",
- "=",
- ":",
- ";",
- "-",
- "?",
- "^",
- "&",
- "*",
- ">",
- "<",
- "+",
- "|"
- }
- if not fs.exists(file) then return print("No such file") end
- local handle = fs.open(file,"r")
- local lines = handle.readLine()
- for lines in handle.readLine do
- local newLine = string.lower(lines)
- for i = 1,#removeChars do
- lines = string.gsub(newLine,removeChars[i],"")
- newLine = string.lower(lines)
- end
- table.insert(fileTable,newLine)
- for i = 1,#banStrings do
- if string.find(newLine,banStrings[i]) then
- table.insert(threatTable,newLine)
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- for k,v in pairs(fileTable) do
- redraw()
- print(v)
- sleep(0.01)
- term.clear()
- term.setCursorPos(1,1)
- end
- if #threatTable >0 then
- term.clear()
- term.setCursorPos(1,1)
- print(#threatTable.." threats detected")
- print("Threats stored in 'Threat_Data'")
- local handle = fs.open("Threat_Data","w")
- for i = 1,#threatTable do
- handle.writeLine(threatTable[i])
- end
- handle.close()
- end
- end
- scan(read())
Advertisement
Add Comment
Please, Sign In to add comment