import base64
import ctypes
import hashlib
import hmac
import json
import math
import random
import time
from datetime import datetime


def left_shift(based, counter):
    # a << 5
    val = based << (counter % 32)
    maxint = 2147483647
    if not -maxint - 1 <= val <= maxint:
        val = (val + (maxint + 1)) % (2 * (maxint + 1)) - maxint - 1
    return val


def unsigned_right_shift(n, i):
    """
    js中 >>>
    :param n:
    :param i:
    :return:
    """
    x, y = ctypes.c_uint32(n).value, i % 32
    return ctypes.c_uint32(x >> y).value


def Y0(Z0, h0):
    # a |= b
    return unsigned_right_shift(Z0, h0) | left_shift(Z0, (32 - h0))


def createPx1(t):
    t = '' + str(t)
    e = 0
    n = 0
    for r in range(len(t)):
        # print(n, ord(t[r]))
        n = left_shift(n, 5) - n + ord(t[r])
        n = Y0(n, 0)
        # print(r, n)

    e = n
    e |= 0
    if e < 0:
        e += 4294967296
    return hex(e)[2:]


def encrypt(data, param):
    n = bytearray()
    if isinstance(data, str):
        bytess = data.encode()
    else:
        bytess = data
    for i in bytess:
        n.append(i ^ param)
    return n


def randomInt(param, param1):
    return random.randint(param, param1)


def randomFloat(a, b):
    return random.random() * (b - a) + a


