mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-18 02:59:38 +00:00
Compare commits
10 Commits
969c4fb369
...
c756852094
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c756852094 | ||
|
|
b7ee8aaa1a | ||
|
|
1a5647bd98 | ||
|
|
60709c4fd6 | ||
|
|
91f4eed086 | ||
|
|
497ed531f3 | ||
|
|
3bde30196c | ||
|
|
8991f41f0b | ||
|
|
dc20f46a94 | ||
|
|
447f7990ae |
13
README.md
13
README.md
@ -39,30 +39,23 @@ graph TD
|
|||||||

|

|
||||||

|

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

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

|

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

|

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

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

|

|
||||||

|

|
||||||
|
|
||||||
## 如何使用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文件进行解包,修改,创建,签名和验证
|
||||||
|
|||||||
13
README_EN.md
13
README_EN.md
@ -22,28 +22,23 @@ 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
|
||||||
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
|
||||||
Sign,Verify,Create, Extract npk file.
|
Sign,Verify,Create, Extract npk file.
|
||||||
|
|||||||
21
README_PT.md
21
README_PT.md
@ -15,17 +15,12 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
### 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
|
|
||||||

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

|

|
||||||

|

|
||||||
@ -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
22
chr.sh
@ -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
|
||||||
|
|||||||
BIN
image/chr.png
BIN
image/chr.png
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB |
BIN
image/x86.png
BIN
image/x86.png
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB |
Loading…
x
Reference in New Issue
Block a user