Compare commits

...

37 Commits

Author SHA1 Message Date
elseif
969c4fb369 modified: README.md
modified:   README_EN.md
2026-07-01 12:52:02 +08:00
elseif
bbf8ed23e3 modified: .github/workflows/mikrotik_patch_7.yml 2026-06-28 05:22:27 +08:00
elseif
7039d76825 update busybox to v1.38.0 2026-06-27 10:52:21 +08:00
elseif
5e9340c741 modified: .github/workflows/mikrotik_patch_7.yml 2026-06-27 10:27:23 +08:00
elseif
ac2cfdeafd modified: .github/workflows/mikrotik_patch_7.yml 2026-06-27 01:17:47 +08:00
elseif
e728aec84c modified: .github/workflows/mikrotik_patch_7.yml 2026-06-27 01:15:51 +08:00
elseif
1d9971b387 modified: .github/workflows/mikrotik_patch_7.yml 2026-06-27 01:13:22 +08:00
elseif
1cfb6dba3d modified: .github/workflows/mikrotik_patch_7.yml 2026-06-27 01:10:16 +08:00
elseif
ba0ffe3cd7 modified: README.md 2026-05-26 06:55:31 +08:00
elseif
7cf469dc0c modified: .github/workflows/mikrotik_patch_7.yml 2026-05-25 09:34:19 +08:00
elseif
30d6ac5fe6 modified: .github/workflows/mikrotik_patch_7.yml
modified:   patch.py
2026-05-19 23:52:12 +08:00
elseif
7fd1b6c563 modified: .github/workflows/mikrotik_patch_7.yml 2026-05-19 23:17:13 +08:00
elseif
ed3dcd0ab1 modified: patch.py 2026-05-19 23:06:47 +08:00
elseif
0a270a1108 Upgrade actions/cache and action-gh-release versions
Signed-off-by: elseif <elseif@live.cn>
2026-04-20 16:00:24 +08:00
elseif
7a6fdb6323 Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-04-18 01:09:01 +08:00
elseif
44bc4346c6 Merge pull request #185 from LucasStone98/main
Fix sourceforge link for building images
2026-04-18 01:07:38 +08:00
Daniel Samuels
98d6af79f7 Update mikrotik_patch_7.yml
Fix sourceforge link for refind

Signed-off-by: Daniel Samuels <47313460+LucasStone98@users.noreply.github.com>
2026-04-17 12:41:21 +02:00
elseif
11eec19e7d Upgrade GitHub Actions to checkout@v6 and setup-python@v6
Signed-off-by: elseif <elseif@live.cn>
2026-04-02 10:28:05 +08:00
elseif
9e1d7a5239 Upgrade GitHub Actions to checkout@v6 and setup-python@v6
Signed-off-by: elseif <elseif@live.cn>
2026-04-02 10:27:38 +08:00
elseif
569e0b5749 Update index.html
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 08:29:36 +08:00
elseif
5d9cc6d745 Update index.html
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 08:09:57 +08:00
elseif
0f62f5de4e Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 07:55:25 +08:00
elseif
7f2120dca8 Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 04:06:04 +08:00
elseif
9be7cdc6ec Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 04:01:33 +08:00
elseif
b7eccac7c5 Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 03:58:29 +08:00
elseif
e0afc29cca Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 03:53:34 +08:00
elseif
98dfe256e6 Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-03-30 03:50:34 +08:00
elseif
f179b74d3e Update wget command to include no-check-certificate option
Signed-off-by: elseif <elseif@live.cn>
2026-03-25 13:06:51 +08:00
elseif
c71a8ff9c1 Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-01-10 12:42:37 +08:00
elseif
b35ce475ab Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-01-10 12:29:19 +08:00
elseif
976e562e83 Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-01-10 11:41:38 +08:00
elseif
86e11b647d Update index.html
Signed-off-by: elseif <elseif@live.cn>
2025-10-22 14:12:58 +08:00
elseif
07c6617805 Update README.md
Signed-off-by: elseif <elseif@live.cn>
2025-10-22 14:09:03 +08:00
elseif
bf2865921a Update README.md
Signed-off-by: elseif <elseif@live.cn>
2025-10-21 18:14:25 +08:00
elseif
604631539c Update README.md
Signed-off-by: elseif <elseif@live.cn>
2025-10-21 17:53:20 +08:00
elseif
fc7bb4f206 Update README.md
Signed-off-by: elseif <elseif@live.cn>
2025-10-21 17:51:22 +08:00
elseif
410c19d2ce Update mikrotik_patch_7.yml
Signed-off-by: elseif <elseif@live.cn>
2025-10-09 11:25:48 +08:00
10 changed files with 229 additions and 93 deletions

