#!/usr/bin/env python3 from pathlib import Path from mk_nko_wg_exec import connect_mk, run DUMP = r""" :put "===IDENTITY===" /system identity print :put "===HS===" /ip hotspot print detail :put "===HSPROF===" /ip hotspot profile print detail :put "===WGARDEN===" /ip hotspot walled-garden print :put "===WGARDEN-IP===" /ip hotspot walled-garden ip print :put "===DNS===" /ip dns print :put "===DNS-STATIC===" /ip dns static print :put "===WWW===" /ip service print where name=www :put "===FILES===" /file print where name~"hotspot" """ text = run(DUMP, timeout=90) Path("_tmp_nko_hs_dump.txt").write_text(text, encoding="utf-8") print(text) jump, mk = connect_mk() sftp = mk.open_sftp() with sftp.file("hotspot/login.html", "r") as f: body = f.read() sftp.close() mk.close() jump.close() if isinstance(body, bytes): body = body.decode("utf-8", "replace") Path("_tmp_nko_login_now.html").write_text(body, encoding="utf-8") print("login.html", len(body)) for needle in [ "wo.css", "woHotspotLite", "ui/ui_custom", "portal.otantik", "83.147", "wifi.otantik", "styles/bootstrap", "slide-1.jpg", "http://", "https://", ]: print(" ", needle, needle in body)