class PxEnv():
    def __init__(self, url, sid, vid, ts, num1, num2, str1, uuid, startTs, startTs2, performanceNow, px11280,
                 px755='', token=''):
        # 11oo1o
        self.token = token
        self.px755 = px755
        self.ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36';

        # 初始化参数
        self.url = url
        self.sid = sid
        self.vid = vid
        self.ts = ts
        self.num1 = num1
        self.num2 = num2
        self.str1 = str1
        self.uuid = uuid
        self.startTs = startTs
        self.startTs2 = startTs2
        self.performanceNow = performanceNow
        self.px11280 = px11280
        totalJSHeapSize = randomInt(35903195, 39903195)
        self.memory_data = dict(
            totalJSHeapSize=totalJSHeapSize,
            usedJSHeapSize=math.floor(randomFloat(0.65, 0.9) * totalJSHeapSize),
            jsHeapSizeLimit=4294705152
        )

    @property
    def memory(self):
        self.memory_data['usedJSHeapSize'] = self.memory_data['usedJSHeapSize'] + randomInt(1903195, 2903195)
        return self.memory_data

    def _to_json(self, data):
        return json.dumps(data, separators=(',', ':'))

    def get_px11590(self):
        px11590_d = {"PX11431": int(self.ts),
                     "PX12454": int(self.num1),
                     "PX11701": self.num2[:80],
                     "PX11529": self.memory_data.get('usedJSHeapSize'),
                     "PX11555": self.memory_data.get('jsHeapSizeLimit'),
                     "PX11833": self.memory_data.get('totalJSHeapSize'),
                     "PX11840": datetime.now().strftime('%a %b %d %Y %H:%M:%S GMT+0800 (中国标准时间)'),
                     "PX12573": self.getPX12573(math.floor(int(self.ts) / 1e3), self.vid, self.uuid),
                     "PX11804": self.createPX2(self.ua, self.uuid),
                     "PX12118": self.str1,
                     "PX11746": self.createPX2(self.ua, self.vid),
                     "PX11371": self.createPX2(self.ua, self.sid),
                     "PX12501": self.md5(self.vid),
                     "PX12169": 1, "PX11902": 1,
                     "PX11560": self.performanceNow + randomInt(1000, 2500),
                     "PX11332": self.startTs + randomInt(1000, 2500),
                     "PX12248": 3600,
                     "PX11385": self.startTs,
                     "PX12280": self.px11280,
                     "PX11496": self.uuid,
                     "PX12330": "109|66|66|70|80",
                     "PX11705": random.choice([571, 1182]),
                     "PX11938": True, "PX11602": True, "PX12021": "False", "PX12421": "False", "PX12124": 1,
                     "PX11609": 1,
                     "PX12291": "", "PX11881": ["app", "csi", "loadTimes"], "PX12207": 0, "PX11538": 2,
                     "PX11984": "TypeError: Cannot read properties of None (reading '0')\n    at he (https://client.px-cloud.net/PXVb73hTEg/main.min.js:1136:13)\n    at Zo (https://client.px-cloud.net/PXVb73hTEg/main.min.js:3320:22)\n    at Eo (https://client.px-cloud.net/PXVb73hTEg/main.min.js:2892:23)\n    at https://client.px-cloud.net/PXVb73hTEg/main.min.js:3265:9",
                     "PX11645": "https://www.flyfrontier.com", "PX11597": [], "PX12023": "", "PX11337": False,
                     "PX12544": True, "PX12589": "succeeded", "PX11524": True,
                     "PX11843": 1920,
                     "PX11781": 1080,
                     "PX12121": 1920,
                     "PX12128": 1055,
                     "PX12387": "1920X1080",
                     "PX12003": 24,
                     "PX11380": 24,
                     "PX11494": 906,
                     "PX12411": 853, "PX12443": 0, "PX12447": 0, "PX11533": True, "PX12079": False, "PX12278": True,
                     "PX11694": False, "PX12294": False, "PX12514": True,
                     "PX12515": "TypeError: Cannot read properties of undefined (reading 'width')", "PX12516": "webkit",
                     "PX12517": 33, "PX12518": False, "PX12545": False, "PX12593": False,
                     "PX12595": "AudioData.SVGAnimatedAngle.SVGMetadataElement",
                     "PX12069": ["Chrome PDF Viewer", "Chromium PDF Viewer", "Microsoft Edge PDF Viewer", "PDF Viewer",
                                 "WebKit built-in PDF"], "PX12286": 5, "PX11576": True, "PX12318": True,
                     "PX11384": True,
                     "PX11886": True, "PX11583": "en-US", "PX12458": "MacIntel", "PX11681": ["en-US"],
                     "PX11754": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
                     "PX12037": True, "PX11390": -480, "PX11621": 8, "PX11657": 1, "PX12081": "Gecko",
                     "PX11908": "20030107",
                     "PX12314": "5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
                     "PX11829": True, "PX11464": True, "PX12054": 2, "PX11821": "Netscape", "PX11479": "Mozilla",
                     "PX11674": True, "PX12241": 400, "PX11372": False, "PX11683": 1.5, "PX11561": "3g",
                     "PX11877": True,
                     "PX12100": True, "PX12506": "arm", "PX12507": "64", "PX12509": False, "PX12510": "",
                     "PX12511": "macOS",
                     "PX12512": "13.5.0", "PX12513": "117.0.5938.149", "PX12548": True, "PX12578": {},
                     "PX12579": {"support": True,
                                 "status": {"effectiveType": "3g", "rtt": 400, "downlink": 1.5, "saveData": False}},
                     "PX12508": [{"brand": "Google Chrome", "version": "117"}, {"brand": "Not;A=Brand", "version": "8"},
                                 {"brand": "Chromium", "version": "117"}], "PX12549": True, "PX11539": "831efc5e",
                     "PX11528": "", "PX12271": "10207b2f", "PX11849": "10207b2f", "PX12464": "90e65465",
                     "PX11356": True,
                     "PX12426": True, "PX11791": True, "PX11517": True, "PX12520": True,
                     "PX12524": "4YC14YCd4YCd4YCV4YCe4YCX4YGS5J256aus7r266YaI5oCR7r27",
                     "PX12527": "3207084bd110f1ac964863e23aa78e04",
                     "PX12260": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
                     "PX12249": False, "PX11897": "90e65465", "PX12597": 2, "PX11526": False, "PX11684": False,
                     "PX11812": False, "PX12335": True, "PX12080": 0, "PX11678": False, "PX11349": "visible",
                     "PX12397": False, "PX11387": 0, "PX12150": 1920, "PX12304": True, "PX11651": 970,
                     "PX11867": "missing",
                     "PX12254": True, "PX11540": True, "PX11548": False, "PX11446": True, "PX12550": 1, "PX12431": 0,
                     "PX11991": 10, "PX11837": 34, "PX11632": 0, "PX11409": 9, "PX11508": "49e5084e",
                     "PX11452": "7c5f9724",
                     "PX12218": "65d826e0", "PX12481": "a9269e00", "PX11780": "50a5ec55", "PX12551": "https:",
                     "PX12553": "Asia/Shanghai", "PX12567": "w3c", "PX12576": "screen",
                     "PX12554": "function getOwnPropertyDescriptors() { [native code] }",
                     "PX12577": "function query() { [native code] }", "PX12594": False, "PX12566": False,
                     "PX12571": "74d9c66", "PX12581": "default", "PX11303": False, "PX11515": False, "PX12133": False,
                     "PX12340": False, "PX11738": False, "PX11723": False, "PX11389": False, "PX11839": False,
                     "PX11460": False, "PX12102": False, "PX11378": False, "PX12317": False, "PX12564": None,
                     "PX12565": -1,
                     }
        noPx1, noPx2 = self.getNoPx(px11590_d)
        px11590_d[noPx1] = noPx2
        data = {"t": "PX11590",
                "d": px11590_d}
        return data

    def getPX12573(self, a, b, c):
        t = a - 22790 + ord(b[31])
        return createPx1(t)

    def createPX2(self, e, t):
        h = hmac.new(e.encode(), t.encode(), hashlib.md5)
        t = h.hexdigest()
        return t

    def md5(self, vid):
        m = hashlib.md5()
        m.update(vid.encode())
        return m.hexdigest()

    def getNoPx(self, data):
        return encrypt(data['PX11701'], data['PX11431'] % 10 + 2).decode(), encrypt(data['PX11701'],
                                                                                    data['PX11431'] % 10 + 1).decode()

    def get_px12123(self):
        px12123_d = {
            "PX12108": randomInt(401, 601),
            "PX12414": randomInt(15, 61),
            "PX11984": "TypeError: Cannot read properties of null (reading '0')\n    at he (https://client.px-cloud.net/PXVb73hTEg/main.min.js:1136:13)\n    at Zo (https://client.px-cloud.net/PXVb73hTEg/main.min.js:3320:22)\n    at Eo (https://client.px-cloud.net/PXVb73hTEg/main.min.js:2892:23)\n    at https://client.px-cloud.net/PXVb73hTEg/main.min.js:3265:9",
            "PX12303": "mouseover",
            "PX11699": 58848,
            "PX11987": "True",
            "PX12461": True,
            "PX11652": "#wisepops-instance-429858",
            "PX11902": 3,
            "PX11560": self.performanceNow,
            "PX12280": self.px11280,
            "PX11496": self.uuid,
            "PX12564": None,
            "PX12565": -1,
            # "PX11379": False,
            # "PX11645": url
        }
        return {
            "t": "PX12123",
            "d": px12123_d
        }

    def get_px11891(self):
        px11891_d = {
            "PX11913": True,
            "PX11900": 240000,
            "PX12159": 1,
            "PX11754": self.ua,
            "PX12256": 0,
            "PX12445": 0,
            "PX11804": self.createPX2(self.ua, self.uuid),
            "PX11746": self.createPX2(self.ua, self.vid),
            "PX11371": self.createPX2(self.ua, self.sid),
            "PX11902": 4,
            "PX11560": self.performanceNow,
            "PX12280": self.px11280,
            "PX11496": self.uuid,
            "PX12564": None,
            "PX12565": -1,
            # // "PX11379": False
        }
        return {
            "t": "PX11891",
            "d": px11891_d
        }

    def get_px11547(self):
        px11547_d = {
            "PX12492": "c505c10e26a1b7a7741437db9f82916b",
            "PX12570": "78f763eab3a2082c63c66cf47f9e05a0",
            "PX11352": "e089aa3d700a35da7244dd4da7a68f9c",
            "PX12292": "WebKit",
            "PX11811": [],
            "PX11567": "WebKit WebGL",
            "PX12032": "WebGL 1.0 (OpenGL ES 2.0 Chromium)",
            "PX11536": [
                "ANGLE_instanced_arrays",
                "EXT_blend_minmax",
                "EXT_color_buffer_half_float",
                "EXT_disjoint_timer_query",
                "EXT_float_blend",
                "EXT_frag_depth",
                "EXT_shader_texture_lod",
                "EXT_texture_compression_rgtc",
                "EXT_texture_filter_anisotropic",
                "EXT_sRGB",
                "KHR_parallel_shader_compile",
                "OES_element_index_uint",
                "OES_fbo_render_mipmap",
                "OES_standard_derivatives",
                "OES_texture_float",
                "OES_texture_float_linear",
                "OES_texture_half_float",
                "OES_texture_half_float_linear",
                "OES_vertex_array_object",
                "WEBGL_color_buffer_float",
                "WEBGL_compressed_texture_s3tc",
                "WEBGL_compressed_texture_s3tc_srgb",
                "WEBGL_debug_renderer_info",
                "WEBGL_debug_shaders",
                "WEBGL_depth_texture",
                "WEBGL_draw_buffers",
                "WEBGL_lose_context",
                "WEBGL_multi_draw"
            ],
            "PX12149": [
                "[1, 1]",
                "[1, 64]",
                8,
                "yes",
                8,
                24,
                8,
                16,
                32,
                16384,
                1024,
                16384,
                16,
                16384,
                31,
                16,
                16,
                1024,
                "[16384, 16384]",
                "no_fp",
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127,
                23,
                127,
                127
            ],
            "PX12352": "Google Inc. (Apple)",
            "PX11455": "ANGLE (Apple, Apple M1 Max, OpenGL 4.1)",
            "PX11534": "WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)",
            "PX12503": "d9153fa5509ac1e988e36776dd8d598a",
            "PX12502": "32fe0262ba56767dfd83466855e47bec",
            "PX11927": "a02e9e2368744e62770d4a78862f75fa",
            "PX12572": "7ec700f02277463745cc71774c12c8aa",
            "PX11477": "126.8696939282454",
            "PX12109": "b908567e93d9ed24c036da7986349e97",
            "PX12362": "5a86e326549d99b7d916101a127153a1",
            "PX12491": "be9996f96141c689cda7a1e4e1c28787",
            "PX12130": [
                "Sha256",
                "_init",
                "_open",
                "_close",
                "F9Storage",
                "$",
                "F9Qubit",
                "F9Social",
                "html5",
                "$A",
                "_fbq",
                "_uxa",
                "__core-js_shared__",
                "_",
                "__f9publicCache",
                "ueto_9786ebd4fb",
                "Native2JSBridge",
                "_jelly_sdks",
                "wisepops429858JsonP",
                "_upliftFlag"
            ],
            "PX12351": [
                "jQuery3510402196117429823861",
                "_html5shiv",
                "AccDC1698805894620"
            ],
            "PX11386": [
                "webdriver"
            ],
            "PX12525": "b1199c2b7aa9aa43f16fc345099c3f04",
            "PX12526": "c9a6cb64a9c6b14c5c489fd18fc4c35d",
            "PX11948": 1,
            "PX11685": 10,
            "PX11986": True,
            "PX12299": True,
            "PX12331": True,
            "PX11316": False,
            "PX11448": True,
            "PX12196": "missing",
            "PX12427": [
                "_init",
                "_open",
                "_close",
                "$",
                "$A",
                "_pxCustomAbrDomains",
                "_pxAppId",
                "_Vb73hTEghandler",
                "_fbq",
                "_uxa",
                "__core-js_shared__",
                "_",
                "__f9publicCache"
            ],
            "PX11842": [
                "_html5shiv"
            ],
            "PX12439": [
                "PDF Viewer::Portable Document Format::application/pdf~pdf::text/pdf~pdf",
                "Chrome PDF Viewer::Portable Document Format::application/pdf~pdf::text/pdf~pdf",
                "Chromium PDF Viewer::Portable Document Format::application/pdf~pdf::text/pdf~pdf",
                "Microsoft Edge PDF Viewer::Portable Document Format::application/pdf~pdf::text/pdf~pdf",
                "WebKit built-in PDF::Portable Document Format::application/pdf~pdf::text/pdf~pdf"
            ],
            "PX11993": self.ts,
            "PX12228": "TypeError: Cannot read properties of null (reading '0') at de (https://client.px-cloud.net/PXVb73hTEg/main.min.js:796:13) at func (https://client.px-cloud.net/PXVb73hTEg/main.min.js:4899:19) at ve (https://client.px-cloud.net/PXVb73hTEg/main.min.js:790:13) at https://client.px-cloud.net/PXVb73hTEg/main.min.js:5048:13",
            "PX12288": True,
            "PX12446": 33,
            "PX12236": "fd7149bbfb316699ef918fa7bb7510a8",
            "PX11309": "d41d8cd98f00b204e9800998ecf8427e",
            "PX11551": "fd7149bbfb316699ef918fa7bb7510a8",
            "PX12586": 1,
            "PX11843": 1920,
            "PX11781": 1080,
            "PX12121": 1920,
            "PX12128": 1055,
            "PX12387": "1920X1080",
            "PX12003": 24,
            "PX11380": 24,
            "PX11849": "10207b2f",
            "PX11583": "en-US",
            "PX12458": "MacIntel",
            "PX11681": [
                "en-US"
            ],
            "PX11754": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
            "PX12037": True,
            "PX11621": 8,
            "PX11390": -480,
            "PX11678": False,
            "PX11840": datetime.now().strftime('%a %b %d %Y %H:%M:%S GMT+0800 (中国标准时间)'),
            "PX11540": True,
            "PX11539": "64556c77",
            "PX11555": 4294705152,
            "PX11452": "7c5f9724",
            "PX12527": "3207084bd110f1ac964863e23aa78e04",
            "PX11484": [],
            "PX12501": self.md5(self.vid),
            "PX11902": 2,
            "PX11560": self.performanceNow,
            "PX12280": self.px11280,
            "PX11496": self.uuid,
            "PX12564": None,
            "PX12565": -1
        }
        return {
            "t": "PX11547",
            "d": px11547_d
        }

    def get_px11782(self):
        return {
            "t": "PX11782",
            "d": {
                "PX11719": True,
                "PX11984": "TypeError: Cannot read properties of null (reading '0')\n    at he (https://client.perimeterx.net/PXVb73hTEg/main.min.js:1136:13)\n    at Tc (https://client.perimeterx.net/PXVb73hTEg/main.min.js:3957:26)\n    at Object.Nc [as PX763] (https://client.perimeterx.net/PXVb73hTEg/main.min.js:4044:21)\n    at https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:491629\n    at r (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:491049)\n    at Object.L [as onSolvedCallback] (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:491088)\n    at u (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:290410)\n    at Object.r [as controllerCallback] (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:288058)\n    at Pf (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:275662)",
                "PX11933": True,
                "PX11454": "visible",
                "PX12099": "4YCJ4YGQ4YCa4YCG4YCf4YCe4YGQ4YGI4YGD4YGe4YGQ4YCa4YCX4YCT4YCW4YGQ4YGI4YGD4YGe4YGQ4YCf4YCX4YCG4YCT4YGQ4YGI4YGB4YGe4YGQ4YCG4YCb4YCG4YCe4YCX4YGQ4YGI4YGD4YGe4YGQ4YCB4YCR4YCA4YCb4YCC4YCG4YGQ4YGI4YGG4YGe4YGQ4YCB4YCG4YCL4YCe4YCX4YGQ4YGI4YGB4YGe4YGQ4YCQ4YCd4YCW4YCL4YGQ4YGI4YGD4YGe4YGQ4YCW4YCb4YCE4YGQ4YGI4YGA4YGG4YGe4YGQ4YCQ4YCA4YGQ4YGI4YGD4YGe4YGQ4YCT4YGQ4YGI4YGD4YGe4YGQ4YCQ4YCH4YCG4YCG4YCd4YCc4YGQ4YGI4YGB4YGe4YGQ4YCB4YCC4YCT4YCc4YGQ4YGI4YGE4YGe4YGQ4YCB4YCE4YCV4YGQ4YGI4YGD4YGe4YGQ4YCV4YGQ4YGI4YGB4YGe4YGQ4YCC4YCT4YCG4YCa4YGQ4YGI4YGG4YGe4YGQ4YCU4YCd4YCA4YCf4YGQ4YGI4YGD4YGe4YGQ4YCb4YCc4YCC4YCH4YCG4YGQ4YGI4YGG4YGe4YGQ4YCe4YCT4YCQ4YCX4YCe4YGQ4YGI4YGG4YGe4YGQ4YCa4YGG4YGQ4YGI4YGD4YGe4YGQ4YCG4YCX4YCK4YCG4YCT4YCA4YCX4YCT4YGQ4YGI4YGD4YCP",
                "PX11699": 11659,
                "PX755": self.px755,
                "PX12057": "pxCaptcha",
                "PX11490": "booking.flyfrontier.com",
                "PX11874": "en-US",
                "PX12049": False,
                "PX12489": "v1.8.7",
                "PX11902": 6,
                "PX11560": self.performanceNow,
                "PX12280": self.px11280,
                "PX11496": self.uuid,
                "PX12564": None,
                "PX12565": -1
            }
        }

    def get_px12419(self):
        return {
            "t": "PX12419",
            "d": {
                "PX12040": [],
                "PX12170": "PX11994",
                "PX11934": "https://booking.flyfrontier.com/Flight/InternalSelect?o1=DEN&d1=LAS&dd1=2023-11-30&ADT=1&umnr=false&mon=true",
                "PX12160": {},
                "PX11875": self.uuid,
                "PX11844": 0,
                "PX12465": True,
                "PX11393": "2,1,5598|1,-1,5812|3,-4,5816|3,-1,5831",
                "PX12470": int(time.time() * 1000),
                "PX11698": [
                    "768,513,8249",
                    "771,509,8468"
                ],
                #  p["body"]["offsetWidth"]xp["body"]["offsetHeight"]
                "PX11679": "1904x0",
                "PX11902": 7,
                "PX11560": 14311,
                "PX11719": True,
                "PX12280": self.px11280,
                "PX11496": self.uuid,
                "PX12564": None,
                "PX12565": -1
            }
        }

    def get_px561(self):
        return {
            "t": "PX561",
            "d": {
                "PX11719": True,
                "PX11984": "TypeError: Cannot read properties of null (reading '0')\n    at he (https://client.perimeterx.net/PXVb73hTEg/main.min.js:1136:13)\n    at Tc (https://client.perimeterx.net/PXVb73hTEg/main.min.js:3957:26)\n    at bc (https://client.perimeterx.net/PXVb73hTEg/main.min.js:3950:13)\n    at https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:491583\n    at r (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:491049)\n    at Object.L [as onSolvedCallback] (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:491088)\n    at u (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:290410)\n    at Object.r [as controllerCallback] (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:288058)\n    at Pf (https://captcha.perimeterx.net/PXVb73hTEg/captcha.js?a=c&u=83398d3d-8aa8-11ee-b037-092ff4a06041&v=&m=0:3:275662)",
                "PX11933": True,
                "PX11454": "visible",
                "PX12099": "4YCJ4YGQ4YCa4YCG4YCf4YCe4YGQ4YGI4YGD4YGe4YGQ4YCa4YCX4YCT4YCW4YGQ4YGI4YGD4YGe4YGQ4YCf4YCX4YCG4YCT4YGQ4YGI4YGB4YGe4YGQ4YCG4YCb4YCG4YCe4YCX4YGQ4YGI4YGD4YGe4YGQ4YCB4YCR4YCA4YCb4YCC4YCG4YGQ4YGI4YGG4YGe4YGQ4YCB4YCG4YCL4YCe4YCX4YGQ4YGI4YGB4YGe4YGQ4YCQ4YCd4YCW4YCL4YGQ4YGI4YGD4YGe4YGQ4YCW4YCb4YCE4YGQ4YGI4YGA4YGG4YGe4YGQ4YCQ4YCA4YGQ4YGI4YGD4YGe4YGQ4YCT4YGQ4YGI4YGD4YGe4YGQ4YCQ4YCH4YCG4YCG4YCd4YCc4YGQ4YGI4YGB4YGe4YGQ4YCB4YCC4YCT4YCc4YGQ4YGI4YGE4YGe4YGQ4YCB4YCE4YCV4YGQ4YGI4YGD4YGe4YGQ4YCV4YGQ4YGI4YGB4YGe4YGQ4YCC4YCT4YCG4YCa4YGQ4YGI4YGG4YGe4YGQ4YCU4YCd4YCA4YCf4YGQ4YGI4YGD4YGe4YGQ4YCb4YCc4YCC4YCH4YCG4YGQ4YGI4YGG4YGe4YGQ4YCe4YCT4YCQ4YCX4YCe4YGQ4YGI4YGG4YGe4YGQ4YCa4YGG4YGQ4YGI4YGD4YGe4YGQ4YCG4YCX4YCK4YCG4YCT4YCA4YCX4YCT4YGQ4YGI4YGD4YCP",
                "PX11699": self.performanceNow,
                "PX1133": 594.2000000476837,
                "PX1132": "313a60aa8127f6aa55a7e16abb033abc7cc7f2110914ba8947b4edb3d6d09122",
                "PX12126": True,
                "PX11657": 1,
                "PX12501": self.md5(self.vid),
                "PX12520": True,
                "PX11991": 1,
                "PX11837": 0,
                "PX11632": 0,
                "PX11409": 0,
                "PX11926": [
                    {
                        "PX12343": "mouseover",
                        "PX11652": 0,
                        "PX11699": 8221,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseover",
                        "PX11652": 1,
                        "PX11699": 5353,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseout",
                        "PX11652": 1,
                        "PX11699": 5405,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseover",
                        "PX11652": 1,
                        "PX11699": 5405,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseout",
                        "PX11652": 1,
                        "PX11699": 10795,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseover",
                        "PX11652": 1,
                        "PX11699": 10795,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseout",
                        "PX11652": 1,
                        "PX11699": 10825,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "mouseover",
                        "PX11652": 1,
                        "PX11699": 10825,
                        "PX12270": "true"
                    },
                    {
                        "PX12343": "pointerup",
                        "PX11652": 1,
                        "PX11699": 11157,
                        "PX12270": "true"
                    }
                ],
                "PX11698": [
                    "766,512,6335",
                    "766,512,6357",
                    "768,513,6372",
                    "768,513,6384",
                    "767,514,6400",
                    "771,509,6581",
                    "774,507,6596",
                    "784,507,6611",
                    "801,505,6629",
                    "820,503,6644",
                    "839,501,6656",
                    "858,499,6674",
                    "878,499,6687",
                    "895,499,6704",
                    "912,499,6719",
                    "925,499,6735",
                    "936,498,6748",
                    "947,496,6774",
                    "951,495,6784",
                    "956,492,6803",
                    "959,491,6817",
                    "960,490,6832",
                    "961,489,6847",
                    "962,488,6861",
                    "962,488,6876",
                    "962,488,6907",
                    "963,488,6922",
                    "963,487,6937",
                    "964,486,6977",
                    "966,484,6978",
                    "966,483,6993",
                    "967,482,7008",
                    "968,481,7158"
                ],
                "PX12160": [
                    "#px-captcha",
                    ""
                ],
                "PX11427": 458,
                "PX12208": 695,
                "PX11824": 530,
                "PX11631": 50,
                "PX11843": 1920,
                "PX11781": 1080,
                "PX11906": [
                    "getAttribute",
                    "className",
                    "nodeName",
                    "nodeName"
                ],
                "PX11945": 273,
                "PX12174": 23.89,
                "PX11882": "pointerdown",
                "PX11642": 2695.99609375,
                "PX11313": 645.44921875,
                "PX11772": 5787,
                "PX11529": 9232191,
                "PX11555": 4294705152,
                "PX11833": 16707175,
                "PX12024": 273.22,
                "PX11759": 23.89,
                "PX11896": "pointerup",
                "PX11633": 2696.22265625,
                "PX11445": 645.44921875,
                "PX12417": 11157,
                "PX12382": [
                    5367
                ],
                "PX11360": 374,
                "PX11735": True,
                "PX11874": "en-US",
                "PX12205": self.token,
                "PX11357": 5053,
                "PX12563": "130b70fd5052decdbd8bbf221736a5ff9b10017912a9217d1a80eb2e88f051a0",
                "PX11321": 11171,
                "PX11351": False,
                "PX11919": False,
                "PX11710": False,
                "PX12407": False,
                "PX12411": 853,
                "PX11494": 1920,
                "PX12265": 1,
                "PX11706": "PX12374",
                "PX12489": "v1.8.7",
                "PX12499": False,
                "PX12500": False,
                "PX12521": True,
                "PX12522": False,
                "PX12528": False,
                "PX12529": True,
                "PX12585": "https://booking.flyfrontier.com/Flight/InternalSelect?o1=DEN&d1=LAS&dd1=2023-11-30&ADT=1&umnr=false&mon=true",
                "PX12596": False,
                "PX12538": True,
                "PX12537": 5,
                "PX12544": True,
                "PX12589": "succeeded",
                "PX12590": "e9d4735339614efcab53d40d03b3e2f08ea9534084e646c897808312cfa39bd81662465543537ac45c00c0174c70a18317f7e4c5801c23f19",
                "PX12610": "PGJQWUwlWFofT!M(DSgdyAASnNBaSNtITEVMHIHVxgfDUAMehR%DU)@ERdeTAh!cBFZUkNbZBcBIQ(mUUkXSkkdNDh$AzlpeCYwS@sJSlkCMHxRdh(SR!AQe)UOYDYs",
                "PX12504": 11179,
                "PX12547": False,
                "PX11902": 5,
                "PX11560": self.performanceNow,
                "PX12280": self.px11280,
                "PX11496": self.uuid,
                "PX12564": None,
                "PX12565": -1
            }
        }


