mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-17 10:39:40 +00:00
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).
|
### 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)
|
npk.save(output_file or input_file)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
import argparse,os
|
import argparse,os
|
||||||
parser = argparse.ArgumentParser(description='MikroTik patcher')
|
parser = argparse.ArgumentParser(description='MikroTik patcher')
|
||||||
subparsers = parser.add_subparsers(dest="command")
|
subparsers = parser.add_subparsers(dest="command")
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
from mitmproxy import http
|
from mitmproxy import http
|
||||||
import os
|
import os
|
||||||
class MwrAddon:
|
|
||||||
|
class UpgradeAddon:
|
||||||
def request(self,flow: http.HTTPFlow) -> None:
|
def request(self,flow: http.HTTPFlow) -> None:
|
||||||
if len(flow.request.path_components)==3 and flow.request.path_components[0] == 'routeros':
|
if len(flow.request.path_components)==3 and flow.request.path_components[0] == 'routeros':
|
||||||
version = flow.request.path_components[1]
|
version = flow.request.path_components[1]
|
||||||
@ -26,7 +27,7 @@ class MwrAddon:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
flow.response = http.Response.make(status_code=404)
|
flow.response = http.Response.make(status_code=404)
|
||||||
addons = [MwrAddon()]
|
|
||||||
async def start_listen(port):
|
async def start_listen(port):
|
||||||
from mitmproxy.tools.dump import DumpMaster
|
from mitmproxy.tools.dump import DumpMaster
|
||||||
from mitmproxy import options
|
from mitmproxy import options
|
||||||
@ -34,7 +35,7 @@ async def start_listen(port):
|
|||||||
print(f'listening at *:{port}')
|
print(f'listening at *:{port}')
|
||||||
print(f'open http://127.0.0.1:{port}')
|
print(f'open http://127.0.0.1:{port}')
|
||||||
master = DumpMaster(opts)
|
master = DumpMaster(opts)
|
||||||
master.addons.add(*addons)
|
master.addons.add([UpgradeAddon()])
|
||||||
try:
|
try:
|
||||||
await master.run()
|
await master.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user