modified: README.md

modified:   patch.py
	modified:   upgrade.py
This commit is contained in:
zyb 2024-06-18 14:33:54 +08:00
parent 3ed9c6f9e0
commit 1861785032
3 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@
![](install.png)
![](routeros.png)
### Uses keygen to generate license key (keygen.exe in iso).
### Uses keygen to generate license key (keygen in iso or img).
![](keygen.png)
### all patches are applied automatically with [github workflow](https://github.com/elseif/MikroTikPatch/blob/main/.github/workflows/mikrotik_patch.yml).

View File

@ -98,7 +98,6 @@ def patch_system_npk(key_dict,input_file,output_file=None):
npk.save(output_file or input_file)
if __name__ == '__main__':
import argparse,os
parser = argparse.ArgumentParser(description='MikroTik patcher')
subparsers = parser.add_subparsers(dest="command")

View File

@ -1,6 +1,7 @@
from mitmproxy import http
import os
class MwrAddon:
class UpgradeAddon:
def request(self,flow: http.HTTPFlow) -> None:
if len(flow.request.path_components)==3 and flow.request.path_components[0] == 'routeros':
version = flow.request.path_components[1]
@ -26,7 +27,7 @@ class MwrAddon:
)
else:
flow.response = http.Response.make(status_code=404)
addons = [MwrAddon()]
async def start_listen(port):
from mitmproxy.tools.dump import DumpMaster
from mitmproxy import options
@ -34,7 +35,7 @@ async def start_listen(port):
print(f'listening at *:{port}')
print(f'open http://127.0.0.1:{port}')
master = DumpMaster(opts)
master.addons.add(*addons)
master.addons.add([UpgradeAddon()])
try:
await master.run()
except KeyboardInterrupt: