AJiaJiShu commited on
Commit
4e45039
·
verified ·
1 Parent(s): e4e7d23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -20
app.py CHANGED
@@ -40,8 +40,8 @@ def r(e, t):
40
  m = 3 % y["row"]
41
  v = 7 % y["column"]
42
  w = y["matrix"][m][v]
43
- b = i(f) + o(w)
44
- x = i(w) - o(f)
45
  return [s(a(i(f), o(f))), s(a(i(g), o(g))), s(a(i(w), o(w))), s(a(b, x))]
46
 
47
 
@@ -88,7 +88,7 @@ def get_hash(str):
88
  return hashlib.md5(str.encode()).hexdigest()
89
 
90
 
91
- def get_change_ip():
92
  m = random.randint(0, 255)
93
  n = random.randint(0, 255)
94
  x = random.randint(0, 255)
@@ -98,7 +98,7 @@ def get_change_ip():
98
 
99
 
100
  # 创建随机UA
101
- def get_user_agent():
102
  tmp1 = random.randrange(90, 120)
103
  tmp2 = random.randrange(5200, 5500)
104
  tmp3 = random.randrange(90, 180)
@@ -118,7 +118,7 @@ basicRequestHeaders_1 = {
118
  "content-type": "application/json"
119
  }
120
 
121
- def get_image_d(pid, device_id, f, change_ip):
122
  url = "https://pik-d.bilivo.top/"
