Posted 09 January 2013 - 07:45 PM
hello friends, I'm working on OS and was thinking of putting an antivirus in your script, for example, the OS scan the files in the root folder and CC rom, to see if there is any virus, it would be less useless in a server with CC. the only problem is that I can not make it scan the folders, for example:
Code:
print("Scanning…")
local file = textutils.serialize(fs.list("/"))
file1 = fs.getName([file(#1)])
is fs.isDir(file1) == true then
else
local h = fs.open(file1, "r")
scr = h.readAll()
if scr == "os.shutdown()" or scr == "os.reboot()" then
print("The file " .. file1 .. " is infected")
else
print("Nothing infected")
end
sorry for my bad english(using Google Translator)
Code:
print("Scanning…")
local file = textutils.serialize(fs.list("/"))
file1 = fs.getName([file(#1)])
is fs.isDir(file1) == true then
else
local h = fs.open(file1, "r")
scr = h.readAll()
if scr == "os.shutdown()" or scr == "os.reboot()" then
print("The file " .. file1 .. " is infected")
else
print("Nothing infected")
end
sorry for my bad english(using Google Translator)