Skip to content

Add using hotplug, init.d and procd OpenWrt system. Do not more need … #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5dabc4e
Add using hotplug, init.d and procd OpenWrt system. Do not more need …
ilya-fedin Oct 16, 2016
ad6b1a8
fixes and new features
ilya-fedin Oct 17, 2016
b273a7e
New files
ilya-fedin Oct 17, 2016
d66e8fa
readme fix
ilya-fedin Oct 17, 2016
75455ef
readme fix
ilya-fedin Oct 17, 2016
1f70e4c
readme fix
ilya-fedin Oct 17, 2016
cf5c087
readme fix
ilya-fedin Oct 17, 2016
29f565a
readme fix
ilya-fedin Oct 17, 2016
6c8fe6a
readme fix
ilya-fedin Oct 17, 2016
f15c681
readme fix
ilya-fedin Oct 17, 2016
bdc0aed
readme fix
ilya-fedin Oct 17, 2016
4f305e3
readme fix
ilya-fedin Oct 17, 2016
db0800b
readme fix
ilya-fedin Oct 17, 2016
533da43
readme fix
ilya-fedin Oct 17, 2016
61fa47f
readme fix
ilya-fedin Oct 17, 2016
fb8db67
readme fix
ilya-fedin Oct 17, 2016
250ddec
readme fix
ilya-fedin Oct 17, 2016
55d51b2
readme fix
ilya-fedin Oct 17, 2016
a36c1a2
more info
ilya-fedin Oct 17, 2016
5c869f9
for completion
ilya-fedin Oct 17, 2016
68b5724
Scripts for Huawei HiLink, simplify scripts from @derlaft and ReadMe
ilya-fedin Oct 17, 2016
7399cae
readme fix
ilya-fedin Oct 17, 2016
4d1d306
readme fix
ilya-fedin Oct 17, 2016
d875a56
small update
ilya-fedin Oct 18, 2016
c33bc2d
add windows adb
ilya-fedin Oct 18, 2016
c550f90
fix windows scripts
ilya-fedin Oct 19, 2016
cb5f8e9
bugfix and mf910
ilya-fedin Oct 19, 2016
d48d6d3
Bugfix
ilya-fedin Oct 19, 2016
6802ea5
mf910 in header
ilya-fedin Oct 19, 2016
29fb366
And edit for linux...
ilya-fedin Oct 19, 2016
f329fa3
OpenWrt packges, uci integration and more...
ilya-fedin Nov 17, 2016
410f486
probeport path fix
ilya-fedin Nov 17, 2016
44ddacf
Add telnet support and small fixes
ilya-fedin Nov 17, 2016
760b9de
Add ca-certificates as dependency
ilya-fedin Nov 17, 2016
640fcca
Add support of static tty and small fixes
ilya-fedin Nov 17, 2016
d8e7339
small fix
ilya-fedin Nov 17, 2016
4579196
small fix
ilya-fedin Nov 17, 2016
6cc390b
more telnet reboot methods!
ilya-fedin Nov 17, 2016
03d0cbc
send at commands without atc
ilya-fedin Nov 17, 2016
006064e
small fix
ilya-fedin Nov 17, 2016
0810327
add ttl configuration support
ilya-fedin Nov 20, 2016
04db8fa
Prevent multiple downloads
ilya-fedin Nov 27, 2016
48d9164
fix deps
ilya-fedin Nov 27, 2016
829611d
fix deps
ilya-fedin Nov 27, 2016
b7bdf24
Small fixes
ilya-fedin Nov 28, 2016
bc1dcf8
restore files
ilya-fedin Nov 28, 2016
743d834
fix tty detect
ilya-fedin Nov 28, 2016
67d7a05
fix permissions
ilya-fedin Nov 28, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ipk
183 changes: 183 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=yota
PKG_VERSION:=20161128

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/yota/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Yota
TITLE:=Scripts for cheat mobile operator regarding tethering detection
MAINTAINER:=Ilya Fedin <[email protected]>
URL:=https://github.com/ilya-fedin/yota
PKGARCH:=all
endef

