import requests,json,time,urllib3,sys
from crypto_hall import enc,dec,k1,k2
urllib3.disable_warnings()
H='ein38eu95792b.4656hd15.cc'
UA='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36'
def call(path,params,key,method='GET',data=None):
    p=dict(params); p['encryptString']=enc(params,key)
    h={'User-Agent':UA,'content-type':'text/plain','x-data-mode':'chipher','siteCode':'1003','currency':'CNY','language':'zh-CN','timestamp':str(int(time.time()*1000)),'device':'00000000-0000-0000-0000-000000000000','domain':H,'platformType':'1'}
    r=requests.request(method,f'https://{H}/hall{path}',params=p,headers=h,timeout=15,verify=False,data=data)
    return r
cands={'k1_empty':k1(''),'k1_undefined':k1('undefined'),'k2_empty':k2(''),'k2_undefined':k2('undefined'),'Bl':'thanks,pig4cloud','Nf':'tgJt2ol!^E)E8(%P','xf':'fc361cdb770aebc2126cc0dac989c896'}
base={'siteCode':1003,'currency':'CNY','language':'zh-CN','platformType':1}
for name,key in cands.items():
    try:
        r=call('/api/gohal/getClientConfig',base,key)
        body=r.text[:300]
        dec_ok=''
        if body and all(c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' for c in body.strip()):
            try: dec_ok=dec(body.strip(),key)[:200].decode('utf-8','replace')
            except Exception as e: dec_ok='DECERR'
        print(f'{name:14} {key:20} HTTP{r.status_code} ct={r.headers.get("content-type")} len={len(r.content)}')
        print('   raw:',body.replace('\n',' '))
        if dec_ok: print('   dec:',dec_ok)
    except Exception as e:
        print(name,'ERR',e)
