Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- chance = 0
- if tArgs[1] == nil then
- print("Proper Syntax: scan <filename>")
- return
- end
- if not fs.exists(tArgs[1]) then
- print("File does not exist.")
- return
- end
- file = fs.open(tArgs[1], "r")
- contents = file.readAll()
- if string.match(contents, "fs.delete") then
- del = true
- chance = chance+1
- end
- if string.match(contents, "startup") then
- start = true
- chance = chance+1
- end
- if string.match(contents, "infect") then
- inf = true
- chance = chance+4
- end
- if string.match(contents, "fs.copy") then
- cop = true
- chance = chance+1
- end
- if string.match(contents, "pastebin") then
- paste = true
- chance = chance+1
- end
- print("Scan Summary:")
- if del == true then
- print("Contains 'fs.delete'")
- end
- if start == true then
- print("Contains 'startup'")
- end
- if inf == true then
- print("Containts 'infect'")
- end
- if cop == true then
- print("Contains 'fs.copy'")
- end
- if paste == true then
- print("Contains 'pastebin'")
- end
- if chance == 0 then
- term.setTextColor(colors.white)
- print("File is most likely safe!")
- term.setTextColor(colors.white)
- elseif chance == 1 then
- term.setTextColor(colors.yellow)
- print("File could be malicious!")
- term.setTextColor(colors.white)
- elseif chance == 2 then
- term.setTextColor(colors.yellow)
- print("File could be malicious!")
- term.setTextColor(colors.white)
- elseif chance == 3 then
- term.setTextColor(colors.orange)
- print("File has a good chance of being malicious!")
- term.setTextColor(colors.white)
- elseif chance >= 4 then
- term.setTextColor(colors.red)
- print("File is most likely malicious!")
- term.setTextColor(colors.white)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement