mirror of
https://github.com/elseif/MikroTikPatch.git
synced 2026-10-11 13:14:58 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45e9c0a66a | ||
|
|
21be00d396 | ||
|
|
8594be223a | ||
|
|
9b8d2e6f7a |
@@ -96,9 +96,8 @@ cat /ram/startup.catlog | grep 'Hello'
|
||||
|
||||
---
|
||||
## 💖 Sponsors
|
||||
[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
|
||||
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)
|
||||
|
||||
[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
|
||||
[Powered by ZMTO](https://console.zmto.com/?affid=1588)
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -98,8 +98,8 @@ cat /ram/startup.catlog | grep 'Hello'
|
||||
---
|
||||
## 💖 感谢赞助
|
||||
[](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
|
||||
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)
|
||||
|
||||
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067)
|
||||
[ZMTO(aff)](https://console.zmto.com/?affid=1588)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -113,19 +113,13 @@ def patch_bzimage(data:bytes,key_dict:dict):
|
||||
return new_data
|
||||
|
||||
def patch_initrd_xz(initrd_xz:bytes,key_dict:dict,ljust=True):
|
||||
try:
|
||||
initrd = lzma.decompress(initrd_xz)
|
||||
except Exception as e:
|
||||
print(f'size:{len(initrd_xz)},header:{initrd_xz[:20].hex().upper()},footer:{initrd_xz[-20:].hex().upper()}\n')
|
||||
raise Exception(f'failed to decompress initrd_xz: {e}')
|
||||
initrd = lzma.decompress(initrd_xz)
|
||||
new_initrd = initrd
|
||||
for old_public_key,new_public_key in key_dict.items():
|
||||
new_initrd = replace_key(old_public_key,new_public_key,new_initrd,'initrd')
|
||||
|
||||
|
||||
preset = 6
|
||||
while True:
|
||||
new_initrd_xz = lzma.compress(new_initrd,check=lzma.CHECK_CRC32,filters= [{"id": lzma.FILTER_LZMA2,"preset": preset }] )
|
||||
new_initrd_xz = lzma.compress(new_initrd,check=lzma.CHECK_CRC32,filters=[{"id": lzma.FILTER_LZMA2,"preset": preset | lzma.PRESET_EXTREME}])
|
||||
print(f'preset:{preset},initrd xz new size:{len(new_initrd_xz)},old size:{len(initrd_xz)}')
|
||||
preset += 1
|
||||
if len(new_initrd_xz) <= len(initrd_xz) or preset > 9:
|
||||
|
||||
Reference in New Issue
Block a user