Advertisement
osmarks

zFile sender

Dec 31st, 2019
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local modem = peripheral.find "modem"
  2. local id, file, filename, password_number = ...
  3. local password_number = tonumber(password_number)
  4. if not password_number then print "No password supplied. Brute-force mode enabled." end
  5. local id = tonumber(id)
  6.  
  7. local f = fs.open(file, "r")
  8. local d = f.readAll()
  9. f.close()
  10.  
  11. local function send_packet(password_number)
  12.     modem.transmit(2322, 2323, {
  13.         id = id,
  14.         senderId = 0,
  15.         password = ("zf.%d"):format(password_number),
  16.         fileName = filename,
  17.         fileContents = d
  18.     })
  19. end
  20.  
  21. if password_number then send_packet(password_number)
  22. else
  23.     for i = 1000, 9999 do
  24.         send_packet(i)
  25.         if i % 100 == 0 then sleep() end
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement