Posted 14 December 2012 - 01:19 AM
--CraftSecur Antivirus
--Scans for the 'os','rednet.receive' and 'fs.delet' words
t = {...}
protectedWords = {"os","fs.delete"}
if fs.exists(t[1]) and not fs.isDir(t[1]) and not fs.isReadOnly(t[1]) then
local file = fs.open(t[1], "r")
local data = file.readAll()
if file then
for i, pairs in ipairs(data) do
if string.find( data[i],"os") or string.find(data[i],"fs.delete") then
fs.move(t[1],t[1] .. ".protected")
else
print("The specified file is not a virus")
end
end
else
error("The specified file can not be found, is a directory, or is read-only")
end
else
error("FS Error")
end
fs.close(file)
Every time I try to open the file 'thing', the file handler returns false or null.
How can I fix this
--Virus infected file : 'thing'
os.shutdown()