modified: README.md
modified: patch.py modified: upgrade.py
This commit is contained in:
parent
3ed9c6f9e0
commit
1861785032
@ -5,7 +5,7 @@
|
||||

|
||||

|
||||
|
||||
### Uses keygen to generate license key (keygen.exe in iso).
|
||||
### Uses keygen to generate license key (keygen in iso or img).
|
||||

|
||||
### all patches are applied automatically with [github workflow](https://github.com/elseif/MikroTikPatch/blob/main/.github/workflows/mikrotik_patch.yml).
|
||||
|
||||
|
1
patch.py
1
patch.py
@ -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")
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user