View File

@@ -98,10 +98,10 @@ jobs:
RELEASE: ${{ needs.Set_Variables.outputs.RELEASE }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'

View File

@@ -22,6 +22,7 @@ on:
type: choice
options:
- stable
- long-term
- testing
version:
description: "Specify version (e.g., 7.19.2), empty for latest"
@@ -87,7 +88,7 @@ jobs:
BUILD_TIME=$(date +'%s')
RELEASE=true
MATRIX_JSON='[{"arch":"x86","channel":"stable"},{"arch":"arm64","channel":"stable"},{"arch":"arm","channel":"stable"},{"arch":"x86","channel":"testing"},{"arch":"arm64","channel":"testing"},{"arch":"arm","channel":"testing"}]'
MATRIX_JSON='[{"arch":"x86","channel":"stable"},{"arch":"arm64","channel":"stable"},{"arch":"x86","channel":"testing"},{"arch":"arm64","channel":"testing"}]'
MATRIX_JSON='[{"arch":"x86","channel":"stable"},{"arch":"arm64","channel":"stable"},{"arch":"x86","channel":"long-term"},{"arch":"arm64","channel":"long-term"},{"arch":"x86","channel":"testing"},{"arch":"arm64","channel":"testing"}]'
fi
echo "BUILD_TIME=$BUILD_TIME" >> $GITHUB_OUTPUT
echo "RELEASE=$RELEASE" >> $GITHUB_OUTPUT
@@ -108,10 +109,10 @@ jobs:
RELEASE: ${{ needs.Set_Variables.outputs.RELEASE }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
@@ -187,26 +188,83 @@ jobs:
for cmd in $COMMANDS; do
sudo ln -sf /pckg/option/bin/busybox ./option-root/bin/$cmd
done
sudo mksquashfs option-root option.sfs -quiet -comp xz -no-xattrs -b 256k
sudo mkdir -p option-root/home/web/webfig/
BUSYBOX=$(./busybox/busybox_x86 | head -1 | cut -d' ' -f2)
sudo tee option.jg > /dev/null << EOF
[
{
name:'Patch About',
title:'Patch About',
icon: 30,
prio: 2000,
c:[
{
title:'Patch About',
type:'item',
path:[24, 2],
autorefresh: 1000,
ro: 1,
c: [
{name:'Author',type:'string',def:'elseif@live.cn'},
{name:'GitHub',type:'string',def:'https://github.com/elseif/MikroTikPatch', url:1},
{name:'Telegram',type:'string',def:'https://t.me/mikrotikpatch', url:1},
{name:'Homepage',type:'string',def:'https://mikrotik.ltd', url:1},
{type:'separator'},
{name:'Busybox',type:'string',def:'$BUSYBOX'},
{name:'Uptime',type:'interval',id:'u1'},
{name:'Architecture Name',type:'string',id:'s1a'},
{name:'Board Name',type:'string',id:'s2c'},
{name:'Version',type:'version',id:'s16'},
{name:'Build Time',type:'string',id:'s27'}
]
}
]
}
]
EOF
sudo apt-get install python3-crcmod > /dev/null
HASH=$(sudo python3 -E <<EOF
import hashlib, crcmod, sys
with open('option.jg','rb') as f:
data = f.read()
sha1 = hashlib.sha1(data).hexdigest()[:12]
crc = crcmod.mkCrcFun(0x104C11DB7, initCrc=0xFFFFFFFF, rev=False, xorOut=0xFFFFFFFF)(data)
print(f"{sha1} {crc}")
EOF
)
SHA1_PREFIX=$(echo "$HASH" | awk '{print $1}')
CRC=$(echo "$HASH" | awk '{print $2}')
sudo mv option.jg option-$SHA1_PREFIX.jg
sudo python3 -E << EOF
import gzip
gzip.open('option-$SHA1_PREFIX.jg.gz', 'wb', compresslevel=0).write(open('option-$SHA1_PREFIX.jg', 'rb').read())
EOF
SIZE=$(stat -c %s option-$SHA1_PREFIX.jg.gz)
sudo mv option-$SHA1_PREFIX.jg.gz option-root/home/web/webfig/
sudo tee option-root/home/web/webfig/option.info > /dev/null << EOF
{ crc: $CRC, size: $SIZE, name: "option.jg", unique: "option-$SHA1_PREFIX.jg",version: "$LATEST_VERSION" },
EOF
sudo ln -sf option-$SHA1_PREFIX.jg.gz option-root/home/web/webfig/option.jg.gz
sudo mksquashfs option-root option.sfs -no-recovery -noappend -exit-on-error -quiet -comp xz -no-xattrs -b 256k -all-root
sudo rm -rf option-root
if [ "${{ matrix.arch }}" == "x86" ]; then
sudo wget -O cpython.tar.gz -nv https://github.com/indygreg/python-build-standalone/releases/download/20250708/cpython-3.11.13+20250708-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
sudo wget -O cpython.tar.gz -nv https://github.com/astral-sh/python-build-standalone/releases/download/20241206/cpython-3.11.11+20241206-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
elif [ "${{ matrix.arch }}" == "arm64" ]; then
sudo wget -O cpython.tar.gz -nv https://github.com/indygreg/python-build-standalone/releases/download/20250708/cpython-3.11.13+20250708-aarch64-unknown-linux-gnu-install_only_stripped.tar.gz
sudo wget -O cpython.tar.gz -nv https://github.com/indygreg/python-build-standalone/releases/download/20241206/cpython-3.11.11+20241206-aarch64-unknown-linux-gnu-install_only_stripped.tar.gz
elif [ "${{ matrix.arch }}" == "arm" ]; then
sudo wget -O cpython.tar.gz -nv https://github.com/indygreg/python-build-standalone/releases/download/20250708/cpython-3.11.13+20250708-armv7-unknown-linux-gnueabi-install_only_stripped.tar.gz
sudo wget -O cpython.tar.gz -nv https://github.com/indygreg/python-build-standalone/releases/download/20241206/cpython-3.11.11+20241206-armv7-unknown-linux-gnueabi-install_only_stripped.tar.gz
fi
sudo tar -xf cpython.tar.gz
sudo rm cpython.tar.gz
sudo rm -rf ./python/include
sudo rm -rf ./python/share
sudo mksquashfs python python3.sfs -quiet -comp xz -no-xattrs -b 256k
sudo mksquashfs python python3.sfs -no-recovery -noappend -exit-on-error -quiet -comp xz -no-xattrs -b 256k -all-root
sudo rm -rf ./python
- name: Cache mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}.iso
if: steps.get_latest.outputs.has_new_version == 'true' && (matrix.arch == 'x86' || matrix.arch == 'arm64')
id: cache-mikrotik
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
mikrotik.iso
@@ -218,11 +276,23 @@ jobs:
run: |
sudo wget -nv -O mikrotik.iso https://download.mikrotik.com/routeros/$LATEST_VERSION/mikrotik-$LATEST_VERSION$ARCH.iso
- name: Cache refind
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86'
id: cache-refind
uses: actions/cache@v5
with:
path: refind-bin-0.14.2.zip
key: refind
restore-keys: refind
- name: Get refind
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && steps.cache-refind.outputs.cache-hit != 'true'
run: sudo wget -O refind-bin-0.14.2.zip https://downloads.sourceforge.net/project/refind/0.14.2/refind-bin-0.14.2.zip
- name: Patch mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}.iso
if: steps.get_latest.outputs.has_new_version == 'true' && (matrix.arch == 'x86' || matrix.arch == 'arm64')
run: |
sudo apt-get install -y mkisofs xorriso > /dev/null
sudo apt-get install -y build-essential binutils-arm-linux-gnueabi mkisofs xorriso > /dev/null
sudo mkdir ./iso
sudo mount -o loop,ro mikrotik.iso ./iso
sudo mkdir ./new_iso
@@ -262,12 +332,23 @@ jobs:
sudo -E python3 npk.py create ./new_iso/gps-$LATEST_VERSION$ARCH.npk ./python3-$LATEST_VERSION$ARCH.npk python3 ./python3.sfs -desc="python 3.11.13"
sudo cp python3-$LATEST_VERSION$ARCH.npk ./new_iso/
sudo mkdir ./efiboot
sudo mount -o loop ./new_iso/efiboot.img ./efiboot
if [ "${{ matrix.arch }}" == "x86" ]; then
sudo -E python3 patch.py kernel ./efiboot/linux.x86_64
sudo cp ./efiboot/linux.x86_64 ./BOOTX64.EFI
sudo cp ./BOOTX64.EFI ./new_iso/isolinux/linux
sudo umount ./efiboot
truncate --size 32M efiboot.img
sudo mkfs.fat -F16 -n ROUTEROS efiboot.img
sudo mount -o loop efiboot.img efiboot
sudo mkdir -p efiboot/EFI/BOOT
sudo unzip refind-bin-0.14.2.zip refind-bin-0.14.2/refind/refind_x64.efi
sudo cp refind-bin-0.14.2/refind/refind_x64.efi ./efiboot/EFI/BOOT/BOOTX64.EFI
sudo rm -rf refind-bin-0.14.2
echo -e 'timeout 0\ntextonly\ntextmode 0\nshowtools shutdown, reboot, exit\nmenuentry "Install RouterOS" {\n\tloader /linux.x86_64\n\toptions "load_ramdisk=1 root=/dev/ram0 -install -cdrom debug"\n}\ndefault_selection /EFI/BOOT/BOOTX64.EFI' \
> refind.conf
sudo cp refind.conf ./efiboot/EFI/BOOT/
sudo rm refind.conf
sudo -E python3 patch.py kernel ./new_iso/isolinux/linux
sudo cp ./new_iso/isolinux/linux ./efiboot/linux.x86_64
sudo cp ./new_iso/isolinux/linux ./linux.x86_64
sudo umount ./efiboot
sudo cp -f efiboot.img ./new_iso/efiboot.img
sudo mkisofs -o mikrotik-$LATEST_VERSION$ARCH.iso \
-V "MikroTik $LATEST_VERSION ${{ matrix.arch }}" \
-sysid "" -preparer "MiKroTiK" \
@@ -284,6 +365,7 @@ jobs:
-R -J \
./new_iso
elif [ "${{ matrix.arch }}" == "arm64" ]; then
sudo mount -o loop ./new_iso/efiboot.img ./efiboot
sudo -E python3 patch.py kernel ./efiboot/EFI/BOOT/BOOTAA64.EFI
sudo umount ./efiboot
sudo xorriso -as mkisofs -o mikrotik-$LATEST_VERSION$ARCH.iso \
@@ -307,7 +389,7 @@ jobs:
- name: Cache chr-${{ env.LATEST_VERSION }}${{ env.ARCH }}.img.zip
if: steps.get_latest.outputs.has_new_version == 'true' && (matrix.arch == 'x86' || matrix.arch == 'arm64')
id: cache-chr-img
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
chr.img
@@ -414,7 +496,7 @@ jobs:
</VirtualHardwareSection>
<AnnotationSection ovf:required="false">
<Info>A human-readable annotation</Info>
<Annotation>MikroTik RouterOS CHR v7.19.4</Annotation>
<Annotation>MikroTik RouterOS CHR</Annotation>
</AnnotationSection>
</VirtualSystem>
</Envelope>'
@@ -563,7 +645,7 @@ jobs:
- name: Cache all_packages${{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch != 'x86' && matrix.arch != 'arm64'
id: cache-all-packages
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: all_packages.zip
key: all_packages${{ env.ARCH }}-${{ env.LATEST_VERSION }}.zip
@@ -577,7 +659,7 @@ jobs:
- name: Cache Main package routeros-${{ env.LATEST_VERSION }}${{ env.ARCH }}.npk
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch != 'x86' && matrix.arch != 'arm64'
id: cache-main-package
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: routeros.npk
key: routeros-${{ env.LATEST_VERSION }}${{ env.ARCH }}.npk
@@ -605,19 +687,6 @@ jobs:
sudo zip ../all_packages-${{ matrix.arch }}-$LATEST_VERSION.zip *.npk
cd ..
- name: Cache refind
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && env.RELEASE == 'true'
id: cache-refind
uses: actions/cache@v4
with:
path: refind-bin-0.14.2.zip
key: refind
restore-keys: refind
- name: Get refind
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && steps.cache-refind.outputs.cache-hit != 'true' && env.RELEASE == 'true'
run: sudo wget -nv -O refind-bin-0.14.2.zip https://nchc.dl.sourceforge.net/project/refind/0.14.2/refind-bin-0.14.2.zip
- name: Create install-image-${{ env.LATEST_VERSION }}${{ env.ARCH }}.img
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && env.RELEASE == 'true'
run: |
@@ -641,7 +710,7 @@ jobs:
> syslinux.cfg
sudo cp syslinux.cfg ./install/
sudo rm syslinux.cfg
sudo cp ./BOOTX64.EFI ./install/linux
sudo cp ./linux.x86_64 ./install/linux
NPK_FILES=($(find ./all_packages/*.npk))
for ((i=1; i<=${#NPK_FILES[@]}; i++))
do
@@ -660,7 +729,7 @@ jobs:
- name: Cache NetInstall ${{ env.LATEST_VERSION }}${{ env.ARCH }}
if: steps.get_latest.outputs.has_new_version == 'true' && matrix.arch == 'x86' && env.RELEASE == 'true'
id: cache-netinstall
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
netinstall.zip
@@ -680,9 +749,9 @@ jobs:
sudo unzip netinstall.zip
sudo -E python3 patch.py netinstall netinstall.exe
sudo zip netinstall-$LATEST_VERSION.zip ./netinstall.exe
sudo tar -xvf netinstall.tar.gz
sudo -E python3 patch.py netinstall netinstall-cli
sudo tar -czvf netinstall-$LATEST_VERSION.tar.gz ./netinstall-cli
# sudo tar -xvf netinstall.tar.gz
# sudo -E python3 patch.py netinstall netinstall-cli
# sudo tar -czvf netinstall-$LATEST_VERSION.tar.gz ./netinstall-cli
- name: Prepare for Upload
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
@@ -699,6 +768,20 @@ jobs:
- name: Upload Files
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
run: |
sudo apt-get install -y knockd lftp > /dev/null
knock -4 ${{ secrets.SSH_SERVER }} ${{ secrets.SSH_KNOCK_PORT }}
echo "Knocking on server..."
for i in 1 2 3; do
if knock -4 ${{ secrets.SSH_SERVER }} ${{ secrets.SSH_KNOCK_PORT }} ; then
echo "Knock successful"
break
else
echo "Knock attempt $i failed, retrying..."
sleep 2
fi
done
echo "Waiting for firewall to open SSH port..."
sleep 3
sudo chown -R root:root ./publish/
LOCAL_PATH=./publish/$LATEST_VERSION
REMOTE_PATH=${{ secrets.SSH_DIRECTORY }}
@@ -763,7 +846,7 @@ jobs:
- name: Create Release tag ${{ env.LATEST_VERSION }} ${{ env.ARCH }}
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'true'
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
name: "RouterOS ${{ env.LATEST_VERSION }} ${{ env.ARCH }}"
body_path: "CHANGELOG"
@@ -780,7 +863,7 @@ jobs:
- name: Upload Files as Artifact (No Release)
if: steps.get_latest.outputs.has_new_version == 'true' && env.RELEASE == 'false'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: mikrotik-${{ env.LATEST_VERSION }}${{ env.ARCH }}
path: |

View File

@@ -2,16 +2,15 @@
[![Patch Mikrotik RouterOS 7.x](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml)
### 感谢赞助
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)
[![DigitalOcean Referral Badge](https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%201.svg)](https://www.digitalocean.com/?refcode=dbf6ed365068&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)
### 感谢捐赠
ETH/BSC/MATIC(USDT)0x7d5ade1bb74f170411ba4a9a6e8752d7b431b455
**重要提示:** 仅用于**测试目的**。使用风险自负。生产环境请使用官方授权版本。
TRX(USDT): TJ1Spmytu9CFhDg4QSo3cmWSrBKjNXuUYP
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/O4O31LX7D0)
捐赠后请将交易号或链接通过tg或email发给我记录。
继续操作即表示您确认:
- 您已阅读并理解所涉及的法律风险和影响
- 这些工具将仅在非生产测试环境中使用
- 生产部署将使用官方授权软件
# MikroTik RouterOS Patch [[English](README_EN.md)]
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](./LICENSE)
@@ -69,8 +68,12 @@ graph TD
对npk文件进行解包修改创建签名和验证
### patch.py
替换公钥并签名
### 如何在不物理重启的情况下启用容器模式
1. 安装 option.npk 包。
2. 打开终端并执行:`system/device-mode/update container=yes`
3. 打开一个新终端并执行: `system/shell cmd="reboot -f"`
## 所有的修补操作都自动运行在[Github Action](https://github.com/elseif/MikroTikPatch/blob/main/.github/workflows/)。
[![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")

View File

@@ -1,5 +1,13 @@
[![Patch Mikrotik RouterOS 6.x](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_6.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_6.yml)
[![Patch Mikrotik RouterOS 7.x](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/mikrotik_patch_7.yml)
**IMPORTANT:** For **testing purposes only**. Use at your own risk. Production environments require official licenses.
By proceeding, you acknowledge that:
- You have reviewed and comprehend the legal implications and risks involved
- These tools will be used exclusively in non-production, test environments
- Production deployments shall utilize officially licensed software
# MikroTik RouterOS Patch [[中文](README.md)]
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](./LICENSE)
[![CoC:WTFCoC](https://img.shields.io/badge/CoC-WTFCoC-brightgreen.svg)](./CODE_OF_CONDUCT.md)
@@ -41,9 +49,10 @@
SignVerifyCreate, Extract npk file.
### patch.py
Patch public key and sign NPK files
## Thanks for sponsoring
[ZMTO](https://console.zmto.com/)
### How to Enable Container Mode Without Physical Reboot
1. Install the option.npk package.
2. Open a terminal and run: `system/device-mode/update container=yes`
3. Open a new terminal and run: `system/shell cmd="reboot -f"`
## all patches are applied automatically with [Github Action](https://github.com/elseif/MikroTikPatch/blob/main/.github/workflows/).

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -274,6 +274,14 @@
<span class="iconify text-xl transition-transform duration-300 group-hover:rotate-12" data-icon="ph:github-logo-bold"></span>
<span class="font-semibold text-sm">GitHub</span>
</a>
<!-- Telegram Keyget Bot link -->
<a href="https://t.me/ROS_Keygen_Bot" target="_blank"
class="group flex items-center gap-3 px-6 py-3 rounded-xl bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white shadow-md hover:shadow-lg transition-all duration-300 hover:scale-105">
<span class="iconify text-xl transition-transform duration-300 group-hover:rotate-12" data-icon="ph:telegram-logo-bold"></span>
<span class="font-semibold text-sm">Keygen Bot</span>
</a>
</div>
</div>
</footer>
@@ -468,10 +476,10 @@
// Fetch latest version numbers from MikroTik servers
const loadingOverlay = document.getElementById("loading");
const [routeros7_stable, routeros7_testing, routeros6_longterm, routeros6_stable] = await Promise.all([
fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWESTa7.stable", "7.19.4"),
fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWESTa7.testing", "7.20rc1"),
fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWEST6.long-term", "6.49.18"),
fetch_latest_versions("https://upgrade.mikrotik.ltd/routeros/NEWEST6.stable", "6.49.19"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWESTa7.stable?ts=${Date.now()}`, "7.19.4"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWESTa7.testing?ts=${Date.now()}`, "7.20rc1"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWEST6.long-term?ts=${Date.now()}`, "6.49.18"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWEST6.stable?ts=${Date.now()}`, "6.49.19"),
]);
// Hide loading overlay and remove loading class
loadingOverlay.style.display = "none";

Binary file not shown.

105
patch.py
View File

@@ -321,46 +321,79 @@ def patch_loader(loader_file):
print("loader module import failed. cannot run patch_loader.py")
def patch_squashfs(path,key_dict):
url_replacements = {
os.environ.get('MIKRO_LICENCE_URL', '').encode(): os.environ.get('CUSTOM_LICENCE_URL', '').encode(),
os.environ.get('MIKRO_UPGRADE_URL', '').encode(): os.environ.get('CUSTOM_UPGRADE_URL', '').encode(),
os.environ.get('MIKRO_CLOUD_URL', '').encode(): os.environ.get('CUSTOM_CLOUD_URL', '').encode(),
os.environ.get('MIKRO_CLOUD_PUBLIC_KEY', '').encode(): os.environ.get('CUSTOM_CLOUD_PUBLIC_KEY', '').encode(),
}
url_replacements = {k: v for k, v in url_replacements.items() if k and v}
renew_replacements = {
os.environ.get('MIKRO_RENEW_URL', '').encode(): os.environ.get('CUSTOM_RENEW_URL', '').encode(),
}
renew_replacements = {k: v for k, v in renew_replacements.items() if k and v}
for root, dirs, files in os.walk(path):
for _file in files:
file = os.path.join(root,_file)
if os.path.isfile(file):
if _file =='loader':
patch_loader(file)
continue
if _file =='BOOTX64.EFI':
print(f'patch {file} ...')
data = open(file,'rb').read()
data = patch_kernel(data,key_dict)
open(file,'wb').write(data)
continue
data = open(file,'rb').read()
if 'mode' in files and 'keyman' in files:
for file_path in [os.path.join(root, 'mode'),os.path.join(root, 'keyman')]:
with open(file_path, 'rb') as f:
data = f.read()
modified = False
for old_public_key,new_public_key in key_dict.items():
_data = replace_key(old_public_key,new_public_key,data,file)
if _data != data:
open(file,'wb').write(_data)
url_dict = {
os.environ['MIKRO_LICENCE_URL'].encode():os.environ['CUSTOM_LICENCE_URL'].encode(),
os.environ['MIKRO_UPGRADE_URL'].encode():os.environ['CUSTOM_UPGRADE_URL'].encode(),
os.environ['MIKRO_CLOUD_URL'].encode():os.environ['CUSTOM_CLOUD_URL'].encode(),
os.environ['MIKRO_CLOUD_PUBLIC_KEY'].encode():os.environ['CUSTOM_CLOUD_PUBLIC_KEY'].encode(),
}
data = open(file,'rb').read()
for old_url,new_url in url_dict.items():
new_data = replace_key(old_public_key,new_public_key,data,file_path)
if new_data != data:
data = new_data
modified = True
assert modified, f'{file_path} key not patched'
with open(f'{file_path}_', 'wb') as f:
f.write(data)
if 'loader' in files and os.path.isfile(os.path.join(root, 'loader')):
loader_file = os.path.join(root, 'loader')
patch_loader(loader_file)
if 'BOOTX64.EFI' in files and os.path.isfile(os.path.join(root, 'BOOTX64.EFI')):
efi_file = os.path.join(root, 'BOOTX64.EFI')
with open(efi_file, 'rb') as f:
data = f.read()
new_data = patch_kernel(data,key_dict)
assert new_data != data, f'{file_path} key not patched'
with open(efi_file, 'wb') as f:
f.write(new_data)
for filename in files:
if filename in ['mode','keyman','loader','BOOTX64.EFI']:
continue
file_path = os.path.join(root,filename)
if not os.path.isfile(file_path):
continue
modified = False
with open(file_path, 'rb') as f:
data = f.read()
for old_public_key,new_public_key in key_dict.items():
new_data = replace_key(old_public_key,new_public_key,data,file_path)
if new_data != data:
data = new_data
modified = True
for old_url,new_url in url_replacements.items():
if old_url in data:
print(f'{file_path} url patched {old_url.decode()[:7]}...')
data = data.replace(old_url,new_url)
modified = True
if filename == 'licupgr':
for old_url,new_url in renew_replacements.items():
if old_url in data:
print(f'{file} url patched {old_url.decode()[:7]}...')
print(f'{file_path} url patched {old_url.decode()[:7]}...')
data = data.replace(old_url,new_url)
open(file,'wb').write(data)
if os.path.split(file)[1] == 'licupgr':
url_dict = {
os.environ['MIKRO_RENEW_URL'].encode():os.environ['CUSTOM_RENEW_URL'].encode(),
}
for old_url,new_url in url_dict.items():
if old_url in data:
print(f'{file} url patched {old_url.decode()[:7]}...')
data = data.replace(old_url,new_url)
open(file,'wb').write(data)
modified = True
if modified:
with open(file_path, 'wb') as f:
f.write(data)
def run_shell_command(command):
process = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)