Compare commits

..

10 Commits

Author SHA1 Message Date
elseif
c756852094 modified: chr.sh 2026-07-09 12:37:54 +08:00
elseif
b7ee8aaa1a modified: chr.sh 2026-07-09 12:33:14 +08:00
elseif
1a5647bd98 modified: chr.sh 2026-07-09 12:31:45 +08:00
elseif
60709c4fd6 modified: README.md
modified:   README_EN.md
	modified:   README_PT.md
	deleted:    image/chr.png
	deleted:    image/x86.png
2026-07-09 12:28:10 +08:00
elseif
91f4eed086 modified: chr.sh 2026-07-09 11:59:57 +08:00
elseif
497ed531f3 modified: chr.sh 2026-07-09 11:45:01 +08:00
elseif
3bde30196c modified: chr.sh 2026-07-09 11:39:52 +08:00
elseif
8991f41f0b modified: chr.sh 2026-07-09 11:37:47 +08:00
elseif
dc20f46a94 modified: chr.sh 2026-07-09 11:33:26 +08:00
elseif
447f7990ae modified: chr.sh 2026-07-09 11:19:43 +08:00
6 changed files with 28 additions and 41 deletions

View File

@ -39,30 +39,23 @@ graph TD
![](image/install.png) ![](image/install.png)
![](image/routeros.png) ![](image/routeros.png)
### x86模式授权许可
![](image/x86.png)
### x86模式在线授权(v6.x) ### x86模式在线授权(v6.x)
![](image/renew_v6.png) ![](image/renew_v6.png)
### Chr模式在线授权 ### Chr模式在线授权
![](image/renew.png) ![](image/renew.png)
### Chr模式授权许可
![](image/chr.png)
![](image/arm.png) ![](image/arm.png)
![](image/mips.png) ![](image/mips.png)
## 如何使用Shell ## 如何使用Shell
安装 option-{version}.npk 包 安装 option-{version}.npk 包
telnet到RouterOS,用户名devel,密码与admin的密码相同 在终端执行 /sh 进入shell
要使用devel用户名登录必须安装option-{version}.npk包且启用。
## 如何授权许可 ## 如何授权许可
进入shell 安装 option-{version}.npk 包后,重启设备,会自动激活授权许可
运行 keygen
参考上图。
Chr镜像支持在线授权许可 Chr镜像支持在线授权许可
## 如何使用Python ## 如何使用Python
安装 python3-{version}.npk 包 安装 python3-{version}.npk 包
telnet到RouterOS,用户名devel,密码与admin的密码相同 在终端执行 /sh 进入shell
运行 python -V 运行 python -V
### npk.py ### npk.py
对npk文件进行解包修改创建签名和验证 对npk文件进行解包修改创建签名和验证

View File

@ -22,28 +22,23 @@ By proceeding, you acknowledge that:
![](image/install.png) ![](image/install.png)
![](image/routeros.png) ![](image/routeros.png)
### license RouterOS for x86.
![](image/x86.png)
### Renew license for x86 v6.x ### Renew license for x86 v6.x
![](image/renew_v6.png) ![](image/renew_v6.png)
### Renew license for chr ### Renew license for chr
![](image/renew.png) ![](image/renew.png)
### license RouterOS for chr
![](image/chr.png)
![](image/arm.png) ![](image/arm.png)
![](image/mips.png) ![](image/mips.png)
## How to use shell ## How to use shell
install option-{version}.npk package install option-{version}.npk package
run telnet to routeros with username devel and password is same as admin Enter the shell by executing /sh in the terminal.
## How to license RouterOS ## How to license RouterOS
telnet to routeros with username devel and password is same as admin After installing the option-{version}.npk package, reboot the device. The license will be activated automatically.
run keygen CHR images support online license activation
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
run telnet to routeros with username devel and password is same as admin Enter the shell by executing /sh in the terminal.
run python -V run python -V
### npk.py ### npk.py
SignVerifyCreate, Extract npk file. SignVerifyCreate, Extract npk file.

View File

@ -15,17 +15,12 @@
![](image/install.png) ![](image/install.png)
![](image/routeros.png) ![](image/routeros.png)
### Licenciar o RouterOS para x86
![](image/x86.png)
### Renovar a licença para x86 v6.x ### Renovar a licença para x86 v6.x
![](image/renew_v6.png) ![](image/renew_v6.png)
### Renovar a licença para CHR ### Renovar a licença para CHR
![](image/renew.png) ![](image/renew.png)
### Licenciar o RouterOS para CHR
![](image/chr.png)
![](image/arm.png) ![](image/arm.png)
![](image/mips.png) ![](image/mips.png)
@ -33,20 +28,19 @@
## Como usar o shell ## Como usar o shell
```bash ```bash
instale o pacote option-{versão}.npk instale o pacote option-{versão}.npk
acesse via telnet o routeros com o usuário devel e a senha igual a do usuário admin Execute `/sh` no terminal para entrar no Shell.
``` ```
## Como licenciar o RouterOS ## Como licenciar o RouterOS
```bash ```bash
acesse via telnet o routeros com o usuário devel e a senha igual a do admin Após instalar o pacote `option-{version}.npk`, reinicie o dispositivo. A licença será ativada automaticamente.
execute o keygen Imagens CHR suportam ativação de licença online.
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
acesse via telnet o routeros com o usuário devel e a senha igual a do admin Execute `/sh` no terminal para entrar no Shell.
execute `python -V` execute `python -V`
``` ```
@ -59,7 +53,12 @@ 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
View File

@ -138,17 +138,14 @@ show_system_info() {
echo "$MSG_BOOTMODE $BOOT_MODE" echo "$MSG_BOOTMODE $BOOT_MODE"
} }
confirm_storge() { confirm_storage() {
if command -v lsblk >/dev/null 2>&1; then STORAGE=$(lsblk | grep disk | head -1 | awk '{print $1}')
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
@ -291,22 +288,24 @@ download_image(){
} }
create_autorun() { create_autorun() {
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then LOOP=$(losetup -f)
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" 2>/dev/null; then if mount "${LOOP}${PARTITION}" "$MNT"; then
confirm_address confirm_address
RANDOM_ADMIN_PASS=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 16) RANDOM_ADMIN_PASS=$(head -c 512 /dev/urandom | tr -dc 'A-HJ-KMNP-Za-hj-kmnp-z2-9' | 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=ether1 /ip address add address=$ADDRESS interface=[/interface ethernet get [find mac-address=$MAC] name]
/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"
@ -323,13 +322,14 @@ EOF
write_and_reboot() { write_and_reboot() {
confirm_storge confirm_storage
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB