import
json
import
time
import
uuid
import
requests
from
frida_client
import
FridaClient
def
_headers(auth_token, device_id, t, n, signed, lon, lat):
return
{
'system-language'
:
'CN'
,
'device-type'
:
'android'
,
'tpg'
:
'1'
,
'app-version'
:
'5.0.80'
,
'device-id'
: device_id,
'device-os-version'
:
'7.1.1'
,
'device-name'
:
'OPPO_OPPO+R9s'
,
'treq-id'
:
'1540d0ec530741abbab593af41966110.313.17103985647343144'
,
'auth-token'
: auth_token,
'longitude'
: lon,
'latitude'
: lat,
'p'
:
'1656120205'
,
't'
: t,
'n'
: n,
'sy'
:
'0'
,
'st'
: signed,
'sny'
:
'c'
,
'rcs'
:
'1'
,
'spv'
:
'1.1'
,
'Local-Longitude'
:
'0.0'
,
'Local-Latitude'
:
'0.0'
,
'Content-Type'
:
'application/json;charset=utf-8'
,
'Host'
:
'api-xxxx.walmartmobile.cn'
,
'User-Agent'
:
'okhttp/4.8.1'
}
def
work():
frida_client
=
FridaClient(package_name
=
'cn.xxxxclub.app'
, js_file
=
'app_inject.js'
, mode
=
FridaClient.StartMode.spawn)
frida_client.start()
url
=
"https://api-xxxx.walmartmobile.cn/api/v1/xxxx/goods-portal/spu/search"
device_id
=
'b9fb859f7cfeb98ef39a31c410001f716c04'
user_uid
=
'181864991321'
auth_token
=
'740d926b981716f45de7a402b7b6761a46d9af48f752262b77a2cb0701d482f20c60e6345685b46681a1c23129bdffad022e2e75f60ac763'
lon, lat
=
'114.151608'
,
'22.554734'
t
=
f
"{int(time.time() * 1000)}"
goods_name
=
'蛋糕'
data
=
{
"userUid"
: user_uid,
"pageNum"
:
1
,
"pageSize"
:
20
,
"keyword"
: goods_name,
"rewriteWord"
: goods_name,
"filter"
: [],
"storeInfoVOList"
: [
{
"storeId"
:
9991
,
"storeType"
:
32
,
"storeDeliveryAttr"
: [
10
]
},
{
"storeId"
:
6758
,
"storeType"
:
256
,
"storeDeliveryAttr"
: [
2
,
3
,
4
,
5
,
6
,
9
,
12
,
13
]
},
{
"storeId"
:
6580
,
"storeType"
:
2
,
"storeDeliveryAttr"
: [
7
,
13
]
},
{
"storeId"
:
9992
,
"storeType"
:
8
,
"storeDeliveryAttr"
: [
1
]
}
],
"addressVO"
: {
"cityName"
: "",
"countryName"
: "",
"detailAddress"
: "",
"districtName"
: "",
"provinceName"
: ""
},
"uid"
: device_id,
"uidType"
:
3
,
"sort"
:
"0"
}
n
=
str
(uuid.uuid4()).replace(
'-'
, '')
data_json
=
json.dumps(data, indent
=
None
, separators
=
(
','
,
':'
), ensure_ascii
=
False
)
signed
=
frida_client.get_sign(text
=
f
"{t}{data_json}{n}{auth_token}"
)
headers
=
_headers(auth_token
=
auth_token, device_id
=
device_id, t
=
t, n
=
n, signed
=
signed, lon
=
lon, lat
=
lat)
response
=
requests.request(
"POST"
, url, headers
=
headers, data
=
data_json.encode(
'utf-8'
))
print
(response.text)
work()