define Package/yota/Default/description
Yota - Russian virtual mobile operator, who blocks tethering at smartpone sim.
People not wish waste money for modem, and cheats Yota and other mobile operators regarding tethering detection.
These scripts helps you cheat your mobile operator!
endef

define Package/yota
$(call Package/yota/Default)
TITLE+= (base files)
DEPENDS:=+comgt +iptables-mod-ipopt +iptables
endef

define Package/yota/description
$(call Package/yota/Default/description)
Base files for cheat - fix ttl, configs, etc.
endef

define Package/yotaban
$(call Package/yota/Default)
TITLE+= (bans bad IPs)
DEPENDS:=+yota +iptables +wget +ca-certificates
endef

define Package/yotaban/description
$(call Package/yota/Default/description)
Ban bad IPs with iptables.
endef

define Package/yotaban-nossl
$(call Package/yota/Default)
TITLE+= (bans bad IPs, mirror source)
DEPENDS:=+yota +iptables
endef

define Package/yotaban-nossl/description
$(call Package/yota/Default/description)
Ban bad IPs with iptables - alternate source without https.
endef

define Package/yotareboot
$(call Package/yota/Default)
TITLE+= (reboots on tethering detection)
DEPENDS:=+yota
endef

define Package/yotareboot/description
$(call Package/yota/Default/description)
Autoreboot your router at beggar and don't leave your beach!
endef

define Package/yota/conffiles
/etc/config/yota
endef

