Commit 758c1619 authored by wang's avatar wang

f9 验票

parent f258bcdc
import json
import tls_client
sess = tls_client.Session(client_identifier='chrome_120', random_tls_extension_order=True)
sess.proxies = {
'http': 'http://127.0.0.1:8890',
'https': 'http://127.0.0.1:8890',
}
headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkb3RSZXpXZWIiLCJqdGkiOiI5NjQ4NGVmNC01ZDRhLWNmZGQtMmUxNS0yODZmOTI0NDJiYjgiLCJpc3MiOiJkb3RSRVogQVBJIn0.kj6XQ3UeeQdfCRWlXerCm8e0K6tom2rBh94KPoq8ZaQ',
'cookie': '_px2=eyJ1IjoiOTQ2ZGRmMTAtZjg5OC0xMWVlLWFiMGUtMjE0MzJkYTI1YzFiIiwidiI6Ijk0YjIyMWNlLWY4OTgtMTFlZS1hM2EzLTc1NTRjYTE4ODBiNiIsInQiOjYyMDIzMzg4MDAwNCwiaCI6IjdmYTJmZDNmN2EyNDgxOTIxNjNjZTRjM2Y3Zjg4ZWExYzg0Njc4ZmY1YWIwZGVlNGZmMDZiNTllYTVkZTQ3YWQifQ==; pxcts=94b237f6-f898-11ee-a3a4-c5a68439d54c; _pxvid=94b221ce-f898-11ee-a3a3-7554ca1880b6; _abck=C0058C0262CE56DE9E46BB4254E069A0~0~YAAQMDovF09sgMKOAQAAuwcQ0Qvnv9opEByhFscRc9yNfRSPXrJLLan1MorhU2fjcDX7FO6+kD6Yz4a29xVYdBG/OkGegWjJft7Ia0tWKoNpPkmS26fzu37iMYogZHfaxxumEfPXXouGtDti9JMdyxwRbbhyVBCF2ZFagwC7lvc7bpQ4jbFO9+CQxIX+ofoHz8+6v1h9cvt/d/b8LO4vndxqAE+t4xXN37s1ZmYwIQ1oFu6ozjlXvbR3gaUG+XlnWUEAdxBIMLAlsIFlwxsNpUbvGGB1esMlKxW6cHO78NPKotVPQsPuOLO3i4w5KK+0nEoyJkW81qvZ9DCU+dswmCX9GPO1102Tmr8vQWKyDecn1gqbRk+zWGgnTHbcWejlDw6w2POQKIMj2rAtWEDOmkNUDPHeefb6nA==~-1~-1~1712908072; _pxhd=d146b6d169419729440a5220a86870206d20a665ef018c2c7f0d94903574a539:951c3ccd-f898-11ee-b651-697d5e746336; ak_bmsc=266B825ABC5951EF63A9FE8D599169F7~000000000000000000000000000000~YAAQMDovFxNsgMKOAQAAlgQQ0RfDSLV6FdCv8qx4pOh2nauiHQUuDFSVODso/bai2uhip7lcR3BxXhitdtxE0364ydSCMmECTKdYMC+zLa1ISHT6Af3pd/yagWEIWJfAqYmr8NmYOWY/cjEA5h/Mau6lSJe+durUscIKcciDGc6k5v+T/7eTAOQ6JNt6fowOTesGYWMGp8uilgA4pxr7zAllg/pTZTkffBACVZlyBfYFfr1KhlWUD2Kqxv12f6H1lWEoqTHv62VH1LmLoBdaEo2Hpu/Ny5Na/KDcBEMyV6/UXucHakVfMCEpWVcr8xQvg09qGzuovreP0hpwhy1uIXQpCpCqMKsbiDltm44eJsTGmO27mWuN0OxER0Fm5imJOXqREg00EN7O; bm_sz=910004B959D07353D28A50942BA43467~YAAQMDovF1BsgMKOAQAAuwcQ0ReeyKQoa4R0eX2SyJhGJsTy8PLGTf2s+PCmThAjRMB3KkMfGmKP8ImpP70Rv06L87ZtlD1uSI9Xnngk0VZiqwjt3QcuQrXa5l8MurpP9IncsGDrMfuzvmZURXq1nDJCQ3P5zCpt4EEv/roNsLous2IEsLwPm1ayOcKMukXjsPYLMQVMpd82hX4juXwJNsWPbvfkaD4hUQW06QO8RBcqbEqDhyrFE2/H5OsUytJz1FsJ8XYoGJBqzObNvoQgRBm8n2Fgxm1VXeWIt+xiQoSTRxO5fG+ZHPs9pWai6SS6zBgE0K3CklFSputY2FPsGZJB0N4bEoV5p5CBW9cB1agdP3qUFvPlbkVvFrUf044Jk1DibbRVdvXEZ/oEZ+86PQ==~3355448~3487801; userCountryLocation=US; userGeolocation=-92.5003, 34.5942',
"authority": "www.spirit.com",
"accept": "application/json, text/plain, */*",
"accept-language": "en-US",
"cache-control": "no-cache",
"content-type": "application/json",
"ocp-apim-subscription-key": "dc6844776fe84b1c8b68affe7deb7916",
"origin": "https://www.spirit.com",
"pragma": "no-cache",
"referer": "https://www.spirit.com/",
"sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"x-dtpc": "10$492787436_542h10vNDAFLLHTQHFKVMUIMICENMIBAMBWCDES-0e0"
}
url = "https://www.spirit.com/api/prod-availability/api/availability/search"
data = {"includeWifiAvailability": True, "criteria": [{"stations": {"originStationCodes": ["DFW"],
"destinationStationCodes": ["FLL"],
"searchDestinationMacs": False,
"searchOriginMacs": False},
"dates": {"beginDate": "2024-04-24", "endDate": "2024-04-24"},
"filters": {"filter": "Default"}}],
"passengers": {"types": [{"type": "ADT", "count": 1}]}, "codes": {"currency": "USD"},
"fareFilters": {"loyalty": "MonetaryOnly", "types": [], "classControl": 1}, "taxesAndFees": "TaxesAndFees",
"originalJourneyKeys": [], "originalBookingRecordLocator": None, "infantCount": 0, "birthDates": []}
data = json.dumps(data, separators=(',', ':'))
response = sess.post(url, headers=headers, data=data)
print(response.text)
print(response)
......@@ -16,6 +16,7 @@
"express": "^4.18.2",
"log4js": "^6.9.1",
"md5": "^2.3.0",
"mongodb": "^6.5.0",
"pino": "^8.16.2",
"qs": "^6.11.2",
"query-string": "^8.1.0"
......@@ -374,6 +375,27 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@mongodb-js/saslprep": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.5.tgz",
"integrity": "sha512-XLNOMH66KhJzUJNwT/qlMnS4WsNDWD5ASdyaSH3EtK+F4r/CFGa3jT4GNi4mfOitGvWXtdLgQJkQjxSVrio+jA==",
"dependencies": {
"sparse-bitfield": "^3.0.3"
}
},
"node_modules/@types/webidl-conversions": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="
},
"node_modules/@types/whatwg-url": {
"version": "11.0.4",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz",
"integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==",
"dependencies": {
"@types/webidl-conversions": "*"
}
},
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
......@@ -535,6 +557,14 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
"node_modules/bson": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.6.0.tgz",
"integrity": "sha512-BVINv2SgcMjL4oYbBuCQTpE3/VKOSxrOA8Cj/wQP7izSzlBGVomdm+TcUd0Pzy0ytLSSDweCKQ6X3f5veM5LQA==",
"engines": {
"node": ">=16.20.1"
}
},
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
......@@ -1292,6 +1322,11 @@
"node": ">= 0.6"
}
},
"node_modules/memory-pager": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="
},
"node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
......@@ -1335,6 +1370,60 @@
"node": ">= 0.6"
}
},
"node_modules/mongodb": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.5.0.tgz",
"integrity": "sha512-Fozq68InT+JKABGLqctgtb8P56pRrJFkbhW0ux+x1mdHeyinor8oNzJqwLjV/t5X5nJGfTlluxfyMnOXNggIUA==",
"dependencies": {
"@mongodb-js/saslprep": "^1.1.5",
"bson": "^6.4.0",
"mongodb-connection-string-url": "^3.0.0"
},
"engines": {
"node": ">=16.20.1"
},
"peerDependencies": {
"@aws-sdk/credential-providers": "^3.188.0",
"@mongodb-js/zstd": "^1.1.0",
"gcp-metadata": "^5.2.0",
"kerberos": "^2.0.1",
"mongodb-client-encryption": ">=6.0.0 <7",
"snappy": "^7.2.2",
"socks": "^2.7.1"
},
"peerDependenciesMeta": {
"@aws-sdk/credential-providers": {
"optional": true
},
"@mongodb-js/zstd": {
"optional": true
},
"gcp-metadata": {
"optional": true
},
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"snappy": {
"optional": true
},
"socks": {
"optional": true
}
}
},
"node_modules/mongodb-connection-string-url": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz",
"integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==",
"dependencies": {
"@types/whatwg-url": "^11.0.2",
"whatwg-url": "^13.0.0"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz",
......@@ -1465,6 +1554,14 @@
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"engines": {
"node": ">=6"
}
},
"node_modules/qs": {
"version": "6.11.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz",
......@@ -1686,6 +1783,14 @@
"atomic-sleep": "^1.0.0"
}
},
"node_modules/sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
"dependencies": {
"memory-pager": "^1.0.2"
}
},
"node_modules/split-on-first": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-3.0.0.tgz",
......@@ -1771,6 +1876,17 @@
"node": ">=0.6"
}
},
"node_modules/tr46": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
"dependencies": {
"punycode": "^2.3.0"
},
"engines": {
"node": ">=14"
}
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
......@@ -1831,6 +1947,26 @@
"node": ">= 0.8"
}
},
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"engines": {
"node": ">=12"
}
},
"node_modules/whatwg-url": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
"dependencies": {
"tr46": "^4.1.1",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=16"
}
},
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz",
......
......@@ -16,6 +16,7 @@
"express": "^4.18.2",
"log4js": "^6.9.1",
"md5": "^2.3.0",
"mongodb": "^6.5.0",
"pino": "^8.16.2",
"qs": "^6.11.2",
"query-string": "^8.1.0"
......
......@@ -2,8 +2,10 @@ import log4js from 'log4js'
import {bl, genUuid, ht, ie, Ol, randint, se} from "./utils.js"
import axios from "axios";
import {PxEnv} from './px.js'
import * as fs from "fs";
import {MongoClient} from "mongodb";
const uri = "mongodb://lcc-spider:JIUsfhiad&^@54.183.159.9:27017/?authSource=admin&directConnection=true";
const client = new MongoClient(uri);
log4js.configure({
appenders: {
......@@ -38,13 +40,14 @@ class PxBypass {
this.pxUrl = `https://collector-${this.appId}.px-cloud.net/api/v2/collector`
this.log = log4js.getLogger('px')
let env = fs.readFileSync('./env.json', 'utf-8')
env = JSON.parse(env);
let keys = Object.keys(env)
let selectId = keys[randint(0, keys.length - 1)]
// let env = fs.readFileSync('./env.json', 'utf-8')
// env = JSON.parse(env);
// let keys = Object.keys(env)
// let selectId = keys[randint(0, keys.length - 1)]
// selectId = 'd3e94c1cb84038031357a52f'
this.log.info('select env', selectId)
this.env = env[selectId]
// this.log.info('select env', selectId)
// this.env = env[selectId]
// this.ua = this.env.navigatorparams.useragent
this.prox = `http://user-uni001-region-us-sessid-${randint(1000, 5000)}-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600`
......@@ -92,6 +95,20 @@ class PxBypass {
}
async initMongo() {
const database = client.db("env");
const movies = database.collection("env_shape");
// Query for a movie that has the title 'The Room'
const query = {};
// Execute query
const movie = await movies.aggregate([
{$sample: {size: 1}}
])
let res = await movie.toArray()
this.env = res[0]
}
async add_headers(token) {
// this.prox = `http://user-uni001-region-us-sessid-${randint(1000, 5000)}-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600`
......@@ -110,7 +127,7 @@ class PxBypass {
"sec-fetch-user": "?1",
"sec-fetch-dest": "document",
"accept-language": "en-US,en;q=0.9,en-GB;q=0.8,en-GB-oxendict;q=0.7",
'Authorization': 'Bearer '+ token,
'Authorization': 'Bearer ' + token,
"cookie": cks
}
let res = await axios.post('http://ymx-lcc.unififi.com/header/add', JSON.stringify({
......@@ -437,7 +454,7 @@ class PxBypass {
if (res.data.status_code === 201) {
// console.log(res.data.text)
this.log.warn('success', res.data.status_code, res.data.text)
let token =JSON.parse(res.data.text).data.token
let token = JSON.parse(res.data.text).data.token
await this.add_headers(token)
} else {
......@@ -478,6 +495,7 @@ async function run() {
let px = new PxBypass()
try {
await px.initMongo()
await px.step1()
if (px.flag) {
await px.test()
......
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