Skip to content

Instantly share code, notes, and snippets.

@P-PPPP
Created October 13, 2022 09:22
Show Gist options
  • Select an option

  • Save P-PPPP/65b445c41783769469dff298afd1f0ef to your computer and use it in GitHub Desktop.

Select an option

Save P-PPPP/65b445c41783769469dff298afd1f0ef to your computer and use it in GitHub Desktop.
Srun V1 Login
import os , requests
Host = "http://xxx.xxx.xxx.xxx"
Headers={
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0",
"Referer":f"{Host}/srun_portal_pc?ac_id=1&theme=basic&srun_domain="
}
def detect_ip()->str:
r = requests.get(f"{Host}",headers=Headers).text
return r.split('name="user_ip"')[1].split('">')[0].split('value="')[-1]
def Loginin(usr:str,pasw:str)->str:
c = requests.get(f"{Host}/v1/haut",
params={
"username":usr,
"password":pasw,
"ac_id":"1",
"user_ip":detect_ip()
},headers=Headers
).json()
print(c)
assert c["Code"] == 0 , "Login error"
return c
a = Loginin(usr="2019xxxxxx",pasw="xxxxxx")
print(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment