←  APIs and Utilities

ComputerCraft | Programmable Computers for Minecraft

»

modEM - A custom modem peripheral wrapper

Piorjade's Photo Piorjade 21 Dec 2016

modEM - A custom modem peripheral wrapper

(I couldn't think of a name)


What this thing does:
Spoiler

How to build up a basic connection (example):

Spoiler



Download:

Pastebin

pastebin get D5RDJYE6 modEM

Credits:

Password based encryption - By PixelToast


If you have any questions, feel free to ask me :)
Edited by Piorjade, 21 December 2016 - 06:11 PM.
Quote

Mao Zedong's Photo Mao Zedong 21 Dec 2016

So this is like Diffie-Hellman but more silly? What if a third party intercepts the random string?

Quote

Sure he can guess the channel but it'd need a while.

When sniffing the data, you can copy the data offline, and compute the hash. It would take a tiny fraction of a second to crack offline.
Edited by Mao Zedong, 21 December 2016 - 07:33 PM.
Quote

KingofGamesYami's Photo KingofGamesYami 21 Dec 2016

Sending the string used to encrypt really makes the encryption useless. Anyone doing any sort of wireless hacking will simply intercept it and use it to decrypt all the messages.
Quote

Piorjade's Photo Piorjade 21 Dec 2016

Well we're talking about Minecraft here, folks.

Your (in this situation) friend needs to know which channel to connect to. (Again, between 1 and 65535, so the 3rd guy (I'm calling him "hacker") needs to know that)

The rest is already explained.

So basically to even know what the string is, the "hacker" needs to get the message with the string too, but to get it he needs to know to which channel they connect.

Sure, it sounds kinda dumb but practically it's pretty good for servers if you want to be "protected" from the "hacker".

EDIT: Need to try something out
Edited by Piorjade, 21 December 2016 - 07:44 PM.
Quote

KingofGamesYami's Photo KingofGamesYami 21 Dec 2016

View PostPiorjade, on 21 December 2016 - 07:39 PM, said:

Well we're talking about Minecraft here, folks.
Your (in this situation) friend needs to know which channel to connect to. (Again, between 1 and 65535, so the 3rd guy (I'm calling him "hacker") needs to know that)
The rest is already explained.

On line 265 you give the "hacker" this information.
Quote

Piorjade's Photo Piorjade 21 Dec 2016

View PostKingofGamesYami, on 21 December 2016 - 07:51 PM, said:

View PostPiorjade, on 21 December 2016 - 07:39 PM, said:

Well we're talking about Minecraft here, folks.
Your (in this situation) friend needs to know which channel to connect to. (Again, between 1 and 65535, so the 3rd guy (I'm calling him "hacker") needs to know that)
The rest is already explained.

On line 265 you give the "hacker" this information.

On the channel, which the 2 people specified.

If you somehow want to find out, which channel it is, you'd need to open up all channels and listen on them at the same time.

With one computer you can open up 129 channels, maximum.

The 2 users specify ANY channel they want, between 1 and 65535.
The "hacker" would need about 500 --> 86 (6 modems per comp.) computers to cover every channel if he REALLY wants to get the key.

To clear that up:
Example people:
Tim (host)
Paul (client)
Bob (hacker)

Tim tells Paul (however, for example via Skype) which channel they should connect to. --> Bob doesn't know which they specified

Tim starts the program up, Paul starts his program AFTER that (I'm reffering to the example codes for now).
--> Ones Paul connects, Tim's program generates a new channel-number, a key and sends them both to Paul (well technically to everyone in their channel)
--> Tim immidiently closes his connection, opens a new one on the generated channel and listens on that one
--> Paul immidiently closes his connection too, connects to the channel he got and uses the key he got to decrypt and encrypt every message he gets/sends

This is the most simple explanation I could think of.
Edited by Piorjade, 21 December 2016 - 08:09 PM.
Quote

Exerro's Photo Exerro 21 Dec 2016

Assuming one computer is a server that is active a lot of the time, with clients connecting every now and then, the attacker would easily be able to find the channel the server is using long before the client even connected by pinging all channels and seeing which get a response. It could then listen to those channels and intercept all the traffic, and as KingOfGamesYami pointed out, it'd then be able to spy on all communications between the server and client.
Quote

KingofGamesYami's Photo KingofGamesYami 21 Dec 2016

Actually, the hacker needs 512 modems (128 channels / modem). He only needs 86 computers (6 modems / computer). This is easily achievable due to the cheap recipes.
Quote

Piorjade's Photo Piorjade 21 Dec 2016

View PostExerro, on 21 December 2016 - 07:59 PM, said:

Assuming one computer is a server that is active a lot of the time, with clients connecting every now and then, the attacker would easily be able to find the channel the server is using long before the client even connected by pinging all channels and seeing which get a response. It could then listen to those channels and intercept all the traffic, and as KingOfGamesYami pointed out, it'd then be able to spy on all communications between the server and client.

But it's not meant to be used as a server. As rebooting a client leads to not having the key.
You could do that with pinging, depending on if the "host" actually does something with your message. (modEM.receive() decrypts the received message too so idk how you'd "ping" a "host")

Even if you know which channel they do their messaging, you'd still need the key. And I don't remember sharing it all the time.

View PostKingofGamesYami, on 21 December 2016 - 08:03 PM, said:

Actually, the hacker needs 512 modems (128 channels / modem). He only needs 86 computers (6 modems / computer). This is easily achievable due to the cheap recipes.

Yeah thanks for clearing that up, but again, it's not really worth it :P
Aaaaand I still don't remember sharing the key between encrypted messages O.o.
Only when they "connect", then you'd need to already have that 86 computer-setup before a connection even gets initiated.
Quote