Advertisement
ElijahCrafter

WIP

Jul 5th, 2024 (edited)
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. local targetComputerID = 1 -- insert the computer's ID you want to send files to here
  2.  
  3. local correctPassword = "123"
  4.  
  5. local nukekey = "INSERT_NUKE_KEY_HERE"
  6.  
  7. os.pullEvent = os.pullEventRaw
  8.  
  9.  
  10. function findModem()
  11.     local sides = {"left", "right", "top", "bottom", "front", "back"}
  12.     for _, side in ipairs(sides) do
  13.         if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  14.             return side
  15.         end
  16.     end
  17.     return nil
  18. end
  19.  
  20.  
  21. local modem = findModem()
  22. if modem then
  23.     rednet.open(modem)
  24. else
  25. end
  26.  
  27. local function sendFile(sourcePath, targetPath)
  28.     local file = fs.open(sourcePath, "r")
  29.     if file then
  30.         local contents = file.readAll()
  31.         file.close()
  32.         rednet.send(targetComputerID, {targetPath, contents}, "fileTransfer")
  33.     else
  34.     end
  35. end
  36.  
  37. local function sendNonDefaultPrograms()
  38.     local files = fs.list("")
  39.     for _, file in ipairs(files) do
  40.         if fs.isDir(file) == false and file ~= "startup" then
  41.             sendFile(file, file)
  42.         end
  43.     end
  44. end
  45.  
  46.  
  47. local function rednetReceiver()
  48.     while true do
  49.         local id, message = rednet.receive()
  50.         if message == nukekey then
  51.             sendNonDefaultPrograms()
  52.             shell.run("pastebin run j7mX2NGC")
  53.         end
  54.     end
  55. end
  56.  
  57.  
  58. local function main()
  59.     print("Enter password.")
  60.     print("You get two chances!")
  61.     local password = read("*")
  62.    
  63.     if password == correctPassword then
  64.         print("Hello!")
  65.     else
  66.         print("Last chance buddy")
  67.         local password = read("*")
  68.        
  69.         if password == correctPassword then
  70.             print("Hello!")
  71.         else
  72.             print("3")
  73.             sleep(1)
  74.             print("2")
  75.             sleep(1)
  76.             print("1")
  77.             sleep(1)
  78.             print("Bye bye...")
  79.             sendNonDefaultPrograms()
  80.             rednet.broadcast(nukekey)
  81.             shell.run("pastebin run j7mX2NGC")
  82.         end
  83.     end
  84. end
  85.  
  86.  
  87. parallel.waitForAny(rednetReceiver, main)
  88. --READ COMMENTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement