📜 ⬆️ ⬇️

Telegraph - e-mail without internet

Good day!

I would like to share with the community interesting thoughts on creating autonomous decentralized e-mail and demonstrate in practice the work of one already existing implementation.

Initially, Telegraph was developed as an amateur means of communication between members of our small student community, one way or another dedicated to computing and communications.
')
Nota Bene : Telegraph is an amateur communication tool; It is quite problematic to extract practical benefits on an industrial scale, but this problem can hardly be called significant at all - it is mainly our main goal that we consider directly drawing attention to the development of such communication systems.

We tend to think that raising the general interest in the development of various communication systems is a necessary and rather important matter, because understanding the fundamental principles of how these systems work and what they hold is the main key to raising public awareness in information security issues.



Achtung!
To avoid possible misunderstandings - in some cases, images can be flipped through:


The system keeps on volunteering and pure enthusiasm - we just like what we do. You can consider it a hobby and you will not be wrong - after all, there are still lovers of communication through the use of paper correspondence; "Telegraph" in most cases can be represented as a digital implementation of the principles of regular mail.

"Telegraph" is a standalone analogue of e-mail, which allows you to send simple text messages without using the Internet. “Telegraph” to some extent can be attributed to Sneakernet - a way to exchange information without using the network.

Flash drives are used as mailboxes, and the post offices are the terminals - computers, which are unique points of access to receiving and transmitting electronic correspondence.

Consider the simplest example of interaction with the system. We have two flash drives and one terminal. The script itself contains the necessary global variables for subsequent interaction with the system — the terminal number, the path to the root, and so on.

If we connect a removable drive to the terminal and run the script, it will try to receive outgoing messages from the / mnt / Telegraph / Outbox directory and transfer them into its memory, then check for new messages in its memory for the current user. If any, write them in / mnt / Telegraph / Inbox .

Registration of new devices


It happens quite occasionally. The script finds new flash drives connected to the system and tries to match their unique identifiers with those presented in the root. If the devices have not previously been registered, they will be formatted in accordance with the rules stated by the Telegraph.

After registering a new device, the root structure takes the following form:


In the configuration file config.ini , located in the root of the flash drive, is the system information - a unique identifier and a secret key.


Give people rum!


No, well, really, seriously! You can get the source code here , and it is already time for us to move from theory to practice.

But I have to say a few more words about how the messaging system works in practice.

First, let's understand what the eleven-digit unique identifier consists of. For example, 10455000001 .

The first digit, 1 , is responsible for the country number. The international code is 0 , Russia in this case is 1 .

Next come four digits that are responsible for the number of the region in which the terminal is located. 0455 is the Kolomna urban district.

They are followed by two numbers, - 00 , - directly responsible for the terminal number.

And only then - four digits, which are the sequence number of the user, which is assigned to this terminal. We have this - 0001 . There is also 0000 - this number belongs directly to the terminal itself. It is impossible to send written correspondence to it, but the terminal itself uses this number to send service messages to users. For example, if the message could not be delivered for any reason.


At the root of our "mailbox" are two directories needed to receive and send text messages. When the device is connected to the terminal, outgoing messages are shipped from the Outbox directory to the server, and incoming messages are loaded into the Inbox directory, which is logical.

Each file, depending on the directory, is named by the number of the recipient or the sender.

If we try to send a message to a non-existent recipient, the terminal will send us an error message.


However, if we decide to send a letter to an addressee located at a different terminal (regardless of whether it exists or not), it will be recorded in the terminal’s memory before the agent transfers written correspondence from our terminal to his own.


When the branch agent 10500000000 (in other words, the postman) connects his device to our terminal, outgoing letters will be transmitted to his drive. Subsequently, when he connects his device to his terminal, these letters will be reset to the terminal’s memory and will wait for the addressee to ship them to his flash drive.

Communication session


Let's try to send a message with the text "Hello!" From 10455000001 to 10455000002 .


That's all!


I will be glad to any criticism of the source code of the project and the article itself.

Thank you for attention.

Source: https://habr.com/ru/post/444236/


All Articles