Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Rednet intercept, takes advantage of how rednet works to spy on another computer's messages
- function color(xcolor)
- if term.isColor() then term.setTextColor(xcolor) end
- end
- color(8)
- print("# Welcome to the rednet spy program")
- print("# This will spy on a computer and show you")
- print(" any rednet messages it receives")
- color(2)
- write("? Enter computer ID to spy on: ")
- local id = tonumber(read())
- write("? Enter spy period duration: ")
- local duration = tonumber(read())
- local timer = os.startTimer(duration)
- local modem = peripheral.wrap("back")
- color(32)
- print("! Spying started")
- color(1)
- print("----------------------------------")
- color(32)
- modem.open(id)
- while true do
- local e, p1, p2, p3, p4, p5 = os.pullEvent()
- if e == "modem_message" then
- print("! "..id.." recieved a message.")
- print("! From: "..p3)
- print("! Message: "..p4)
- color(1)
- print("----------------------------------")
- color(32)
- elseif e == "timer" and p1 == timer then
- break
- end
- end
- modem.close(id)
- color(32)
- print("! Spying stopped")
Advertisement
Add Comment
Please, Sign In to add comment