if __name__ == '__main__':
    a2 = "B1kHB1kHFF4JX1kODVAKRVBQXF1FWVkNDUUKXVpfRQteDVFRDFhcXF8MWBRbWV1bXlhYWBQcGh0NFhYWFllZWQcHWRQLCxReWBQ9Wi4cMj4mGAwvPVE8Ly5cJx9VVRYWFhYHWVlZBwcHWRRZX1hYXV1cWlpZXVpdFhYWFllZB1lZWRQMWw5bX19fCQldXlALWw1eUFoJX1kOX1tbUQ4JXwwJXgpYX1wMXApQDVwLXQsKDFtQDVpfXl4LCllRXAtQWlpcFhYWFgdZWQdZWQcHFF4JX1pYCloORVBQXF1FWVkNDUUKXVpQRQ5fCl8ODA5ZDFwOWxQcGh0NFhYWFlkHBwcHWRQLBA1eChpRXA9eBgFYWVoDXAAAWBYWFhYHWVkHWVkUXglfWlhQXFBFUFBcXUVZWQ0NRQpdWlBFDl8KXw4MDlkMXA5bFhYWFgdZB1lZWRQLHRYWFhZZWVkHWQcUWVBYXF9QWlhfW11bXF1dWFhbWlwWFhYWB1lZWQcHBwcUWV1ZWw=="

    b2 = base64.b64decode(a2.encode())
    for i in bytes(encrypt(b2, 872 % 128)).decode().split('~~~~'):
        print('o11o111o' in i, i)
        tmp = i.split('|')
        if tmp[0] == 'o111ooo1':
            ts = tmp[1]
        if tmp[0] == 'o111oooo':
            num1 = int(tmp[1])
        if tmp[0] == '111o1o':
            num2 = tmp[1]

        if tmp[0] == '1oooo1':
            str1 = tmp[1]
        if tmp[0] == 'o1oo1o':
            vid = tmp[1]

        if tmp[0] == 'o11o11':
            sid = tmp[1]
        if tmp[0] == '11o111':
            cs = tmp[1]
        if tmp[0] == 'o11o11oo':
            cts = tmp[1]
    uuid = '31fafcb0-8844-11ee-8d49-97ed9bc8f96f'
    px = PxEnv('https://www.flyfrontier.com/',
               sid, vid, ts, num1, num2, str1, uuid

               , 1700552863875, 1700464712550
               , 1700552863903, 1700552863903)
    print(px.get_px11590())
