mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-18 02:59:38 +00:00
Compare commits
No commits in common. "c756852094a5d94bdb9755e811758b2ad0aa578a" and "969c4fb369f76a117dc5b092ea627e65c25ad2c2" have entirely different histories.
c756852094
...
969c4fb369
13
README.md
13
README.md
@ -39,23 +39,30 @@ graph TD
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
### x86模式授权许可
|
||||||
|

|
||||||
### x86模式在线授权(v6.x)
|
### x86模式在线授权(v6.x)
|
||||||

|

|
||||||
### Chr模式在线授权
|
### Chr模式在线授权
|
||||||

|

|
||||||
|
### Chr模式授权许可
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## 如何使用Shell
|
## 如何使用Shell
|
||||||
安装 option-{version}.npk 包
|
安装 option-{version}.npk 包
|
||||||
在终端执行 /sh 进入shell
|
telnet到RouterOS,用户名devel,密码与admin的密码相同
|
||||||
|
要使用devel用户名登录必须安装option-{version}.npk包,且启用。
|
||||||
## 如何授权许可
|
## 如何授权许可
|
||||||
安装 option-{version}.npk 包后,重启设备,会自动激活授权许可
|
进入shell
|
||||||
|
运行 keygen
|
||||||
|
参考上图。
|
||||||
Chr镜像支持在线授权许可
|
Chr镜像支持在线授权许可
|
||||||
## 如何使用Python
|
## 如何使用Python
|
||||||
安装 python3-{version}.npk 包
|
安装 python3-{version}.npk 包
|
||||||
在终端执行 /sh 进入shell
|
telnet到RouterOS,用户名devel,密码与admin的密码相同
|
||||||
运行 python -V
|
运行 python -V
|
||||||
### npk.py
|
### npk.py
|
||||||
对npk文件进行解包,修改,创建,签名和验证
|
对npk文件进行解包,修改,创建,签名和验证
|
||||||
|
|||||||
13
README_EN.md
13
README_EN.md
@ -22,23 +22,28 @@ By proceeding, you acknowledge that:
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
### license RouterOS for x86.
|
||||||
|

|
||||||
### Renew license for x86 v6.x
|
### Renew license for x86 v6.x
|
||||||

|

|
||||||
### Renew license for chr
|
### Renew license for chr
|
||||||

|

|
||||||
|
### license RouterOS for chr
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## How to use shell
|
## How to use shell
|
||||||
install option-{version}.npk package
|
install option-{version}.npk package
|
||||||
Enter the shell by executing /sh in the terminal.
|
run telnet to routeros with username devel and password is same as admin
|
||||||
## How to license RouterOS
|
## How to license RouterOS
|
||||||
After installing the option-{version}.npk package, reboot the device. The license will be activated automatically.
|
telnet to routeros with username devel and password is same as admin
|
||||||
CHR images support online license activation
|
run keygen
|
||||||
|
chr mode could use renew lincense online
|
||||||
## How to use python3
|
## How to use python3
|
||||||
install python3-{version}.npk package
|
install python3-{version}.npk package
|
||||||
Enter the shell by executing /sh in the terminal.
|
run telnet to routeros with username devel and password is same as admin
|
||||||
run python -V
|
run python -V
|
||||||
### npk.py
|
### npk.py
|
||||||
Sign,Verify,Create, Extract npk file.
|
Sign,Verify,Create, Extract npk file.
|
||||||
|
|||||||
21
README_PT.md
21
README_PT.md
@ -15,12 +15,17 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
### Licenciar o RouterOS para x86
|
||||||
|

|
||||||
|
|
||||||
### Renovar a licença para x86 v6.x
|
### Renovar a licença para x86 v6.x
|
||||||

|

|
||||||
|
|
||||||
### Renovar a licença para CHR
|
### Renovar a licença para CHR
|
||||||

|

