Skip to content

Instantly share code, notes, and snippets.

@complover116
Forked from SquidLord/CC Rednet Sniffer.lua
Last active December 16, 2015 08:19
Show Gist options
  • Save complover116/5404622 to your computer and use it in GitHub Desktop.
Save complover116/5404622 to your computer and use it in GitHub Desktop.
-- ComputerCraft Broadcast Rednet Monitor
-- Monitor all traffic on local broadcast RedNet
-- by Alexander "SquidLord" Williams (SaladinVrai)
-- Get the system label for identification
local SysName = os.getComputerLabel()
-- Iterate over all sides for rednet.open
for n,m in ipairs(rs.getSides()) do
rednet.open(m)
end
-- Identify
print("SquidOS RedNet Sniffer ...")
if SysName then
print(" Running on node: " .. os.getComputerLabel())
else
write(" Running on ")
textutils.slowPrint("UNIDENTIFIED NODE")
end
-- This part was recoded by complover116 : )
print()
print("Press any key to stop")
print()
-- Loop until any key is pressed
-- This part was recoded by complover116 : )
loop = true
while loop == true do
Event, Id, Content = os.pullEvent()
if Event == "rednet_message" then
print(Id .. " (" .. textutils.formatTime(os.time(), false) ..")>")
print(" " .. Content)
elseif Event == "key" then
loop = false
end
end
print("------------------------------")
print("Listening stopped")
print("Code by Squidlord")
print("------------------------------")
-- ShutDown the rednet
for n,m in ipairs(rs.getSides()) do
rednet.close(m)
end
@GradyTheHermit
Copy link

you should give yourself credit for the lines you changed just sayin...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment