Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
px3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangmingming
px3
Commits
a4284bac
Commit
a4284bac
authored
Nov 15, 2023
by
wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
3783ed29
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
180 additions
and
69 deletions
+180
-69
main.py
main.py
+105
-69
test_search.py
test_search.py
+75
-0
No files found.
main.py
View file @
a4284bac
import
hmac
import
hashlib
import
base64
import
ctypes
import
hashlib
import
hmac
import
json
import
random
import
time
import
traceback
import
uuid
from
urllib.parse
import
quote
import
execjs
import
requests
...
...
@@ -62,9 +61,9 @@ class PxBypass():
prox
=
'http://b6b6b6b6-zone-custom-region-us-session-130oj36t4-sessTime-5:bpoMDFG5oD@na.ipidea.io:2333'
prox
=
'http://user-uni001-region-us-sessid-1111-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
#
prox = 'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:9000'
#
prox = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
# prox = 'http://127.0.0.1:7
890'
prox
=
'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:9000'
prox
=
f
'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
prox
=
'http://127.0.0.1:8
890'
session
.
proxies
=
{
'http'
:
prox
,
'https'
:
prox
,
...
...
@@ -103,41 +102,30 @@ class PxBypass():
# if self.session.cookies.get_dict().get('_px2', None) == None:
self
.
_step_3
()
self
.
inc
()
#
time.sleep(2)
time
.
sleep
(
2
)
self
.
__token
()
def
_init
(
self
):
# resp = requests.post('http://127.0.0.1:59001/akamai/gen', json={
# self.prox = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
resp
=
requests
.
post
(
'http://52.52.23.116/akamai/gen'
,
json
=
{
'type'
:
"NK"
,
# 'proxy': 'http://127.0.0.1:7890'
'proxy'
:
self
.
prox
})
if
'~0~'
not
in
resp
.
json
()[
'cookies'
][
'_abck'
]:
raise
Exception
(
"abck失败"
)
self
.
session
.
cookies
.
update
(
resp
.
json
()[
'cookies'
]
)
# res = self.session.get(
# self.target_url,
# headers={
# "authority": "www.spirit.com",
# "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
# "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6",
# "cache-control": "no-cache",
# "pragma": "no-cache",
# "sec-ch-ua": "\"Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"115\", \"Chromium\";v=\"115\"",
# "sec-ch-ua-mobile": "?0",
# "sec-ch-ua-platform": "\"macOS\"",
# "sec-fetch-dest": "document",
# "sec-fetch-mode": "navigate",
# "sec-fetch-site": "none",
# "sec-fetch-user": "?1",
# "upgrade-insecure-requests": "1",
# "user-agent": "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"
# }, allow_redirects=True)
# self.log.info(f"初始化请求 res {res.status_code}")
res
=
self
.
session
.
get
(
self
.
target_url
,
headers
=
{
"authority"
:
"www.spirit.com"
,
"accept"
:
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
,
"accept-language"
:
"en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6"
,
"cache-control"
:
"no-cache"
,
"pragma"
:
"no-cache"
,
"sec-ch-ua"
:
"
\"
Not/A)Brand
\"
;v=
\"
99
\"
,
\"
Google Chrome
\"
;v=
\"
115
\"
,
\"
Chromium
\"
;v=
\"
115
\"
"
,
"sec-ch-ua-mobile"
:
"?0"
,
"sec-ch-ua-platform"
:
"
\"
macOS
\"
"
,
"sec-fetch-dest"
:
"document"
,
"sec-fetch-mode"
:
"navigate"
,
"sec-fetch-site"
:
"none"
,
"sec-fetch-user"
:
"?1"
,
"upgrade-insecure-requests"
:
"1"
,
"user-agent"
:
"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"
},
allow_redirects
=
True
)
self
.
log
.
info
(
f
"初始化请求 res {res.status_code}"
)
self
.
params
=
{}
for
k
,
v
in
self
.
session
.
cookies
.
items
():
self
.
params
[
k
]
=
v
...
...
@@ -291,14 +279,64 @@ class PxBypass():
for
i
in
range
(
0
,
len
(
r
),
2
):
a2
+=
r
[
i
]
return
a2
def
__token
(
self
):
cks
=
[]
for
k
,
v
in
self
.
session
.
cookies
.
get_dict
()
.
items
():
cks
.
append
(
f
'{k}={v}'
)
# resp = requests.post('http://127.0.0.1:59001/akamai/gen', json={
self
.
prox
=
f
'http://user-uni001-region-us-sessid-{random.randint(1000, 5000)}-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
self
.
prox
=
f
'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
# self.prox = 'http://127.0.0.1:8890'
resp
=
requests
.
post
(
'http://52.52.23.116/akamai/gen'
,
json
=
{
# resp = requests.post('http://127.0.0.1:59001/akamai/gen', json={
'type'
:
"NK2"
,
# 'proxy': 'http://127.0.0.1:7890'
'proxy'
:
self
.
prox
,
'cookie'
:
'; '
.
join
(
cks
)
})
if
'~0~'
not
in
resp
.
json
()[
'cookies'
][
'_abck'
]:
raise
Exception
(
"abck失败"
)
print
(
resp
.
json
()[
'cookies'
])
self
.
session
.
cookies
.
update
(
resp
.
json
()[
'cookies'
]
)
url
=
"https://www.spirit.com/api/prod-token/api/v1/token"
data
=
{
"applicationName"
:
"dotRezWeb"
}
data
=
json
.
dumps
(
data
,
separators
=
(
','
,
':'
))
response
=
self
.
session
.
post
(
url
,
headers
=
{
# response = self.session.post(url, headers={
# "authority": "www.spirit.com",
# "accept": "application/json, text/plain, */*",
# "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6",
# "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": "\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\"",
# "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/117.0.0.0 Safari/537.36",
# "x-dtpc": "8$216560782_634h19vKIAKIMFGTUTKRWPPLDKCSORJAIECKGLH-0e0"
# }, data=data, proxy={
# 'http':'http://127.0.0.1:7890',
# 'https':'http://127.0.0.1:7890',
# # 'http': self.prox,
# # 'https': self.prox,
# }, insecure_skip_verify=True)
cks
=
[]
for
k
,
v
in
self
.
session
.
cookies
.
get_dict
()
.
items
():
cks
.
append
(
f
'{k}={v}'
)
response
=
requests
.
post
(
'http://52.52.23.116/tls/forward'
,
json
=
dict
(
url
=
url
,
headers
=
{
"authority"
:
"www.spirit.com"
,
"accept"
:
"application/json, text/plain, */*"
,
"accept-language"
:
"en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6"
,
...
...
@@ -315,18 +353,16 @@ class PxBypass():
"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/117.0.0.0 Safari/537.36"
,
"x-dtpc"
:
"8$216560782_634h19vKIAKIMFGTUTKRWPPLDKCSORJAIECKGLH-0e0"
},
data
=
data
,
proxy
=
{
# 'http':'http://127.0.0.1:8890',
# 'https':'http://127.0.0.1:8890',
'http'
:
self
.
prox
,
'https'
:
self
.
prox
,
},
insecure_skip_verify
=
True
)
print
(
response
.
text
)
"x-dtpc"
:
"8$216560782_634h19vKIAKIMFGTUTKRWPPLDKCSORJAIECKGLH-0e0"
,
"cookie"
:
'; '
.
join
(
cks
)
},
method
=
"POST"
,
data
=
data
,
proxy
=
self
.
prox
,
debug
=
True
# ,allow_redirects=True
))
response
=
response
.
json
()
print
(
response
)
print
(
response
.
status_code
)
token
=
response
.
json
()[
'data'
][
'token'
]
print
(
response
[
'status_code'
])
data
=
json
.
loads
(
response
[
'text'
])
token
=
data
[
'data'
][
'token'
]
h
=
{
"authority"
:
"www.spirit.com"
,
...
...
@@ -349,9 +385,9 @@ class PxBypass():
'Authorization'
:
f
'Bearer {token}'
}
cks
=
[]
for
k
,
v
in
self
.
session
.
cookies
.
get_dict
()
.
items
():
for
k
,
v
in
self
.
session
.
cookies
.
get_dict
()
.
items
():
cks
.
append
(
f
'{k}={v}'
)
h
[
'cookie
s
'
]
=
'; '
.
join
(
cks
)
h
[
'cookie'
]
=
'; '
.
join
(
cks
)
uri
=
'http://ymx-lcc.unififi.com/header/add'
# uri = 'http://52.52.23.116/header/add'
# proxy = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{int(random.randint(10000, 11149))}'
...
...
test_search.py
0 → 100644
View file @
a4284bac
import
random
import
requests
import
tls_client
session
=
tls_client
.
Session
(
client_identifier
=
'chrome_117'
)
import
json
h
=
{
"authority"
:
"www.spirit.com"
,
"x-dtpc"
:
"8$216560782_634h19vKIAKIMFGTUTKRWPPLDKCSORJAIECKGLH-0e0"
,
"accept"
:
"application/json, text/plain, */*"
,
"cache-control"
:
"no-cache"
,
"content-type"
:
"application/json"
,
"origin"
:
"https://www.spirit.com"
,
"sec-ch-ua-mobile"
:
"?0"
,
"sec-fetch-dest"
:
"empty"
,
"sec-fetch-site"
:
"same-origin"
,
"Authorization"
:
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkb3RSZXpXZWIiLCJqdGkiOiI1ZDVjMzMwYi0zY2Y5LTk2OGYtYzczMC00YWQzMjQxOGQwNWEiLCJpc3MiOiJkb3RSRVogQVBJIn0.HpPtd8CGO_q68CzE9ZWoWE90DBHijl-oNij-LyWlo4I"
,
"cookie"
:
"userCountryLocation=AR; userGeolocation=-60.05, -26.93; _pxhd=15b0ff658780101e092b98c6aceae11673b227ca11674ff492f70664c1ec63bf:d393e8ff-839b-11ee-a10d-8a5d926cbf1e; _abck=59FF424FECF1548CE4CA3273E2AC3F7F~-1~YAAQJGdNaLYSprOLAQAAUVZg0gq/wtHFjxoACRuTBoFMhvKmaDaRKxymtaN/B0mS6LPXzXzqK3iEzb+eyrCqEkr2JBjBbJptIBRuSN7x9OPpj0LSPlAKCSUuSZp0nYODhXImF5dBYkZfU865128iwvkS+AFD+FmiiXI256Kg4bJUhUcrwcbRqdNnhZHBZyTfnJ8eX/K10NuT2yVPcKudgCbqLXG+xR5RR6s7UIC5X7cy09KtGd7yjuRQIZBwqu1YgOmHNwoRLwtuMydvj1mOrTqZIHthyvf4O2jOSMyUBx+870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Hv0gspebyECw5g45XgA93Zbf3RqG1KM2duItD3BAxIt0uips+6TkKIKT5ocejTu8BwAHk596WrKDUfA8sWIUjBhdgdiK/7NhmPhhqHTfliDC9/3Iec0pxzDCBlpJqQxpyBGASJcVO2bDQvpUesHkfCBDo983wkvMDopzE9fYOPTG4GuiL2F7zg9hpeG5G1bb08bc/R9bdOHmKdaEBe4pGhyzmq4TeDQAc2IcYlFG9wWC7OFJBp1Z0+Nt3~1; bm_sv=7441A40BE0D728C8E6CF542453E15853~YAAQXv4ZuCIBG66LAQAA1EJg0hU+T+fSZWalU5WEg8eI7jsbaeHmkUuu+rBtUZ6Swo09x+IkRJD9fiTH6jkQAmWcZiwHIPu3UNWzXmdcAKRLnzHAUHaAB8/zGeRfG7eLeIN10VpaHSHMYQg30ycMV9vkC7oTjGnNfeBxk17d+Qw2vb0i6llEtuVUnKYOlsiznYyjfW2wYSWL2KyWiEsiS/ygNTiVnEuOXISwJDbO0OaZ0u4gM8WfxWrj7B/Tt87r~1; _pxde=565ab764e281018491e165254b15ec4fa4b0dfe3fe89b301a514b42fbcfbce0e:eyJ0aW1lc3RhbXAiOjE3MDAwNDE2MDc0MDB9; _pxvid=d393e8ff-839b-11ee-a10d-8a5d926cbf1e; pxcts=e3e68da1-839b-11ee-948d-0a2043fa075e; _px2=eyJ1IjoiZjFjZDM2MDctM2NkMi00ZGRkLTg1MTQtOGMwZjNjYWYxYzFmIiwidiI6ImQzOTNlOGZmLTgzOWItMTFlZS1hMTBkLThhNWQ5MjZjYmYxZSIsInQiOjE3MDAwNDE5MDczOTksImgiOiJjOWYzOGM4M2U4Nzk0NzI1ZTBkOTkwMzBmYmUxMDg0ODkyOGUwNTQ1MTdhOWRjM2FjOTNhMDcxMjJhNGNkZDIyIn0="
,
"sec-ch-ua"
:
"
\"
Google Chrome
\"
;v=
\"
117
\"
,
\"
Not;A=Brand
\"
;v=
\"
8
\"
,
\"
Chromium
\"
;v=
\"
117
\"
"
,
"user-agent"
:
"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"
,
"accept-language"
:
"en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ru;q=0.6"
,
"ocp-apim-subscription-key"
:
"dc6844776fe84b1c8b68affe7deb7916"
,
"pragma"
:
"no-cache"
,
"referer"
:
"https://www.spirit.com/"
,
"sec-ch-ua-platform"
:
"
\"
macOS
\"
"
,
"sec-fetch-mode"
:
"cors"
}
url
=
"https://www.spirit.com/api/prod-availability/api/availability/search"
data
=
{
"includeWifiAvailability"
:
True
,
"criteria"
:
[
{
"stations"
:
{
"originStationCodes"
:
[
"SJC"
],
"destinationStationCodes"
:
[
"BNA"
],
"searchDestinationMacs"
:
False
,
"searchOriginMacs"
:
False
},
"dates"
:
{
"beginDate"
:
"2023-11-17"
,
"endDate"
:
"2023-11-17"
},
"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
=
(
','
,
':'
))
prox
=
f
'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{random.randint(10000, 13500)}'
prox
=
'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:10395'
prox
=
'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:10855'
prox
=
'http://user-uni001-region-us-sessid-1058-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
response
=
requests
.
post
(
'http://52.52.23.116/tls/forward'
,
json
=
dict
(
url
=
url
,
method
=
"POST"
,
data
=
data
,
proxy
=
prox
,
headers
=
h
,
debug
=
True
)
)
# response = session.post(url, headers=h, data=data, proxy={
# # 'http':'http://127.0.0.1:7890',
# # 'https':'http://127.0.0.1:7890',
# 'http': prox,
# 'https':prox,
# })
print
(
response
.
text
)
print
(
response
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment