幻藏网

抓取网址:https://huancang.art/#/market

抓取目标:藏品相关信息

image-20240903131738509

网页分析

打开网页后,按F12打开开发者工具,然后搜索数据,点击翻页。

image-20240903131904519

载荷中没有加密,有个时间戳

image-20240903131934986

请求头中,有个签名signaturex-token参数加密

image-20240903132028455

定位参数加密位置

image-20240903132320615

打断点,在控制台输出

image-20240903132341591

向下追踪

image-20240903143745841

上面我们能明显的看到md5的特征了,我们直接那参数去标准网站进行对比,可以得到是不是标准算法

image-20240903143940494

image-20240903143706451

代码

  • js代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
const Cryptojs = require("E:\\WAWS_ENV\\nodejs\\node_modules\\crypto-js")

function md5encrypto(text) {
return Cryptojs.MD5(text).toString()
}

var Pi = {
objKeySort: A => {
for (var i = Object.keys(A).sort(), e = {}, t = 0; t < i.length; t++)
(A[i[t]] || "0" == A[i[t]]) && (e[i[t]] = A[i[t]]);
return e
}
,
getparam: A => {
var i = "?";
for (var e in A)
i += e,
i += "=",
i += A[e],
i += "&";
return i = i.substr(0, i.length - 1)
}
,
getQueryVariable: A => {
for (var i = window.location.hash.substring(1), e = (i = i.split("?")[1]).split("&"), t = 0; t < e.length; t++) {
var I = e[t].split("=");
if (I[0] == A)
return I[1]
}
return !1
}
,
formatDate: A => {
if (A) {
let i = Math.floor(A / 1e3 / 60 / 60)
, e = Math.floor(A / 1e3 / 60 % 60)
, t = Math.floor(A / 1e3 % 60);
return i = i < 10 ? "0" + i : i,
e = e < 10 ? "0" + e : e,
t = t < 10 ? "0" + t : t,
i + "h " + e + "m " + t + "s"
}
}
,
contract: (A, i = 4, e = 3) => A && A.replace(new RegExp("(.{" + i + "}).*(.{" + e + "})"), "$1******$2"),
toast: (A, i = "error") => {
v({
message: A,
type: i,
customClass: "huancang"
})
}
,
copyText: A => {
let i = document.createElement("textarea");
i.value = A,
document.body.appendChild(i),
i.select(),
document.execCommand("Copy"),
v({
message: "复制成功",
type: "success",
customClass: "huancang"
}),
i.remove()
}
,
setStorage: (A, i) => {
"string" == typeof i ? localStorage.setItem(A, i) : localStorage.setItem(A, JSON.stringify(i))
}
,
getStorage: A => {
let i = localStorage.getItem(A);
return i ? 0 == i.indexOf("{") || 0 == i.indexOf("[") ? JSON.parse(i) : i : ""
}
,
routerTo: A => {
Hi.push(A)
}
,
navTo: A => {
A.indexOf && 0 == A.indexOf("http") ? null != window.open(A) || (window.location.href = A) : Hi.push(A)
}
,
strTrim: (A, i) => {
let e;
return e = A.replace(/(^\s+)|(\s+$)/g, ""),
i && "g" == i.toLowerCase() && (e = e.replace(/\s/g, "")),
e
}
,
getImg: A => {
const i = `/src/assets/img/${A}`;
let e;
return A.indexOf("svg/") > -1 ? (e = {
"/src/assets/img/svg/no-data.svg": Ci
},
e[i] && e[i].default) : (e = {
"/src/assets/img/2022.png": q,
"/src/assets/img/9b823a67f06c34f6359a0c78870a20c7.jpg": _,
"/src/assets/img/address.png": $,
"/src/assets/img/alipay.png": AA,
"/src/assets/img/b-title-l.png": iA,
"/src/assets/img/b-title-r.png": eA,
"/src/assets/img/balance.png": tA,
"/src/assets/img/bank.png": lA,
"/src/assets/img/banner-collection.jpg": cA,
"/src/assets/img/banner1-1.jpg": mA,
"/src/assets/img/banner1.jpg": bA,
"/src/assets/img/bg-l.png": ZA,
"/src/assets/img/bg-r.png": gA,
"/src/assets/img/bh.png": RA,
"/src/assets/img/bh2-1.png": GA,
"/src/assets/img/bh2.png": aA,
"/src/assets/img/check.png": dA,
"/src/assets/img/close.png": oA,
"/src/assets/img/cz.png": YA,
"/src/assets/img/default-avatar.png": jA,
"/src/assets/img/delete.png": nA,
"/src/assets/img/dizuo.png": hA,
"/src/assets/img/ewm.jpg": DA,
"/src/assets/img/ewm1.png": pA,
"/src/assets/img/exchangebg.jpg": WA,
"/src/assets/img/fm.png": wA,
"/src/assets/img/footer-logo.png": yA,
"/src/assets/img/footer-logo1.png": uA,
"/src/assets/img/ga.png": SA,
"/src/assets/img/gaw.jpg": EA,
"/src/assets/img/gift-on.png": sA,
"/src/assets/img/gift.png": OA,
"/src/assets/img/hcbg.jpg": TA,
"/src/assets/img/hclogo2.png": vA,
"/src/assets/img/hcys.png": LA,
"/src/assets/img/icp.jpg": QA,
"/src/assets/img/inviteFriends-on.png": VA,
"/src/assets/img/inviteFriends.png": FA,
"/src/assets/img/jc.png": CA,
"/src/assets/img/js.png": BA,
"/src/assets/img/lock.png": HA,
"/src/assets/img/logo.png": PA,
"/src/assets/img/more.png": XA,
"/src/assets/img/no-sc.png": fA,
"/src/assets/img/notice-on.png": KA,
"/src/assets/img/notice.22be071d.jpg": qA,
"/src/assets/img/notice.jpg": $A,
"/src/assets/img/notice.png": Ai,
"/src/assets/img/orders-on.png": ii,
"/src/assets/img/orders.png": ei,
"/src/assets/img/play.png": Ii,
"/src/assets/img/qb.png": ci,
"/src/assets/img/sandpay.png": mi,
"/src/assets/img/set-on.png": Mi,
"/src/assets/img/set.png": bi,
"/src/assets/img/sy.png": gi,
"/src/assets/img/synthesis-on.png": Ri,
"/src/assets/img/synthesis.png": Gi,
"/src/assets/img/tx.png": di,
"/src/assets/img/uncheck.png": oi,
"/src/assets/img/user.png": Yi,
"/src/assets/img/userCenter-on.png": ji,
"/src/assets/img/userCenter.png": Ni,
"/src/assets/img/v.png": hi,
"/src/assets/img/wallet-on.png": Di,
"/src/assets/img/wallet.png": pi,
"/src/assets/img/wb.png": Wi,
"/src/assets/img/wechat_pay.png": wi,
"/src/assets/img/wx.png": yi,
"/src/assets/img/xs.png": ui,
"/src/assets/img/ysp.jpg": ki,
"/src/assets/img/zeng.png": Ei,
"/src/assets/img/zl.png": Oi,
"/src/assets/img/zm.png": Ti,
"/src/assets/img/zs.png": Li,
"/src/assets/img/zs1.png": Ui,
"/src/assets/img/zz.jpg": Vi,
"/src/assets/img/zz.png": Fi
},
e[i] && e[i].default)
}
,
formatImgUrl: A => {
b();
if (A)
return -1 == A.indexOf("base64") && 0 != A.indexOf("http") && (A = (A = `https://file.huancang.art/${A}`).replace("//uploads", "/uploads")),
A
}
,
date: (A, i) => {
i = "" + i.length <= 10 ? 1e3 * +i : +i;
let e = new Date(i)
, t = e.getFullYear()
, I = e.getMonth() + 1
, l = e.getDate()
, c = e.getHours()
, m = e.getMinutes()
, M = e.getSeconds();
return I = I < 10 ? "0" + I : I,
l = l < 10 ? "0" + l : l,
c = c < 10 ? "0" + c : c,
m = m < 10 ? "0" + m : m,
M = M < 10 ? "0" + M : M,
A.replace(/[YmdHis]/g, (A => ({
Y: t,
m: I,
d: l,
H: c,
i: m,
s: M
}[A])))
}
,
checkStr: (A, i) => {
switch (i) {
case "mobile":
return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(A);
case "tel":
return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(A);
case "card":
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(A);
case "mobileCode":
return /^[0-9]{4}$/.test(A);
case "bankAccount":
return /^[0-9]{16}$/.test(A);
case "pwd":
return /^([a-zA-Z0-9_]){6,18}$/.test(A);
case "payPwd":
return /^[0-9]{6}$/.test(A);
case "postal":
return /[1-9]\d{5}(?!\d)/.test(A);
case "QQ":
return /^[1-9][0-9]{4,9}$/.test(A);
case "email":
return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(A);
case "money":
return /^\d*(?:\.\d{0,2})?$/.test(A);
case "URL":
return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(A);
case "IP":
return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(A);
case "date":
return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(A) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(A);
case "number":
return /^[0-9]$/.test(A);
case "english":
return /^[a-zA-Z]+$/.test(A);
case "chinese":
return /^[\\u4E00-\\u9FA5]+$/.test(A);
case "lower":
return /^[a-z]+$/.test(A);
case "upper":
return /^[A-Z]+$/.test(A);
case "HTML":
return /<("[^"]*"|'[^']*'|[^'">])*>/.test(A);
default:
return !0
}
}
};

function waws(page) {
// x-token的生成
let i = (new Date).getTime(),
data = {
"page": page,
"per_page": 12,
"flag": "top",
"timestamp": i
}
data = Pi.getparam(Pi.objKeySort(data))
Xi = '6RNRDpjjV6wZ2ssPxqeIBeSoV1ITXDdC'
data = `${data}&key=${Xi}`

path = "api/product/getproductsearch"
data = (path + data).toLowerCase()
x_token = md5encrypto(data)

signature = md5encrypto(md5encrypto("7Tv7LrinK2bsNAi9TF2uui3ZIcoxK1WT"))
return {'x_token':x_token,"signature":signature,"timestamp":i}
}

console.log(waws(2))
  • python代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import requests
import execjs

page = "3"
t = execjs.compile(open('./demo.js',"r",encoding='utf-8').read()).call('waws',page)

headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'zh-CN,zh;q=0.9',
'cache-control': 'no-cache',
'content-type': 'application/json;charset=UTF-8',
'origin': 'https://huancang.art',
'pragma': 'no-cache',
'priority': 'u=1, i',
'referer': 'https://huancang.art/',
'sec-ch-ua': '"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'signature': t['signature'],
'token': 'null',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
'x-token': t['x_token'],
}
proxies = {
'http': '127.0.0.1:10792',
'https': '127.0.0.1:10792'
}

params = {
'flag': 'top',
'page': page,
'per_page': '12',
'timestamp': str(t['timestamp']),
}

response = requests.get('https://api.huancang.art/api/product/getProductSearch', params=params, headers=headers,proxies=proxies).text
print(response)

结果

image-20240903151320312