提交 fead3b1a 编写于 作者: 梦想橡皮擦's avatar 梦想橡皮擦 💬

开发者工具禁用

上级 446fd033
......@@ -27,6 +27,12 @@
19. [网站响应数据加一个简单的密,就能挡住80%的爬虫,你信吗?](https://dream.blog.csdn.net/article/details/128474924)
20. [一秒一个Token甩到前台,吓死在座的各位爬虫工程师](https://dream.blog.csdn.net/article/details/128474930)
21. [反爬工程师都会用的手段,IP限制反爬 - 爬虫训练场](https://dream.blog.csdn.net/article/details/128550653)
22. [听说你想要用爬虫采集我的手机号?哎 ~ 我展示用的是图片](https://dream.blog.csdn.net/article/details/128550667)
23. [反爬案例:不登录不给,要数据请先登录我的站点](https://dream.blog.csdn.net/article/details/128550693?spm=1001.2014.3001.5502)
24. [CSS偏移反爬见过没,打开本文你就能学会 | 爬虫训练场](https://dream.blog.csdn.net/article/details/128550707?spm=1001.2014.3001.5502)
25. [听说你想用开发者工具调试我的网站?挺可以的啊](https://dream.blog.csdn.net/article/details/128666768?spm=1001.2014.3001.5502)
## 小知识点补充博客
......@@ -39,6 +45,7 @@
7. [【小知识点】免费头像API,用 Python Flask 动态生成一个汉字头像](https://blog.csdn.net/hihell/article/details/128583823?spm=1001.2014.3001.5501)
8. [【小知识点】Python随机生成 Phone 号码,测试用~](https://blog.csdn.net/hihell/article/details/128594941?spm=1001.2014.3001.5501)
9. [【小知识点】Centos 自动任务,定时执行 Python 脚本](https://blog.csdn.net/hihell/article/details/128600920?spm=1001.2014.3001.5501)
10. [Python flask 框架使用 flask-login 模块,来学习一下吧](https://dream.blog.csdn.net/article/details/128639871?spm=1001.2014.3001.5502)
## 站点数据储备博客
......
......@@ -27,19 +27,20 @@ def hide_middle(str, count=4, fix='*'):
if str_len - 2 > count:
if count % 2 == 0:
if str_len % 2 == 0:
ret_str = str[:int(str_len / 2 - count / 2)] + " "+ fix+" " + str[int(str_len / 2 + count / 2):]
ret_str = str[:int(str_len / 2 - count / 2)] + " " + fix + " " + str[int(str_len / 2 + count / 2):]
else:
ret_str = str[:int((str_len + 1) / 2 - count / 2)] + " "+ fix+" " + str[int((
ret_str = str[:int((str_len + 1) / 2 - count / 2)] + " " + fix + " " + str[int((
str_len + 1) / 2 + count / 2):]
else:
if str_len % 2 == 0:
ret_str = str[:int(str_len / 2 - (count - 1) / 2)] + " "+ fix+" " + str[int(str_len / 2 + (
count + 1) / 2):]
ret_str = str[:int(str_len / 2 - (count - 1) / 2)] + " " + fix + " " + str[int(str_len / 2 + (
count + 1) / 2):]
else:
ret_str = str[:int((str_len + 1) / 2 - (count + 1) / 2)] + " "+ fix+" " + str[
int((str_len + 1) / 2 + (
count - 1) / 2):]
ret_str = str[:int((str_len + 1) / 2 - (count + 1) / 2)] + " " + fix + " " + str[
int((
str_len + 1) / 2 + (
count - 1) / 2):]
else:
ret_str = str[0] + " "+ fix+" " + str[-1]
ret_str = str[0] + " " + fix + " " + str[-1]
return ret_str
......@@ -102,6 +102,15 @@ def ajax_list():
return render_template('school/ajax_list.html', pagination=pagination)
# 禁用开发者工具调试相关逻辑
@s.route('debugg')
def debugg_list():
page = 1
pagination = pagination_object(page)
return render_template('school/debugg.html', pagination=pagination)
@s.route('api2')
def ajax_list_school():
page = int(request.args.get("page", 1))
......
......@@ -51,6 +51,18 @@
class="list-group-item list-group-item-action">18. 离职原因:让 BOSS 学习“滚动加载”这一名词</a>
<a href="https://dream.blog.csdn.net/article/details/128474924" target="_blank"
class="list-group-item list-group-item-action">19. 网站响应数据加一个简单的密,就能挡住80%的爬虫,你信吗?</a>
<a href="https://dream.blog.csdn.net/article/details/128474930?spm=1001.2014.3001.5502" target="_blank"
class="list-group-item list-group-item-action">20. 一秒一个Token甩到前台,吓死在座的各位爬虫工程师</a>
<a href="https://dream.blog.csdn.net/article/details/128550653?spm=1001.2014.3001.5502" target="_blank"
class="list-group-item list-group-item-action">21. 反爬工程师都会用的手段,IP限制反爬 - 爬虫训练场</a>
<a href="https://dream.blog.csdn.net/article/details/128550667?spm=1001.2014.3001.5502" target="_blank"
class="list-group-item list-group-item-action">22. 听说你想要用爬虫采集我的手机号?哎 ~ 我展示用的是图片</a>
<a href="https://dream.blog.csdn.net/article/details/128550693?spm=1001.2014.3001.5502" target="_blank"
class="list-group-item list-group-item-action">23. 反爬案例:不登录不给,要数据请先登录我的站点</a>
<a href="https://dream.blog.csdn.net/article/details/128550707?spm=1001.2014.3001.5502" target="_blank"
class="list-group-item list-group-item-action">24. CSS偏移反爬见过没,打开本文你就能学会 | 爬虫训练场</a>
<a href="https://dream.blog.csdn.net/article/details/128666768?spm=1001.2014.3001.5502" target="_blank"
class="list-group-item list-group-item-action">25. 听说你想用开发者工具调试我的网站?挺可以的啊。</a>
</div>
</div>
</div>
......
......@@ -325,7 +325,30 @@
</p>
</div>
<div class="card-footer text-end">
<a href="https://dream.blog.csdn.net/article/details/128550667" target="_blank"
<a href="https://dream.blog.csdn.net/article/details/128550707" target="_blank"
class="card-link text-muted small">案例制作教程</a>
<a href="#" class="btn btn-success btn-sm card-link disabled" alt="暂未开放">学习博客</a>
</div>
</div>
</div>
<div class="col mt-2">
<div class="card border-info rounded-5 shadow-sm" style="min-height:306px;min-width:300px;">
<div class="card-header text-center">
<h4 class="card-title">禁用开发者工具</h4>
<div class="bg-danger text-white rounded p-1"
style="transform: rotate(20deg); position:absolute;right:0;top:0.5rem;">最新更新
</div>
</div>
<div class="card-body">
<p class="card-text">爬虫工程师在调试Web站点的时候,离不开开发者工具,实战中我们可以对开发者工具进行限制,达到反爬目的</p>
<p class="card-text text-left">难度:⭐</p>
<p class="card-text">
案例:
<a href="/ss/debugg" class="card-link text-success">限制开发者工具</a>
</p>
</div>
<div class="card-footer text-end">
<a href="https://dream.blog.csdn.net/article/details/128666768" target="_blank"
class="card-link text-muted small">案例制作教程</a>
<a href="#" class="btn btn-success btn-sm card-link disabled" alt="暂未开放">学习博客</a>
</div>
......
{% extends "base.html" %}
{% block script %}
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.6.0.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/devtools-detector/2.0.14/devtools-detector.min.js"></script>
<script type="text/javascript">
// 禁用右键菜单
document.oncontextmenu = function () {
return false;
}
// 禁用 F12
document.onkeydown = function (e) {
if (e.which === 123) {
return false;
}
}
document.onkeydown = function (e) {
if (e.ctrlKey && e.which === 85) {
alert("已经禁用");
return false;
}
}
document.onkeydown = function (e) {
if (e.ctrlKey && e.shiftKey && e.which === 73) {
alert("已经禁用");
return false;
}
}
function get_data(page){
$.ajax({
type: "get",
url: "/ss/api2",
data: {
page: page
},
success: function(response) {
// ajax 请求成功
render_data(response);
// 修改分页数据
$('.prev').attr('page',response["prev_page"]);
$('.next').attr('page',response["next_page"]) ;
console.log("AJAX request succeeded!");
},
error: function(error) {
console.log("AJAX request failed: " + error);
}
});
}
function render_data(response){
data_list = response["data_list"];
if(data_list.length>0){
$('#school_list').empty();
$.each(data_list,function(index,item){
var row = $('<div>', {
'class': 'row mt-3',
'data-custom-attribute': 'value'
});
var col =$('<div>', {
'class': 'col'
});
var d_flex = $('<div>', {
'class': 'd-flex'
});
d_flex.append('<div class="flex-shrink-0"><a href="#"><img class="rounded-pill img-thumbnail" width="64" height="64" src="'+item.pic+'" alt=""></a></div>');
// 生成一下标签代码
var badge = "";
$.each(item.feature.split(','),function(i,f){
badge += ' <span class="badge rounded-pill bg-primary">'+f+'</span> ';
});
d_flex.append('<div class="flex-grow-1 ms-3"><h5 class="float-start pe-3">'+item.name+'</h5><p class="ms-3">'+badge+'</p><p><em>所在省市:<span class="text-black-50">'+item.province+'--'+item.city+'</span></em></p></div>')
col.append(d_flex);
row.append(col);
$('#school_list').append(row);
})
}
}
$(function(){
$('.page-item').on('click',function(){
page = $(this).attr('page');
// 获取数据
get_data(page);
})
})
</script>
{% endblock script %}
{% block content %}
<div class="container" id="school_list">
{% for school in pagination.data_list %}
<div class="row mt-3">
<div class="col">
<div class="d-flex">
<div class="flex-shrink-0">
<a href="#">
<img class="rounded-pill img-thumbnail" width="64" height="64" src="{{school.pic}}" alt="">
</a>
</div>
<div class="flex-grow-1 ms-3">
<h5 class="float-start pe-3">{{school.name}}</h5>
<p class="ms-3">
{% for fea in school.feature.split(',') %}
<span class="badge rounded-pill bg-primary">{{fea}}</span>
{% endfor %}
</p>
<p><em>所在省市:<span class="text-black-50">{{school.province}} -- {{school.city}}</span></em></p>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<div class="container">
<div class="row">
<div class="col">
<span class="text-dark float-end align-middle"
style="line-height: 40px;">合计 {{pagination.total}} 条数据</span>
<ul class="pagination float-end">
<li class="page-item prev" page="{{pagination.prev_page}}">
<a class="page-link" href="#">上一页</a>
</li>
<li class="page-item next" page="{{ pagination.next_page }}"><a class="page-link"
href="#">下一页</a>
</li>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
devtoolsDetector.addListener(function(isOpen) {
if (isOpen){
$('#school_list').html('<h2>请不要使用开发者工具调试</h2>');
}
});
devtoolsDetector.launch();
</script>
{% endblock %}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册