mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-17 18:49:41 +00:00
modified: .github/workflows/mikrotik_patch.yml
modified: .gitignore modified: patch.py
This commit is contained in:
parent
cf95a2441f
commit
0b76f2feed
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
venv/
|
venv/
|
||||||
patch_*.py
|
test_*.py
|
||||||
7
patch.py
7
patch.py
@ -81,6 +81,12 @@ def patch_bootloader(key_dict,boot_dev):
|
|||||||
f.flush()
|
f.flush()
|
||||||
print(']')
|
print(']')
|
||||||
|
|
||||||
|
stdout,stderr = run_shell_command(f"lsblk -no pkname {boot_dev}")
|
||||||
|
with open(f'/dev/{stdout.decode()}','wb') as f:
|
||||||
|
f.seek(0x150)
|
||||||
|
f.write(b'\x00')
|
||||||
|
f.flush()
|
||||||
|
|
||||||
def patch_squashfs(path,key_dict):
|
def patch_squashfs(path,key_dict):
|
||||||
for root, dirs, files in os.walk(path):
|
for root, dirs, files in os.walk(path):
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -126,7 +132,6 @@ def patch_npk_file(key_dict,kcdsa_private_key,eddsa_private_key,input_file,outpu
|
|||||||
run_shell_command(f"rm -rf {extract_dir}")
|
run_shell_command(f"rm -rf {extract_dir}")
|
||||||
npk[NpkPartID.SQUASHFS].data = open(squashfs_file,'rb').read()
|
npk[NpkPartID.SQUASHFS].data = open(squashfs_file,'rb').read()
|
||||||
run_shell_command(f"rm -f {squashfs_file}")
|
run_shell_command(f"rm -f {squashfs_file}")
|
||||||
|
|
||||||
npk.sign(kcdsa_private_key,eddsa_private_key)
|
npk.sign(kcdsa_private_key,eddsa_private_key)
|
||||||
npk.save(output_file or input_file)
|
npk.save(output_file or input_file)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user