import urllib.request, ssl
XFF="54.255.42.219"; B="http://phadmin.msjshy.com"
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
def get(path, data=None, method=None):
    h={"X-Forwarded-For":XFF,"User-Agent":"Mozilla/5.0"}
    req=urllib.request.Request(B+path, headers=h, method=method)
    if data is not None: req.data=data.encode()
    try:
        r=urllib.request.urlopen(req, timeout=12, context=ctx); return r.status, r.read(), dict(r.headers)
    except urllib.error.HTTPError as e: return e.code, e.read(), dict(e.headers)
    except Exception as e: return -1, str(e).encode(), {}

# JS files for version hints
for p in ["/static/js/admin.js?v=1.1.1","/static/js/wind.js?v=1.1.1","/static/js/crypto.min.js?v=1.1.1","/static/js/config.js","/static/js/main.js"]:
    st,body,h=get(p)
    print(f"[{st} len={len(body)}] {p}")
    if st==200:
        txt=body.decode('utf-8','ignore')
        # look for version strings
        import re
        for kw in ["version","think","cmf","xiao9","5.0","5.1","5.2","v1.","v2.","v5."]:
            if kw.lower() in txt.lower():
                for m in re.finditer(re.escape(kw), txt, re.I):
                    pass
        print("    head:", txt[:200].replace('\n',' ')[:200])
print()
# trigger errors: wrong method, malformed
print("=== GET doLogin (no post) ===")
st,body,h=get("/admin/public/doLogin")
print(f"[{st}] {body.decode('utf-8','ignore')[:200]!r}")
print("=== POST login page path ===")
st,body,h=get("/admin/Public/login", data="a=b")
print(f"[{st}] {body.decode('utf-8','ignore')[:200]!r}")
# probe for framework path disclosure via missing action
for p in ["/admin/Public/xxxxxx","/admin/public/xxxxxx","/xxx/yyy/zzz","/admin/public/doLogin2"]:
    st,body,h=get(p)
    print(f"[{st} len={len(body)}] {p} -> {body.decode('utf-8','ignore')[:80]!r}")
