python爬虫-国家企业_国家企业信用公示系统的爬取

python爬⾍-国家企业_国家企业信⽤公⽰系统的爬取
具体操作:
response = (kie_url)
js_code1 =
print(js_code1)
kies)
输出
]>
对这段代码进⾏js反混淆,得到
var x =
"toLowerCase@@@@267@@@@window@36@@@@firstChild@div@@catch@@var@rOm9XFMtA3QKV7nYsPGT4lifyWwkq5vcjH2I "").split("@"),
y = "j 3=34(){2r('y.30=y.1e+y.2f.33(/[\\?|&]32-2a/,\\'\\')',1a);3c.10='2l=1p.5|1b|'+(34(){j 3=2m(+[[[-~{}+(+!-[])+(+!-[])]*(-~
{}+(+!-[])+(+!-[]))]]),1g=['%',[[(+!-[])+(+!-[])]/~~''+[[]][1b]][1b].22(24),'3n%2q',[{}+[]+[]][1b].22(-~~~''-~[-~~~''+(-~~~''<
f = function(x, y) {
var a = 0,
b = 0,
c = 0;
x = x.split("");
y = y || 99;
while ((a = x.shift()) && (b = a.charCodeAt(0) - 77.5)) c = (Math.abs(b) < 13 ? (b + 48.5) : parseInt(a,
36)) + y * c;
return c
},
z = f(y.match(/\w/g).sort(function(x, y) {
return f(x) - f(y)
}).pop());
while (z++) try {冰棍机
place(/\b\w+\b/g, function(y) {
return x[f(y, z) - 1] || ("_" + y)
}));
break
} catch (_) {}
对js代码进⾏格式化处理,再调⽤python的execjs执⾏这段代码,如下所⽰:
js_code1 = js_code1.rstrip('\n')
js_code1 = place('', '')
js_code1 = place('
index = js_code1.rfind('}')
js_code1 = js_code1[0:index + 1]
js_code1 = 'function getCookie() {' + js_code1 + '}'压片机模具
js_code1 = place('eval', 'return')
js_code2 = execjspile(js_code1)
code = js_code2.call('getCookie')
print(code)
得到结果为:
var _1l=function(){setTimeout('location.href=location.pathname+place(/[\?|&]captcha-
challenge/,\'\')',1500);kie='__jsl_clearance=1553940235.414|0|'+(function(){var _1l=Array(+[[-~!{}]+[-~! {}]]),_O=['URpBd',(((+!-[])+[(+!-[])+(+!-[])]>>(+!-[])+(+!-[]))+[[]][0]),'BM',(((+!-[])+[(+!-[])+(+!-[])]>>(+!-[])+(+!-[]))+[[]][0])+[{}+ []+[[]][0]][0].charAt(-~{}),'GQ7RqBB',(!+[]+[]+[[]][0]).charAt(~~'')+[[(+!-[])+(+!-[])]/~~''+[]][0].charAt((-~~~''<<-~~~'')+([(+!-[])+ (+!-[])]+~~!{}>>(+!-[])+(+!-[]))),'LMV',({}+[]).charAt([-~!{}]+(~~''+[[]][0])),'BUc%',(!{}+[]+[[]][0]).charAt(-~!{})+[{}+[]+[[]][0]] [0].charAt(-~{}),'D'];for(var _7=0;_7<_O.length;_7++){_1l.reverse()[_7]=_O[_7]};return _1l.join('')})()+';Expires=Sat, 30-Mar-19 11:03:55 GMT;Path=/;'};if((function(){try{return !!window.addEventListener;}catch(e){return false;}})())
{document.addEventListener('DOMContentLoaded',_1l,false)}else{document.attachEvent('onreadystatechange',_1l)}
同样进⾏js反混淆,得到
var _1l = function () {
setTimeout('location.href=location.pathname+place(/[\?|&]captcha-challenge/,\'\')', 1500);
按摩锤kie = '__jsl_clearance=1553940235.414|0|' + (function () {
var _1l = Array(+[
[-~!{}] + [-~!{}]
]),
_O = ['URpBd', (((+!-[]) + [(+!-[]) + (+!-[])] >> (+!-[]) + (+!-[])) + [
[]
][0]), 'BM', (((+!-[]) + [(+!-[]) + (+!-[])] >> (+!-[]) + (+!-[])) + [
[]连续供墨系统
][0]) + [{} + [] + [
[]
][0]][0].charAt(-~ {}), 'GQ7RqBB', (!+[] + [] + [
[]
][0]).charAt(~~'') + [
[(+!-[]) + (+!-[])] / ~~'' + []
][0].charAt((-~~~'' << -~~~'') + ([(+!-[]) + (+!-[])] + ~~!{} >> (+!-[]) + (+!-[]))), 'LMV', ({} + []).charAt([-~!{}] + (~~'' + [
[]
][0])), 'BUc%', (!{} + [] + [
[]
][0]).charAt(-~!{}) + [{} + [] + [
[]
电池钢壳
][0]][0].charAt(-~ {}), 'D'];
for (var _7 = 0; _7 < _O.length; _7++) {
_1l.reverse()[_7] = _O[_7]
};
return _1l.join('')
})() + ';Expires=Sat, 30-Mar-19 11:03:55 GMT;Path=/;'
};
if ((function () {
try {
return !!window.addEventListener;
} catch (e) {
return false;
}
})()) {
document.addEventListener('DOMContentLoaded', _1l, false)
} else {
document.attachEvent('onreadystatechange', _1l)
}
同样对这段js代码格式化,再⽤python的execjs进⾏调⽤,得到结果
code = 'var a' + code.split('kie')[1].split("Path=/;'")[0] + "Path=/;';return a;" code = 'window = {}; \n' + code
js_final = "function getClearance(){" + code + "};"
ctx = execjspile(js_final)
jsl_clearance = ctx.call('getClearance')
jsl_cle = jsl_clearance.split(';')[0].split('=')[1]
print('__jsl_clearance=' + jsl_cle)
得到最终⽣成的cookie
__jsl_clearance=1553940235.414|0|URpBdaoBMjGQ7RqBBtyLMV3oBUc%3D
与第⼀次请求得到的cookie ⼀起发送给服务器,就能返回正常结果。
>复合柴油

本文发布于:2024-09-23 16:29:00,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/1/205324.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:得到   系统   处理   结果   服务器   模具   钢壳
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议