吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2333|回复: 8
收起左侧

[已解决] 终端爬虫失败,IDE里成功

[复制链接]
thepoy 发表于 2019-7-29 16:56
本帖最后由 thepoy 于 2019-7-29 18:38 编辑

很简单的代码:
[Python] 纯文本查看 复制代码
import requests

url = 'https://www.ipip.net'
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'}
res = requests.get(url, headers=headers)
res.encoding = res.apparent_encoding
print(res.text)


在IDE里运行正常输出结果,但在终端里却被检测,当成黑客入侵被拦截,请问如何破?

输出信息如下:
[HTML] 纯文本查看 复制代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
body{ background:#fff; font-family: microsoft yahei; color:#969696; font-size:14px;}
.online-desc-con { text-align:center; }
.r-tip01 { color: #333; font-size: 18px; display: block; text-align: center; width: 500px; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; margin: 0 auto 15px; }
.r-tip02 { color: #585858; font-size: 14px; display: block; margin-top: 20px; margin-bottom: 20px; }
#notice-jiasule {
  word-wrap: break-word;
  word-break: normal;
  color:#585858;
  border:1px solid #ddd;
  padding:0px 20px 0px 20px
}
img { border: 0; }
.u-ico{ vertical-align: middle; margin-right: 12px;}
.btn{ padding: 8px 22px; border-radius: 3px; border: 0; display: inline-block;vertical-align: middle;text-decoration: none;}
.btn-g{ background-color: #61b25e; color: #fff;}
.report {color: #858585; text-decoration: none;}
.report:hover {text-decoration: underline; color: #0088CC;}
hr{ border-top: 1px dashed #ddd;}
center{ line-height: 48px; color: #919191;}
</style>
<script type="text/template" id="content_tpl">
    <span class="r-tip01"><%= error_403 %></span>
    <div id='notice-jiasule'>
        <p>当前网址:<%- url %></p>
        <p>客户端特征:<%- user_agent %></p>
        <p>拦截时间:<%- now %>  本次事件ID <%- rule_id %></p>
    </div>
    <span class='r-tip02'>
        <img class='u-ico' alt='' src='/cdn-cgi/image/guest.png' />如果您是网站管理员,请登录知道创宇云安全 
        <a class='btn btn-g' href='http://help.yunaq.com/feedback.html?from=<%- from %>&rule_id=<%- rule_id %>&client_ip=<%- client_ip %>&referrer=<%- ref %>#pus' target='_blank'>查看详情</a>
         或者 
        <a class='report' href='http://help.yunaq.com/feedback.html?from=<%- from %>&rule_id=<%- rule_id %>&client_ip=<%- client_ip %>&referrer=<%- ref %>#hus' target='_blank'>反馈误报</a>
    </span>
</script>
<script type="text/javascript" src="/cdn-cgi/js/underscore_min_1.8.3.js"></script>
</head>
<body>
<div class="online-desc-con" style="width:640px;padding-top:15px;margin:34px auto;">
        <img alt="" style="margin: 0 auto 17px auto;" src="/cdn-cgi/image/protected.png" />
    <div id="content_rendered"></div>
        <hr />
        <center>client: ×××× server: 21950ec, time: 2019-07-29 16:55:53</center>
</div>
<script>
void(function fuckie6(){if(location.hash && /MSIE 6/.test(navigator.userAgent) && !/jsl_sec/.test(location.href)){location.href = location.href.split('#')[0] + '&jsl_sec' + location.hash}})();
var content = _.template(document.getElementById('content_tpl').innerHTML)({
    error_403: '您的IP( ×××× )最近有可疑的攻击行为,请稍后重试.' || '当前访问疑似黑客攻击,已被网站管理员设置为拦截',
    url: document.URL.replace(/\</g,"%3C").replace(/\>/g,"%3E"),
    user_agent: navigator.userAgent,
    now: new Date(new Date() - -8 * 3600000).toISOString().substr(0, 19).replace('T', ' '),
    rule_id: parseInt('<!--RULE_ID-->'.replace(/\[|\]/g, '')) || '',
    from: encodeURIComponent(document.referrer.substr(0, 1024)),
    client_ip: '××××',
    ref: encodeURIComponent(document.URL.substr(0, 1024))
});
document.getElementById('content_rendered').innerHTML = content;
</script>
<div style="display:none;">
    <script>
        var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
        document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fd7682ab43891c68a00de46e9ce5b76aa' type='text/javascript'%3E%3C/script%3E"));
    </script>
</div>
</body>

</html>

免费评分

参与人数 1热心值 +1 收起 理由
小猫咪P + 1 鼓励转贴优秀软件安全工具和文档!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Niuer 发表于 2019-7-29 17:13
访问频率太快了吧
 楼主| thepoy 发表于 2019-7-29 17:16
Niuer 发表于 2019-7-29 17:13
访问频率太快了吧

好像是的,在等待了一段时间后,终端和IDE都可以访问了
Niuer 发表于 2019-7-29 17:18
thepoy 发表于 2019-7-29 17:16
好像是的,在等待了一段时间后,终端和IDE都可以访问了

代码加个延迟吧  能最佳答案了嘛
chinaround 发表于 2019-7-29 17:26
访问速度过快,还是把判断的去掉吧
jidesheng6 发表于 2019-7-29 17:30
频率太快了不是终端或者ide问题
li18363882821 发表于 2019-7-29 17:33
Niuer 发表于 2019-7-29 17:18
代码加个延迟吧  能最佳答案了嘛

试试这个方案应该可以
堕落ぁ狼 发表于 2019-7-29 17:58
知道创于的防火墙拦了
 楼主| thepoy 发表于 2019-7-29 18:39
Niuer 发表于 2019-7-29 17:18
代码加个延迟吧  能最佳答案了嘛

这还有最佳答案吗?没看见有这个功能啊
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-6-11 13:06

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表