Advertisement
qwertz19281

[ComputerCraft] rednet sniffer

Mar 28th, 2016
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. print("NetWork Swzitzer 1.0")
  2. print("Press any key to exit")
  3. local modem = peripheral.wrap("top") -- Whopper
  4. local h = fs.open("nslog", fs.exists("nslog") and "a" or "w")
  5. modem.open(65533)
  6. modem.open(65535)
  7. local weider = true
  8. while weider do
  9.     local event, keyside, sender, reply, packet, dist = os.pullEvent()
  10.     if event == "modem_message" then
  11.         str=textutils.serialize(packet).." DIST "..tostring(dist)
  12.         print(str)
  13.         h.writeLine(str)
  14.     elseif event == "key" then
  15.         print("Pressed key "..tostring(keyside))
  16.         h.close()
  17.         modem.closeAll()
  18.         weider=false
  19.     end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement