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

Why refer to Rednet as a "wrapper" of Channels? It's much more useful than that!

Started by Chainmanner, 29 May 2013 - 10:18 AM
Chainmanner #1
Posted 29 May 2013 - 12:18 PM
Title says all. Channels are no more than a mere minor help to some things that need multiple computer IDs. I think this should be reworded on the wiki.
GopherAtl #2
Posted 29 May 2013 - 12:31 PM
in current versions, the rednet api wraps up the lower-level functionality of the modems, which is channel-based. This is what is meant, and it is correct. channels do not augment the rednet api, the rednet api provides a convenient (simplified) wrapper for the direct interface of modems.
Chainmanner #3
Posted 29 May 2013 - 12:46 PM
It kinda sounded biased, that's what I meant.
Lyqyd #4
Posted 29 May 2013 - 01:34 PM
It's an accurate factual description. How would bias enter into it?
Shazz #5
Posted 29 May 2013 - 09:45 PM
Are you using the latest version of ComputerCraft? The rednet API no longer works internally. It uses the modems to send/receive messages.
Bubba #6
Posted 29 May 2013 - 10:00 PM
Having written the initial text ("the rednet API is now just a wrapper for modems and channels"), I can assure you that bias had nothing to do with it. Take a look at /lua/rom/apis/rednet (within ComputerCraft.zip) and you'll see what I mean. It is nothing more than a helpful API that simplifies the process of using modems a bit.

In case you don't feel like looking it up, here's a link to the entire API.
BigSHinyToys #7
Posted 29 May 2013 - 10:15 PM
Having written the initial text ("the rednet API is now just a wrapper for modems and channels"), I can assure you that bias had nothing to do with it. Take a look at /lua/rom/apis/rednet (within ComputerCraft.zip) and you'll see what I mean. It is nothing more than a helpful API that simplifies the process of using modems a bit.

In case you don't feel like looking it up, here's a link to the entire API.
rednet is a network protocol. It defines packet structurer and interfaces with hardware.
theoriginalbit #8
Posted 29 May 2013 - 10:43 PM
It defines packet structurer
Are we looking at the same code? Because I see no packets let alone a `structure` for them.
D3matt #9
Posted 29 May 2013 - 11:36 PM
It defines packet structurer
Are we looking at the same code? Because I see no packets let alone a `structure` for them.
Rednet is a layer 2 protocol, like MAC. It has very basic frames, containing the following: Sender Channel, Reply Channel, and Message.
JJRcop #10
Posted 30 May 2013 - 12:06 AM
I think rednet is inadvisable if you know what you're doing, but it does help simplify things to people who don't.
Lyqyd #11
Posted 30 May 2013 - 12:08 AM
I think rednet is inadvisable if you know what you're doing, but it does help simplify things to people who don't.

This is simply not true. It's good to use rednet if your use case doesn't require more. It's easier to create tools and have things work interoperably if people use similar standards (i.e., rednet). I would encourage direct use of modem methods only if the use case cannot otherwise function with the rednet API.
JJRcop #12
Posted 30 May 2013 - 12:15 AM
I think rednet is inadvisable if you know what you're doing, but it does help simplify things to people who don't.

This is simply not true. It's good to use rednet if your use case doesn't require more. It's easier to create tools and have things work interoperably if people use similar standards (i.e., rednet). I would encourage direct use of modem methods only if the use case cannot otherwise function with the rednet API.

But rednet is so easy to spoof! You can just change the reply channel and act like you're another computer. Also, I used the word 'think', so that means it is my personal opinion, not a fact or unanimously agreed standard.
Lyqyd #13
Posted 30 May 2013 - 12:20 AM
Implying that anyone who chooses to use rednet doesn't know what they're doing isn't exactly a neutral opinion. It's also only very loosely related to the actual topic (at best!), so it seems like you simply have an axe to grind.
JJRcop #14
Posted 30 May 2013 - 12:25 AM
You're right. While I don't believe that everyone who chooses to use rednet is dumb, I definitely did leave enough loose ends open for someone to easily take it that way. I'm sorry.
Cranium #15
Posted 30 May 2013 - 12:23 PM
Are you using the latest version of ComputerCraft? The rednet API no longer works internally. It uses the modems to send/receive messages.
Rednet does definitely still work. Rednet via bundled cables, however, does not.

I usually still used the rednet api for computers that I want to ensure will communicate in a standardized manner. There is no real way to 'spoof' as another computer, as you cannot fake a computer ID. As long as your program is written properly, there is not much that wrapping the modem directly can do that the rednet api can't do already, with the exception of channels, of course.
BigSHinyToys #16
Posted 30 May 2013 - 12:43 PM
Rednet does definitely still work. Rednet via bundled cables, however, does not.

I usually still used the rednet api for computers that I want to ensure will communicate in a standardized manner. There is no real way to 'spoof' as another computer, as you cannot fake a computer ID. As long as your program is written properly, there is not much that wrapping the modem directly can do that the rednet api can't do already, with the exception of channels, of course.

It is quite easy to write an api the same as rendet but gets its ID from a variable that the user can alter allowing that computer to be what ever ID the user wants it to be. this can facilitate a man in the middle style attack. The rednet api is a non secure means of communication and can be fooled.

[Edit]
If you would like I can provide proof via PM
Cranium #17
Posted 30 May 2013 - 12:59 PM
I should have clarified then. Using the default rednet api, there would be no way to spoof. But yes, you can wrap the peripheral directly, and send using a specified ID.
PixelToast #18
Posted 30 May 2013 - 01:03 PM
There is no real way to 'spoof' as another computer
the return channel parameter can be modified, allowing you to spoof it
EDIT:
I should have clarified then. Using the default rednet api, there would be no way to spoof. But yes, you can wrap the peripheral directly, and send using a specified ID.
you can modify os.getComputerID
BigSHinyToys #19
Posted 30 May 2013 - 01:09 PM
I should have clarified then. Using the default rednet api, there would be no way to spoof. But yes, you can wrap the peripheral directly, and send using a specified ID.
The main vulnerability is you don't know if the "client / user" is using rednet or a custom "hacked" version. This means the ID's should be ignored in terms of verifying user and another system used in authentication.
Kingdaro #20
Posted 30 May 2013 - 05:08 PM
Sure you can't really fake a computer ID (other than overwriting os.computerID or the like as stated), but if there aren't any more than 128 computers placed down (this is usually the case), you could pretty much open channels 0 - 127 (or 1 - 128) to intercept any modem messages from computers within range.
D3matt #21
Posted 30 May 2013 - 06:11 PM
The new rednet API just uses the return channel as the computer ID, right? In which case one can easily just use the modem API to impersonate a computer.
Shazz #22
Posted 31 May 2013 - 10:32 PM
Rednet does definitely still work. Rednet via bundled cables, however, does not.
When I said that it does not work internally, I meant that the sending/receiving messages are not handled by the mod itself (Java part) instead it's just a API that utilizes the modem API. Sorry for being unclear.
Mads #23
Posted 01 June 2013 - 04:18 AM
Because it is a wrapper.