Jump to content




Replace rednet in 1.63


  • You cannot reply to this topic
4 replies to this topic

#1 joebodo

  • Members
  • 69 posts

Posted 14 May 2014 - 04:27 AM

Not sure if others are having issues with 1.63 rednet, but here's some code to quickly crash rednet so you can install a replacement (or just leave it removed if you don't need it):

local t = rednet.isOpen
rednet.isOpen = nil    -- will cause the crash

local t2 = term.redirect
term.redirect = function()  -- this is the next method called in the bios if rednet exits
  term.redirect = t2
  rednet.isOpen = t
  print('starting shell')
  os.run(getfenv(1), '/rom/programs/shell')
end

os.queueEvent('modem_message')


You will need to run some shell or program, otherwise, the bios will exit and the computer will shutdown.

Edited by joebodo, 14 May 2014 - 07:45 AM.


#2 CometWolf

  • Members
  • 1,283 posts

Posted 14 May 2014 - 05:02 AM

You're overwriting a function which rednet uses with an errornous one. Might aswell just remove it, the result would be the same.

#3 joebodo

  • Members
  • 69 posts

Posted 14 May 2014 - 05:25 AM

View PostCometWolf, on 14 May 2014 - 05:02 AM, said:

You're overwriting a function which rednet uses with an errornous one. Might aswell just remove it, the result would be the same.

Oops, forgot to post the last line - which is probably causing the confusion.

Just to clarify...
I replace a method that rednet.run will eventually call with one that will cause rednet.run to crash.
I replace the method that is called in bios after rednet aborts with one that will start up a new shell.
I post a 'modem_message' event that rednet.run will process (and lead to the crash).
My second method is then called and I restore everything and start up a new shell.

I do this in order to provide my own rednet.run subsequently.

#4 CometWolf

  • Members
  • 1,283 posts

Posted 14 May 2014 - 06:27 AM

What im saying is, this
rednet.isOpen = function()
  print('a' .. t)   -- will cause the crash
end
and this
rednet.isOpen = nil
Would both cause rednet to crash, so you might aswell do the latter.
I suspect that queuing an empty modem_message might cause it to crash right off the bat anyways however.

#5 joebodo

  • Members
  • 69 posts

Posted 14 May 2014 - 07:48 AM

View PostCometWolf, on 14 May 2014 - 06:27 AM, said:

What im saying is, this
rednet.isOpen = function()
  print('a' .. t)   -- will cause the crash
end
and this
rednet.isOpen = nil
Got it ... I updated the OP

View PostCometWolf, on 14 May 2014 - 06:27 AM, said:

I suspect that queuing an empty modem_message might cause it to crash right off the bat anyways however.

The code is pretty good at checking parameters. I don't see an obvious way to crash it by sending a message.

( how about: local t, rednet.isOpen = rednet.isOpen, nil ) :)

Edited by joebodo, 14 May 2014 - 07:51 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users