📜 ⬆️ ⬇️

A universal method of circumventing the ban Yota to distribute the Internet from the phone or collect the Android kernel module

Old methods and their disadvantages


I think no one is interested in reading the second time (and maybe the third ), about how Yota determines whether a person uses the phone in modem mode or an access point. “Why do we need another article?” - you ask.

The point is that the workaround methods listed on the links do not allow you to customize the phone so that later when you connect any devices you do not need to configure anything again. In addition, the user will experience serious inconvenience if he connects multiple devices with different TTL. It is necessary to change at least TTL on one of them.

It was these reasons that motivated me to dig further in search of the answer to the eternal question "How is it possible to distribute Internet to the whole office free of charge?" And it was possible to find such an answer (only for android, I do not have an apple).

Ready program


When I found out that Yota was monitoring TTL, I assumed that there must be providers in other countries that do the same. We are trying to enter the TTL in the search for the Play Market.
')
I was right: the TTLEditor program was immediately found. Very pleased that it is not only free, but also open source .
It is very simple to use: select the interface (it is best to choose the interface through which the phone is connected to the provider, mine is rmnet0 ) and press the OK button. You can also put the program to trigger when the phone boots.



Only one problem arose: the program gave the error " TTL update failed ". Before scolding the author in the comments and minus on the Play Market, I decided to read the source code.

Note. Perhaps, on your phone model, the program will work immediately. So you are very lucky, close this article and enjoy life.

Error reason


The main action of the program is to launch the following command as root:
iptables -t mangle -A POSTROUTING -o <interface> -j TTL --ttl-set <TTL value>
Many brains do not need to understand what this command does (besides, the program says about it): it sets the TTL value to all packets passing through a certain interface (that is, what we need).

I tried to execute the command manually and saw the following error: iptables: No chain / target / match by that name . A couple of minutes of googling showed that this iptables error is ready to give out almost any incorrect parameters. We google in relation to the TTL and still find something . We look, as far as we found the appropriate information.

The cat /proc/net/ip_tables_matches list with ttl , that is, the kernel knows how to check the TTL. But there is no TTL in the list issued by the cat /proc/net/ip_tables_targets , so our kernel is not able to modify the TTL . We will not surrender to such impudent collusion of mobile providers and manufacturers, so we are going to assemble a kernel module, which is not enough.

I think that at this stage, users of CyanogenMod already maliciously snicker, but I didn’t want to simply give up the standard system, but wanted to add new features to it (even without replacing the core).

Retreat


Further, I assume that the reader knows how to use Linux, understands what the kernel and kernel modules are, and also knows how to transfer files (adb push / pull) with adb and how to open a phone terminal on the computer (adb shell). If not - urgently in Google! If yes, do not forget to enable USB debugging.

What to collect and what


This is the most difficult step : you need to find a suitable cross-compiler and kernel sources. Try to search for your phone, because otherwise, most likely, it will not work (and this will be known only at the last step). I made several unsuccessful attempts at making a mistake at this stage.

The model of my phone is Sony Xperia Z1 Compact, the operating system of my computer is Ubuntu 14.04. Below on their example, I will show how you can act.





Setup and build


Those who are faced with the process of building the kernel for the first time, do not panic, with Google we are always god-like .







Using the module on the phone


We drop the xt_HL.ko module xt_HL.ko the phone and try to connect it to the kernel with the insmod command.
If this command gives an error, then the details can be found in the output of the dmesg (most likely it will be a conflict between the kernel version and the module or something similar - this means that the wrong kernel sources or the cross compiler were taken).

If the insmod command succeeds, then the module was able to connect to the kernel (you can check it with the lsmod command).
After that we will try to start the command that TTLEditor tried unsuccessfully to use. Does not give an error? So the rule is added to the list. You can check with the command iptables -t mangle -L :



We try to distribute the Internet to any devices and enjoy.

Setup autoload


The last step remains: to do so, to be able to distribute the Internet whenever you want.

Create a setup_ttl_editing.sh file with the following contents:
 #!/system/bin/sh insmod /storage/sdcard0/xt_HL.ko iptables -t mangle -A POSTROUTING -o rmnet+ -j TTL --ttl-set 64 

We drop it on the phone, install the Script Manager program and configure it in it so that the script runs when the system boots and from the root user.



Everything is set up, you can forget about the problem of distributing the Internet from your phone!

Note. We don’t need TTLEditor. Everything you need is already written in the script.

Conclusion


I will not write " iota, do not be greedy, " because compared to many other mobile providers, they are still quite generous. I'd rather say: iota, stay the same as you are.

Download the file xt_HL.ko , which I got for the Xperia Z1 Compact, you can follow this link .
Perhaps it is suitable for similar phone models.

UPD on 03/13/2015. Thanks to the user CTE6EJIb for the file xt_HL.ko for Xperia V Android 4.3, firmware version 9.2.A.2.5.
UPD from 08/01/2015. Compile for Xperia Z1 Compact for Android 5, firmware version 14.5.A.0.270. Download .

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


All Articles