pepeknamornik

EZET

Oct 27th, 2021 (edited)
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.57 KB | None | 0 0
  1. verze = "21.1027.R1"
  2. term.setCursorPos(1,1)
  3. term.setBackgroundColor(colors.black)
  4. term.clear()
  5. print("Antivirus system EZET")
  6. local function txc(barvaP) term.setTextColor(barvaP) end
  7.  
  8. function kontrola()
  9.  
  10.     local data = fs.open(cesta, "r")
  11.     local obsah = data.readAll()
  12.     data.close()
  13.    
  14.     if not vir then
  15.         if string.find(obsah,"startup") then vir = true
  16.         end
  17.     end
  18. print()
  19. write("Soubor "..cesta.." ")
  20. if vir then txc(colors.orange) print"Mozne riziko!" kontrola2() else txc(colors.green) print"soubor je OK" end
  21. print()
  22. cteni()
  23. end
  24.  
  25. function kontrola2()
  26.     local i = 0
  27.     local radek ={}
  28.    
  29.     local data = fs.open(cesta, "r")
  30.    
  31.     repeat
  32.     vir = false
  33.     i = i + 1
  34.     radek[i] = data.readLine()
  35.    
  36.     if radek[i] then
  37.         if (string.find(radek[i],"startup") or (string.find(radek[i],"startup.lua"))) and string.find(radek[i],"delete") and not string.find(radek[i],"startuplog") then vir = true
  38.         txc(colors.red) print("Strikne zakazano!")
  39.         else
  40.         txc(colors.white)
  41.         end
  42.    
  43.         if not vir then
  44.             if string.find(radek[i],"startup") then vir = true
  45.             end
  46.         end
  47.        
  48.         if vir then print("Radek:["..i.."]: "..radek[i] ) end
  49.     end
  50.     until radek[i] == nil
  51.     data.close()
  52. end
  53.  
  54.  
  55. function cteni()
  56.     txc(colors.white)
  57.     write("Cesta programu: ")
  58.     vir = false
  59.     cesta = read()
  60.    
  61.     if fs.isDir(cesta) then txc(colors.yellow) print("Slozku nelze kontrolovat!") cteni()
  62.     elseif cesta == "exit" then error()
  63.     elseif fs.exists(cesta) then kontrola()
  64.     elseif fs.exists(cesta..".lua") then cesta = cesta..".lua" kontrola()
  65.     else txc(colors.yellow) print("Chyba!") cteni()
  66.     end
  67. end
  68.  
  69. cteni()
Add Comment
Please, Sign In to add comment