define Build/Prepare
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/yota/install
$(CP) ./files/* $(1)
endef

define Package/yotaban/install
$(CP) ./files-ban/* $(1)
endef

define Package/yotaban-nossl/install
$(CP) ./files-ban-nossl/* $(1)
endef

define Package/yotareboot/install
$(CP) ./files-reboot/* $(1)
endef

define Package/yota/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for yota"
/etc/init.d/ttl enable
fi
exit 0
endef

define Package/yota/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for yota"
/etc/init.d/ttl disable
fi
exit 0
endef


define Package/yotaban/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for yotaban"
/etc/init.d/yotaban enable
fi
exit 0
endef

define Package/yotaban/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for yotaban"
/etc/init.d/yotaban disable
fi
exit 0
endef

define Package/yotaban-nossl/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for yotaban-nossl"
/etc/init.d/yotaban enable
fi
exit 0
endef

define Package/yotaban-nossl/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for yotaban-nossl"
/etc/init.d/yotaban disable
fi
exit 0
endef

define Package/yotareboot/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for yotareboot"
/etc/init.d/yotareboot enable
fi
exit 0
endef

define Package/yotareboot/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for yotareboot"
/etc/init.d/yotareboot disable
fi
exit 0
endef

$(eval $(call BuildPackage,yota))
$(eval $(call BuildPackage,yotaban))
$(eval $(call BuildPackage,yotaban-nossl))
$(eval $(call BuildPackage,yotareboot))
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Способы перезапуска модема
По умолчанию в скрипте используется метод ребута роутера, но есть и другие методы. Ну что, поехали?

## Способ 1 - перезагрузка через API
У HiLink есть API. Через него можно делать с модемом все что угодно - перезагружать, реконнектить и т.д. Подробности в /sbin/yotareboot.

## Способ 2 - перезагрузка через telnet
У модифицированных прошивок есть telnet, через него можно перезагрузить модем.

Если nc полноценный:

echo reboot | nc -w 1 -i 1 192.168.8.1 23

Если нет:

(echo reboot; sleep 1) | nc 192.168.8.1 23 & (sleep 1; kill `pidof $(ps | grep 'nc 192.168.8.1 23' | grep -v 'grep')`)

## Способ 3 - перезагрузка через adb
У adb есть два способа перезагрузки:

1. `adb reboot`
2. `adb shell reboot`

## Способ 4 - AT-команды
Вот оно! Единственный нормальный способ!
И так, нам понадобится лишь gcom, модифицированная прошивка для вашего модема (необязательно, зависит от модели) и скрипт в этом репозитории.
Ну что ж, поехали!

Сначала пропишем открытие порта PC UI. Для этого любым удобным способом открываем порты и вводим в порт PC UI вашим любимым терминалом:

`AT^NVWREX=50091,0,60,01 00 00 00 A1 A2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A3 A2 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00`

А теперь самое интересное - команды для перезапуска модема с роутера.

1. `COMMAND=AT^RESET gcom -d $device -s /etc/gcom/runcommand.gcom`
2. `COMMAND=AT+CFUN=1,1 gcom -d $device -s /etc/gcom/runcommand.gcom`

Выбирайте любую понравившуюся. Первая комнада чисто хуавеевская. Где $device - путь до командного порта. Скорее всего это будет /dev/ttyUSB0. В стике всегда несколько портов, обычно это самый старший. У меня это /dev/ttyUSB2.

И да, для вас наверняка осталось не понятным, когда нужна модифицированная прошивка. Очень просто! Она нужна тогда, когда на вашей прошивке заблокированно выполнение кодман ^NVWREX и ^NVRDEX. Узнать об этом можно в теме своего модема на 4PDA.

## Способ 5 - usbreset
`usbreset "Имя устройства"`

## Способ 6 - реконнект средствами OpenWrt
Подходит только для стика, увы

`/etc/init.d/network restart`

## Способ 7 - установка скрипта перезапуска прямо в модема
Пожалуй, идеальный вариант для HiLink!

Все, что нужно, вы найдете в архиве yotahilink.zip

Там есть скрипты для установки как под Windows, так и под Linux.

# Фикс TTL
Здесь приложена служба для фиксации TTL.

7 changes: 0 additions & 7 deletions ban.sh

This file was deleted.

15 changes: 15 additions & 0 deletions files-ban-nossl/etc/hotplug.d/iface/99-yotaban
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

[ "$ACTION" = ifup ] || exit 0
[ "`ps w | grep 'wget -O - http://cdn.rawgit.com/TTLMaster/yota-ban-list/master/list.txt' | grep -v 'grep'`" ] && exit 0
/etc/init.d/yotaban enabled || exit 0

# remove old records
iptables -F yotaban

# update and add new records
wget -O - http://cdn.rawgit.com/TTLMaster/yota-ban-list/master/list.txt | \
while read -r i; do
[ "`echo $i | sed -n '/^#.*$/p'`" ] && continue
iptables -A yotaban -d $i -j DROP
done
14 changes: 14 additions & 0 deletions files-ban-nossl/etc/init.d/yotaban
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh /etc/rc.common

START=99

start() {
iptables -N yotaban
iptables -A FORWARD -j yotaban
}

stop() {
iptables -D FORWARD -j yotaban
iptables -F yotaban
iptables -X yotaban
}
15 changes: 15 additions & 0 deletions files-ban/etc/hotplug.d/iface/99-yotaban
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

[ "$ACTION" = ifup ] || exit 0
[ "`ps w | grep 'wget -O - https://raw.githubusercontent.com/TTLMaster/yota-ban-list/master/list.txt' | grep -v 'grep'`" ] && exit 0
/etc/init.d/yotaban enabled || exit 0

# remove old records
iptables -F yotaban

# update and add new records
wget -O - https://raw.githubusercontent.com/TTLMaster/yota-ban-list/master/list.txt | \
while read -r i; do
[ "`echo $i | sed -n '/^#.*$/p'`" ] && continue
iptables -A yotaban -d $i -j DROP
done
14 changes: 14 additions & 0 deletions files-ban/etc/init.d/yotaban
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh /etc/rc.common

START=99

start() {
iptables -N yotaban
iptables -A FORWARD -j yotaban
}

stop() {
iptables -D FORWARD -j yotaban
iptables -F yotaban
iptables -X yotaban
}
11 changes: 11 additions & 0 deletions files-reboot/etc/init.d/yotareboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1

start_service() {
procd_open_instance
procd_set_param command /sbin/yotareboot
procd_set_param respawn
procd_close_instance
}
Loading