123
  payload = {
124
  "pid": pid,
@@ -136,7 +136,7 @@ def get_image_d(pid, device_id, f, change_ip):
136
 
137
 
138
  # 安全验证-登录
139
- def init(client_id, device_id, User_Agent, mail, change_ip):
140
  url = f"https://user.mypikpak.net/v1/shield/captcha/init"
141
  payload = {
142
  "action": "POST:/v1/auth/signin",
@@ -158,7 +158,7 @@ def init(client_id, device_id, User_Agent, mail, change_ip):
158
  return json.loads(response.text)
159
 
160
 
161
- def get_image(xid, change_ip):
162
  url = "http://user.mypikpak.com/pzzl/gen"
163
  header = {'X-Forwarded-For': str(change_ip)}
164
  params = {
@@ -176,7 +176,7 @@ def get_image(xid, change_ip):
176
  json_data = img_jj(frames, int(SELECT_ID), pid)
177
  f = json_data['f']
178
  npac = json_data['ca']
179
- d = get_image_d(pid, xid, f, change_ip)
180
  params = {
181
  'pid': pid,
182
  'deviceid': xid,
@@ -194,7 +194,7 @@ def get_image(xid, change_ip):
194
  return result
195
 
196
 
197
- def sign_in(device_id, username, password, client_id, captcha_token, change_ip):
198
  url = "https://user.pikpak.me/v1/auth/signin"
199
 
200
  headers = {
@@ -454,7 +454,7 @@ def corp_image(img):
454
  new_img = img[row_top:raw_down + 1, col_top:col_down + 1, 0:3]
455
  return new_img
456
 
457
- def get_new_token(result, xid, captcha, change_ip):
458
  traceid = result['traceid']
459
  pid = result['pid']
460
  header = {'X-Forwarded-For': str(change_ip)}
@@ -468,7 +468,6 @@ def get_new_token(result, xid, captcha, change_ip):
468
  # ---------------滑块验证---------------
469
  app = Quart(__name__)
470
 
471
-
472
  @app.route('/', methods=['GET'])
473
  @route_cors(allow_origin='*')
474
  async def home():
@@ -480,25 +479,25 @@ async def home():
480
  @app.route('/login', methods=['POST'])
481
  @route_cors(allow_origin='*')
482
  async def login():
483
- data = request.get_json()
484
  if not data:
485
  return jsonify({"error": "没有指定参数"}), 400
486
  email = data.get('userName')
487
  password = data.get('passWord')
488
  try:
489
- change_ip = get_change_ip()
490
  client_id1 = "YNxT9w7GMdWvEOKa"
491
  device_id = str(uuid.uuid4()).replace("-", "")
492
- user_agent = get_user_agent()
493
- action_init = init(client_id1, device_id, user_agent, email, change_ip)
494
  captcha_token = action_init["captcha_token"]
495
  while True:
496
- img_info = get_image(device_id, change_ip)
497
  if img_info['response_data']['result'] == 'accept':
498
  print('验证通过!!!')
499
  break
500
- token_data = get_new_token(img_info, device_id, captcha_token, change_ip)
501
- login_data = sign_in(device_id, email, password, client_id1, token_data['captcha_token'], change_ip)
502
  return jsonify({"code": 200, "data": login_data, "msg": 'success'}), 200
503
  except Exception as e:
504
  print(e)
@@ -512,5 +511,3 @@ config.bind = ["0.0.0.0:8090"]
512
  if __name__ == '__main__':
513
  import asyncio
514
  asyncio.run(serve(app, config))
515
-
516
-
 
40
  m = 3 % y["row"]
41
  v = 7 % y["column"]
42
  w = y["matrix"][m][v]
43
+ b = i(f) + o(w)
44
+ x = i(w) - o(f)
45
  return [s(a(i(f), o(f))), s(a(i(g), o(g))), s(a(i(w), o(w))), s(a(b, x))]
46
 
47
 
 
88
  return hashlib.md5(str.encode()).hexdigest()
89
 
90
 
91
+ async def get_change_ip():
92
  m = random.randint(0, 255)
93
  n = random.randint(0, 255)
94
  x = random.randint(0, 255)
 
98
 
99
 
100
  # 创建随机UA
101
+ async def get_user_agent():
102
  tmp1 = random.randrange(90, 120)
103
  tmp2 = random.randrange(5200, 5500)
104
  tmp3 = random.randrange(90, 180)
 
118
  "content-type": "application/json"
119
  }
120
 
121
+ async def get_image_d(pid, device_id, f, change_ip):
122
  url = "https://pik-d.bilivo.top/"
123
  payload = {
124
  "pid": pid,
 
136
 
137
 
138
  # 安全验证-登录
139
+ async def init(client_id, device_id, User_Agent, mail, change_ip):
140
  url = f"https://user.mypikpak.net/v1/shield/captcha/init"
141
  payload = {
142
  "action": "POST:/v1/auth/signin",
 
158
  return json.loads(response.text)
159
 
160
 
161
+ async def get_image(xid, change_ip):
162
  url = "http://user.mypikpak.com/pzzl/gen"
163
  header = {'X-Forwarded-For': str(change_ip)}
164
  params = {
 
176
  json_data = img_jj(frames, int(SELECT_ID), pid)
177
  f = json_data['f']
178
  npac = json_data['ca']
179
+ d = await get_image_d(pid, xid, f, change_ip)
180
  params = {
181
  'pid': pid,
182
  'deviceid': xid,
 
194
  return result
195
 
196
 
197
+ async def sign_in(device_id, username, password, client_id, captcha_token, change_ip):
198
  url = "https://user.pikpak.me/v1/auth/signin"
199
 
200
  headers = {
 
454
  new_img = img[row_top:raw_down + 1, col_top:col_down + 1, 0:3]
455
  return new_img
456
 
457
+ async def get_new_token(result, xid, captcha, change_ip):
458
  traceid = result['traceid']
459
  pid = result['pid']
460
  header = {'X-Forwarded-For': str(change_ip)}
 
468
  # ---------------滑块验证---------------
469
  app = Quart(__name__)
470
 
 
471
  @app.route('/', methods=['GET'])
472
  @route_cors(allow_origin='*')
473
  async def home():
 
479
  @app.route('/login', methods=['POST'])
480
  @route_cors(allow_origin='*')
481
  async def login():
482
+ data = await request.get_json()
483
  if not data:
484
  return jsonify({"error": "没有指定参数"}), 400
485
  email = data.get('userName')
486
  password = data.get('passWord')
487
  try:
488
+ change_ip = await get_change_ip()
489
  client_id1 = "YNxT9w7GMdWvEOKa"
490
  device_id = str(uuid.uuid4()).replace("-", "")
491
+ user_agent = await get_user_agent()
492
+ action_init = await init(client_id1, device_id, user_agent, email, change_ip)
493
  captcha_token = action_init["captcha_token"]
494
  while True:
495
+ img_info = await get_image(device_id, change_ip)
496
  if img_info['response_data']['result'] == 'accept':
497
  print('验证通过!!!')
498
  break
499
+ token_data = await get_new_token(img_info, device_id, captcha_token, change_ip)
500
+ login_data = await sign_in(device_id, email, password, client_id1, token_data['captcha_token'], change_ip)
501
  return jsonify({"code": 200, "data": login_data, "msg": 'success'}), 200
502
  except Exception as e:
503
  print(e)
 
511
  if __name__ == '__main__':
512
  import asyncio
513
  asyncio.run(serve(app, config))