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

字体加密+多肉加密

上级 998399ee
......@@ -8,7 +8,7 @@ from flask_limiter import Limiter
# from flask_limiter.util import get_remote_address, get_ipaddr
# 导入过滤器
from .filter_fun import datauri,hide_middle
from .filter_fun import datauri, hide_middle
app = Flask(__name__)
......@@ -43,6 +43,7 @@ from .slow.index import *
from .user.index import *
from .apis.index import *
from .hw.index import *
from .duorou.index import *
app.register_blueprint(s)
app.register_blueprint(f)
......@@ -52,3 +53,4 @@ app.register_blueprint(slow)
app.register_blueprint(u)
app.register_blueprint(api)
app.register_blueprint(hw)
app.register_blueprint(dr)
from flask import Blueprint, jsonify, request, redirect, url_for
from flask import Blueprint, jsonify, request, redirect, url_for,Markup
from flask import render_template
from csscompressor import compress
import random
......@@ -149,3 +149,19 @@ def games():
for item in json_data:
item["search"] = list(map(int, str(item["search"])))
return render_template("antispider/game.html", nums_dict=nums_dict,games = json_data)
# 字体反爬
@antispider.route('/font')
def font():
fonts = ['','','','','','','','','','']
mynum = 9843670
ret = list(map(int, str(mynum)))
new_num_str = "".join([fonts[_] for _ in ret])
html_string = new_num_str
# Markup()
safe_html = Markup(html_string)
return render_template("antispider/font.html", new_num_str=safe_html)
此差异已折叠。
from flask import Blueprint, jsonify, request
from flask import render_template
from app import app
import json
dr = Blueprint('dr', __name__, url_prefix='/dr')
@dr.route('/list')
def duorou_list():
with open(app.root_path + '/data/duorou.json', 'r', encoding='utf-8') as f:
json_data = json.loads(f.read())
page = request.args.get("page", 1)
# 拆分页码 page=1 获取1-10数据,page=2 获取11-20数据
start = (int(page) - 1) * 10 + 1
end = start+10
duorou = json_data[start:end]
totalPage = 15
currentPage = page
return render_template('duorou/list.html', tp=totalPage, cp=currentPage,duorou=duorou)
@dr.route('/detail')
def duorou_detail():
with open(app.root_path + '/data/duorou.json', 'r', encoding='utf-8') as f:
json_data = json.loads(f.read())
id_ = request.args.get("id", 1)
detail = json_data[int(id_)-1]
return render_template('duorou/detail.html',duorou=detail)
\ No newline at end of file
{% extends "base.html" %}
{% block style %}
<style>
@font-face {
font-family: 'ca-font';
src: url('{{url_for("static",filename="font/ca_font.woff")}}');
}
.stonefont {
font-family: ca-font;
font-size:16px;
}
</style>
{% endblock style %}
{% block link %}
{% endblock link %}
{% block content %}
<div class="container">
<span class="stonefont"> {{new_num_str}}</span>
</div>
{% endblock %}
\ No newline at end of file
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="爬虫训练场,爬虫,爬虫靶场,爬虫案例,爬虫测试站">
<meta name="description" content="爬虫训练场,让天下没有失效的爬虫,梦想橡皮擦建设中">
<link rel="shortcut icon" href="{{url_for('static',filename='images/favicon.ico')}}" type="image/x-icon" />
{% if title%}
<title>爬虫训练场 | {{title}} ,让天下没有失效的爬虫</title>
{% else %}
<title>爬虫训练场,让天下没有失效的爬虫</title>
{%endif%}
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{{url_for('static',filename='css/base.css')}}">
\ No newline at end of file
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?da9d53b49ebc36aa452284a554d53e98";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?da9d53b49ebc36aa452284a554d53e98";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
\ No newline at end of file
</script>
\ No newline at end of file
{% extends "base.html" %}
{% block script %}
{% endblock script %}
{% block content %}
<div class="container text-center ">
<div class="card mx-auto mt-3" style="width:400px;">
<img src="{{duorou.url}}" class="card-img-top img-thumbnail" alt="{{duorou.title}}">
<div class="card-body">
<h5 class="card-title">{{duorou.title}}</h5>
<p class="card-text text-black-50">{{duorou.detail}}</p>
<a href="javascript:history.go(-1);" class="btn btn-primary">返回</a>
</div>
</div>
</div>
{% endblock %}
{% extends "base.html" %}
{% block script %}
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.6.0.min.js"></script>
{% endblock script %}
{% block content %}
<div class="container">
<div class="list-group">
{%for dr in duorou%}
<a href="/dr/detail?id={{(cp|int-1)*10+loop.index}}" class="list-group-item list-group-item-action" aria-current="true">
<div class="d-flex justify-content-start">
<div>
<img src="{{dr.url}}"
class="figure-img rounded" alt="" style="width:100px;">
</div>
<div class="ms-4 mt-3">
<h5 class="mb-1">{{dr.title}}</h5>
<p class="mb-1">{{dr.detail}}</p>
</div>
</div>
</a>
{%endfor%}
</div>
<div aria-label="page navigation" id="nav_navigation" class="mt-3">
</div>
</div>
<script>
$(function(){
refreshPages({{tp }}, {{cp}});
/**
* 刷新页码方法
* @param totalPage
* @param currentPage
*/
function refreshPages(totalPage, currentPage) {
//安全判断
if (currentPage < 1 ) {
currentPage = 1;
}
if (currentPage > totalPage) {
currentPage = totalPage;
}
var paginationInfo = getPagination(totalPage, currentPage);
//用id选择器写入页码部分代码(根据需求修改)
$("#nav_navigation").html(paginationInfo);
}
/**
* 获取分页
* @param totalPage 页码总量
* @param currentPage 当前页码
* @returns {String}
*/
function getPagination(totalPage, currentPage){
var paginationInfo = "<ul class='pagination pagination-sm justify-content-end' >";
if (currentPage == 1) {
paginationInfo += "<li class='disabled page-item'><a class='page-link' href='/dr/list?page={{cp| int-1}}'"+">«</a></li>";
}else {
//前一页
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page={{cp |int-1}}'"+">«</a></li>";
}
if(totalPage<=10){
//totalPage<=10
for(var i=1; i<=totalPage; i++){
if (i == currentPage) {
paginationInfo += "<li class='active page-item'> <a class='page-link' href='/dr/list?page="+i+"'>" + i + "</a></li>";
}else {
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page="+i+"'>" + i + " </a></li>";
}
}
}
else{
//totalPage > 10
if(currentPage<=3){
for(var i=1; i<=currentPage+2; i++){
//页码1、2
if (i == currentPage) {
paginationInfo += "<li class='active page-item'> <a class='page-link' href='/dr/list?page="+i+"' onclick='refreshPages(" + totalPage + " , " + i + ");searchJob(" + i + ")'>" + i + "</a></li>";
} else {
paginationInfo += "<li class='page-item'> <a class='page-link' href='/dr/list?page="+i+"' onclick='refreshPages("+ totalPage + " , " + i + ");searchJob(" + i + ")'>" + i + "</a></li>";
}
}
paginationInfo += "<li class='page-item'><a class='page-link' href='javascript:void(0);'>...</a></li>";
//最后一页的页码
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page="+totalPage+"'>" + totalPage + "</a></li>";
}else if(currentPage<=totalPage-5){
//totalPage > 10 currentPage > 3 currentPage<=totalPage-5 页码在中间部分
//页码为1的代码
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page=1'>" + 1 + "</a></li>";
//页码1后面的省略号
paginationInfo += "<li class='page-item'><a class='page-link' href='javascript:void(0);'>...</a></li>";
//中间部分代码
for(var i=currentPage-1; i<=currentPage+2; i++){
if (i == currentPage) {
paginationInfo += "<li class='active page-item'> <a class='page-link' href='/dr/list?page="+i+"'>" + i + "</a></li>";
} else {
paginationInfo += "<li class='page-item'> <a class='page-link' href='/dr/list?page="+i+"'>" + i + "</a></li>";
}
}
//后面的省略号
paginationInfo += "<li class='page-item'><a class='page-link' href='javascript:void(0);'>...</a></li>";
//最后一个页码
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page="+totalPage+"'>"+totalPage+"</a></li>";
}else{
//totalPage > 10 并且currentPage > totalPage-5 显示后面的页码
//页码1
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page=1'>"+1+"</a></li>";
//省略号
paginationInfo += "<li class='page-item'><a class='page-link' href='javascript:void(0);'>...</a></li>";
//最后几位页码
for(var i=currentPage-1; i<=totalPage; i++){
if (i == currentPage) {
paginationInfo += "<li class='active page-item'> <a class='page-link' href='/dr/list?page="+i+"'>"+i+"</a></li>";
}else {
paginationInfo += "<li class='page-item'> <a class='page-link' href='/dr/list?page="+i+"'>"+i+"</a></li>";
}
}
}
}
//下一页
if (currentPage == totalPage) {
paginationInfo += "<li class='disabled page-item'> <a class='page-link' href='/dr/list?page="+(currentPage + 1)+"'" + ">»</a></li>";
} else {
paginationInfo += "<li class='page-item'><a class='page-link' href='/dr/list?page="+(currentPage + 1)+"'"+">»</a></li>";
}
paginationInfo += "</ul>";
//返回结果
return paginationInfo;
}
})
</script>
{% endblock %}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册