|
||||||
|
|
||||||
|
### Licenciar o RouterOS para CHR
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
@ -28,19 +33,20 @@
|
|||||||
## Como usar o shell
|
## Como usar o shell
|
||||||
```bash
|
```bash
|
||||||
instale o pacote option-{versão}.npk
|
instale o pacote option-{versão}.npk
|
||||||
Execute `/sh` no terminal para entrar no Shell.
|
acesse via telnet o routeros com o usuário devel e a senha igual a do usuário admin
|
||||||
```
|
```
|
||||||
|
|
||||||
## Como licenciar o RouterOS
|
## Como licenciar o RouterOS
|
||||||
```bash
|
```bash
|
||||||
Após instalar o pacote `option-{version}.npk`, reinicie o dispositivo. A licença será ativada automaticamente.
|
acesse via telnet o routeros com o usuário devel e a senha igual a do admin
|
||||||
Imagens CHR suportam ativação de licença online.
|
execute o keygen
|
||||||
|
modo CHR pode usar a renovação de licença online
|
||||||
```
|
```
|
||||||
|
|
||||||
## Como usar o Python 3
|
## Como usar o Python 3
|
||||||
```bash
|
```bash
|
||||||
instale o pacote python3-{versão}.npk
|
instale o pacote python3-{versão}.npk
|
||||||
Execute `/sh` no terminal para entrar no Shell.
|
acesse via telnet o routeros com o usuário devel e a senha igual a do admin
|
||||||
execute `python -V`
|
execute `python -V`
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -53,12 +59,7 @@ Assina, verifica, cria e extrai arquivos .npk
|
|||||||
```bash
|
```bash
|
||||||
Altera a chave pública e assina arquivos .npk
|
Altera a chave pública e assina arquivos .npk
|
||||||
```
|
```
|
||||||
### Como ativar o modo container sem reiniciar fisicamente
|
|
||||||
```bash
|
|
||||||
1. Instale o pacote `option.npk`.
|
|
||||||
2. Abra o terminal e execute: `system/device-mode/update container=yes`
|
|
||||||
3. Abra um novo terminal e execute: `system/shell cmd="reboot -f"`
|
|
||||||
```
|
|
||||||
## Thanks for sponsoring
|
## Thanks for sponsoring
|
||||||
[ZMTO](https://console.zmto.com/)
|
[ZMTO](https://console.zmto.com/)
|
||||||
|
|
||||||
|
|||||||
22
chr.sh
22
chr.sh
@ -138,14 +138,17 @@ show_system_info() {
|
|||||||
echo "$MSG_BOOTMODE $BOOT_MODE"
|
echo "$MSG_BOOTMODE $BOOT_MODE"
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm_storage() {
|
confirm_storge() {
|
||||||
STORAGE=$(lsblk | grep disk | head -1 | awk '{print $1}')
|
if command -v lsblk >/dev/null 2>&1; then
|
||||||
|
STORAGE=$(lsblk -d -n -o NAME,TYPE | awk '$2=="disk"{print $1; exit}')
|
||||||
|
else
|
||||||
|
STORAGE=$(fdisk -l | awk '/^Disk \/dev/ {print $2; exit}' | sed 's#:##' | sed 's#/dev/##')
|
||||||
|
fi
|
||||||
ask_until "$MSG_STORAGE_DEVICE" "$STORAGE"
|
ask_until "$MSG_STORAGE_DEVICE" "$STORAGE"
|
||||||
STORAGE=$resp
|
STORAGE=$resp
|
||||||
}
|
}
|
||||||
confirm_address() {
|
confirm_address() {
|
||||||
ETH=$(ip route show default | grep '^default' | sed -n 's/.* dev \([^\ ]*\) .*/\1/p')
|
ETH=$(ip route show default | grep '^default' | sed -n 's/.* dev \([^\ ]*\) .*/\1/p')
|
||||||
MAC=$(cat /sys/class/net/$ETH/address | tr 'a-z' 'A-Z')
|
|
||||||
ADDRESS=$(ip addr show $ETH | grep global | cut -d' ' -f 6 | head -n 1)
|
ADDRESS=$(ip addr show $ETH | grep global | cut -d' ' -f 6 | head -n 1)
|
||||||
GATEWAY=$(ip route list | grep default | cut -d' ' -f 3)
|
GATEWAY=$(ip route list | grep default | cut -d' ' -f 3)
|
||||||
if [ -f "/etc/resolv.conf" ]; then
|
if [ -f "/etc/resolv.conf" ]; then
|
||||||
@ -288,24 +291,22 @@ download_image(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
create_autorun() {
|
create_autorun() {
|
||||||
LOOP=$(losetup -f)
|
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then
|
||||||
if losetup -P "$LOOP" chr.img; then
|
|
||||||
sleep 1
|
sleep 1
|
||||||
MNT=/tmp/chr
|
MNT=/tmp/chr
|
||||||
mkdir -p $MNT
|
mkdir -p $MNT
|
||||||
PARTITION=$([ "$V7" == 1 ] && echo "p2" || echo "p1")
|
PARTITION=$([ "$V7" == 1 ] && echo "p2" || echo "p1")
|
||||||
if mount "${LOOP}${PARTITION}" "$MNT"; then
|
if mount "${LOOP}${PARTITION}" "$MNT" 2>/dev/null; then
|
||||||
confirm_address
|
confirm_address
|
||||||
RANDOM_ADMIN_PASS=$(head -c 512 /dev/urandom | tr -dc 'A-HJ-KMNP-Za-hj-kmnp-z2-9' | head -c 16)
|
RANDOM_ADMIN_PASS=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 16)
|
||||||
ask_until "$MSG_ADMIN_PASSWORD" "$RANDOM_ADMIN_PASS"
|
ask_until "$MSG_ADMIN_PASSWORD" "$RANDOM_ADMIN_PASS"
|
||||||
RANDOM_ADMIN_PASS=$resp
|
RANDOM_ADMIN_PASS=$resp
|
||||||
cat <<EOF > "$MNT/rw/autorun.scr"
|
cat <<EOF > "$MNT/rw/autorun.scr"
|
||||||
/user set admin password="$RANDOM_ADMIN_PASS"
|
/user set admin password="$RANDOM_ADMIN_PASS"
|
||||||
/ip dns set servers=$DNS
|
/ip dns set servers=$DNS
|
||||||
/ip address add address=$ADDRESS interface=[/interface ethernet get [find mac-address=$MAC] name]
|
/ip address add address=$ADDRESS interface=ether1
|
||||||
/ip route add gateway=$GATEWAY
|
/ip route add gateway=$GATEWAY
|
||||||
EOF
|
EOF
|
||||||
cat "$MNT/rw/autorun.scr"
|
|
||||||
echo "$MSG_AUTO_RUN_FILE_CREATED"
|
echo "$MSG_AUTO_RUN_FILE_CREATED"
|
||||||
umount $MNT
|
umount $MNT
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
@ -322,14 +323,13 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
write_and_reboot() {
|
write_and_reboot() {
|
||||||
confirm_storage
|
confirm_storge
|
||||||
printf "$MSG_WARNING\n" "$STORAGE"
|
printf "$MSG_WARNING\n" "$STORAGE"
|
||||||
ask_yesno "$MSG_CONFIRM_CONTINUE"
|
ask_yesno "$MSG_CONFIRM_CONTINUE"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$MSG_OPERATION_ABORTED"
|
echo "$MSG_OPERATION_ABORTED"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sync
|
|
||||||
dd if=chr.img of=/dev/$STORAGE bs=4M conv=fsync
|
dd if=chr.img of=/dev/$STORAGE bs=4M conv=fsync
|
||||||
echo "$MSG_REBOOTING"
|
echo "$MSG_REBOOTING"
|
||||||
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true
|
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true
|
||||||
|
|||||||
BIN
image/chr.png
Normal file
BIN
image/chr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
BIN
image/x86.png
Normal file
BIN
image/x86.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
Loading…
x
Reference in New Issue
Block a user