bwhodle

Rednet Intercept Tool

Jul 23rd, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. -- Rednet intercept, takes advantage of how rednet works to spy on another computer's messages
  2. function color(xcolor)
  3.   if term.isColor() then term.setTextColor(xcolor) end
  4. end
  5. color(8)
  6. print("# Welcome to the rednet spy program")
  7. print("# This will spy on a computer and show you")
  8. print("   any rednet messages it receives")
  9. color(2)
  10. write("? Enter computer ID to spy on: ")
  11. local id = tonumber(read())
  12. write("? Enter spy period duration: ")
  13. local duration = tonumber(read())
  14. local timer = os.startTimer(duration)
  15. local modem = peripheral.wrap("back")
  16. color(32)
  17. print("! Spying started")
  18. color(1)
  19. print("----------------------------------")
  20. color(32)
  21. modem.open(id)
  22. while true do
  23.   local e, p1, p2, p3, p4, p5 = os.pullEvent()
  24.   if e == "modem_message" then
  25.     print("! "..id.." recieved a message.")
  26.     print("! From: "..p3)
  27.     print("! Message: "..p4)
  28.     color(1)
  29.     print("----------------------------------")
  30.     color(32)
  31.   elseif e == "timer" and p1 == timer then
  32.     break
  33.   end
  34. end
  35. modem.close(id)
  36. color(32)
  37. print("! Spying stopped")
Advertisement
Add Comment
Please, Sign In to add comment