Compare commits

..

No commits in common. "c756852094a5d94bdb9755e811758b2ad0aa578a" and "969c4fb369f76a117dc5b092ea627e65c25ad2c2" have entirely different histories.

6 changed files with 41 additions and 28 deletions

View File

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

View File

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

View File

@ -15,12 +15,17 @@
![](image/install.png)
![](image/routeros.png)
### Licenciar o RouterOS para x86
![](image/x86.png)
### Renovar a licença para x86 v6.x
![](image/renew_v6.png)
### Renovar a licença para CHR
![](image/renew.png)
### Licenciar o RouterOS para CHR
![](image/chr.png)
![](image/arm.png)
![](image/mips.png)
@ -28,19 +33,20 @@
## Como usar o shell
```bash
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
```bash
Após instalar o pacote `option-{version}.npk`, reinicie o dispositivo. A licença será ativada automaticamente.
Imagens CHR suportam ativação de licença online.
acesse via telnet o routeros com o usuário devel e a senha igual a do admin
execute o keygen
modo CHR pode usar a renovação de licença online
```
## Como usar o Python 3
```bash
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`
```
@ -53,12 +59,7 @@ Assina, verifica, cria e extrai arquivos .npk
```bash
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
[ZMTO](https://console.zmto.com/)

22
chr.sh
View File

@ -138,14 +138,17 @@ show_system_info() {
echo "$MSG_BOOTMODE $BOOT_MODE"
}
confirm_storage() {
STORAGE=$(lsblk | grep disk | head -1 | awk '{print $1}')
confirm_storge() {
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"
STORAGE=$resp
}
confirm_address() {
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)
GATEWAY=$(ip route list | grep default | cut -d' ' -f 3)
if [ -f "/etc/resolv.conf" ]; then
@ -288,24 +291,22 @@ download_image(){
}
create_autorun() {
LOOP=$(losetup -f)
if losetup -P "$LOOP" chr.img; then
if LOOP=$(losetup -Pf --show chr.img 2>/dev/null); then
sleep 1
MNT=/tmp/chr
mkdir -p $MNT
PARTITION=$([ "$V7" == 1 ] && echo "p2" || echo "p1")
if mount "${LOOP}${PARTITION}" "$MNT"; then
if mount "${LOOP}${PARTITION}" "$MNT" 2>/dev/null; then
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"
RANDOM_ADMIN_PASS=$resp
cat <<EOF > "$MNT/rw/autorun.scr"
/user set admin password="$RANDOM_ADMIN_PASS"
/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
EOF
cat "$MNT/rw/autorun.scr"
echo "$MSG_AUTO_RUN_FILE_CREATED"
umount $MNT
losetup -d "$LOOP"
@ -322,14 +323,13 @@ EOF
write_and_reboot() {
confirm_storage
confirm_storge
printf "$MSG_WARNING\n" "$STORAGE"
ask_yesno "$MSG_CONFIRM_CONTINUE"
if [ $? -ne 0 ]; then
echo "$MSG_OPERATION_ABORTED"
exit 1
fi
sync
dd if=chr.img of=/dev/$STORAGE bs=4M conv=fsync
echo "$MSG_REBOOTING"
echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true

BIN
image/chr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
image/x86.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB