Commit 8e091c74 authored by wang's avatar wang

11

parent 1335ec20
from pprint import pprint
import base64
import ctypes
import json
......@@ -7,8 +6,6 @@ import time
from urllib.parse import quote
import execjs
import requests
import tls_client
from loguru import logger
......@@ -64,6 +61,7 @@ class PxBypass():
}
tag = "v8.7.2"
ft = "317"
def __init__(self, target_url):
self.target_url = target_url
......@@ -72,7 +70,8 @@ class PxBypass():
def inc(self):
self.seq += 1
self.rsc += 1
self.log.info(f'seq: {self.seq} rsc:{self.rsc}' )
self.log.info(f'seq: {self.seq} rsc:{self.rsc}')
def run(self):
self._init()
self.seq = 0
......@@ -120,7 +119,7 @@ class PxBypass():
for k, v in self.session.cookies.items():
self.params[k] = v
self.log.info(f"init cookie {self.params}")
with open('index.html','w') as f:
with open('index.html', 'w') as f:
f.write(res.text)
def __uuid(self):
......@@ -184,6 +183,7 @@ class PxBypass():
t2 = t1 + random.randint(3, 12)
self.startTs = t1
self.startTs2 = t2
_uuid = self.__uuid()
self.uuid = _uuid
# "[{"t":"PX12095","d":{"PX11645":"https://www.flyfrontier.com/","PX12207":0,"PX12458":"MacIntel","PX11902":0,"PX11560":3781,"PX12248":3600,
......@@ -269,7 +269,6 @@ class PxBypass():
'pxcts': self.cts
})
if 'pxde' in i:
self.session.cookies.update({
'_pxde': tmp[3]
......@@ -297,7 +296,6 @@ class PxBypass():
})
self.log.info(f'cookies1 {self.session.cookies.keys()}')
self.m = m
def encrypt(self, data, param):
n = bytearray()
......@@ -349,10 +347,11 @@ class PxBypass():
f.write(response.text)
def _step_2(self, nn):
self.log.info(self.uuid)
# sid, vid,ts, num1 ,num2,str1, uuid
data_str = ctxStep2.call('genPayload2', self.sid, self.vid, self.ts, self.num1, self.num2, self.str1, self.uuid,self.startTs, nn)
data_str = ctxStep2.call('genPayload2', self.sid, self.vid, self.ts, self.num1, self.num2, self.str1, self.uuid,
self.startTs, self.startTs2, nn)
self.log.info(f'data_str2 {data_str}')
payload = ctx.call('encodePayload', data_str, self.uuid, self.ts)
......@@ -398,7 +397,7 @@ class PxBypass():
resp = response.json()
m = {}
if 'ob' in resp:
cookies = self.encrypt(base64.b64decode(resp['ob'].encode()), self._decode_resp()).decode()
cookies = self.encrypt(base64.b64decode(resp['ob'].encode()), self._decode_resp()).decode()
cks = cookies.split('~~~~')
self.log.info(json.dumps(cks, indent=True))
for i in cks:
......@@ -431,14 +430,13 @@ class PxBypass():
})
self.log.info(f'cookies2 {self.session.cookies.get_dict()}')
# self.m = m
def _decode_resp(self):
a = int(self.tag.replace('v','').replace('.',''))
a = int(self.tag.replace('v', '').replace('.', ''))
return a % 128
def _step_11(self):
data = [{"t":"PX12167","d":{"PX11648":True,"PX11379":False,"PX11645":"https://www.flyfrontier.com/"}}]
data = [{"t": "PX12167", "d": {"PX11648": True, "PX11379": False, "PX11645": "https://www.flyfrontier.com/"}}]
data_str = json.dumps(data, separators=(',', ':'))
self.log.info(f'data_str {data_str}')
payload = ctx.call('encodePayload', data_str, self.uuid, self.ts)
......@@ -512,7 +510,6 @@ class PxBypass():
'pxcts': self.cts
})
if 'pxde' in i:
self.session.cookies.update({
'_pxde': tmp[3]
......@@ -540,7 +537,6 @@ class PxBypass():
})
self.log.info(f'cookies1 {self.session.cookies.keys()}')
self.m = m
def update_sid_vid(self, data: dict):
if self.vid != "":
......@@ -558,7 +554,7 @@ class PxBypass():
return data
def _step_3(self):
self.log.info(self.uuid)
# sid, vid,ts, num1 ,num2,str1, uuid
data_str = ctxStep2.call('genPayload3', self.sid, self.vid, self.ts, self.num1, self.num2, self.str1, self.uuid)
......@@ -642,7 +638,6 @@ class PxBypass():
})
self.log.info(f'cookies2 {self.session.cookies.get_dict()}')
# self.m = m
if __name__ == '__main__':
......
......@@ -4902,7 +4902,7 @@ function createPX12508() {
return ENV.useragentdata.highvalue.brands
}
function genPayload2(sid, vid, ts, num1, num2, str1, uuid,startTs, n) {
function genPayload2(sid, vid, ts, num1, num2, str1, uuid,startTs,startTs2, n) {
// let vid = m['I000I0']
// let sid = m['I0I0II']
console.log(vid, sid)
......@@ -4932,7 +4932,7 @@ function genPayload2(sid, vid, ts, num1, num2, str1, uuid,startTs, n) {
"PX11332": Date.now(),
"PX12248": 3600,
"PX11385": startTs,
"PX12280": Date.now(),
"PX12280": startTs2,
"PX11496": uuid, //uuid
......@@ -5335,7 +5335,7 @@ function genPayload2(sid, vid, ts, num1, num2, str1, uuid,startTs, n) {
"PX12501": md5(vid),
"PX11902": 2,
"PX11560": performanceNow(parseInt(Math.random() * 500 + 500)), // perf
"PX12280": Date.now(),
"PX12280": startTs2,
"PX11496": uuid,
"PX12564": null,
"PX12565": -1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment